From 10251dd1cba03222cb0d7028a3b0dbcac08ba322 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sat, 14 Feb 2026 12:43:31 -0500 Subject: [PATCH] Add bash line editor. --- .bash_aliases | 1 + .local/share/blesh/ble.sh | 29231 ++++++++++++++++ .../share/blesh/contrib/airline/alduin.bash | 29 + .local/share/blesh/contrib/airline/angr.bash | 31 + .../blesh/contrib/airline/apprentice.bash | 34 + .../share/blesh/contrib/airline/atomic.bash | 42 + .../share/blesh/contrib/airline/ayu_dark.bash | 25 + .../blesh/contrib/airline/ayu_light.bash | 25 + .../blesh/contrib/airline/ayu_mirage.bash | 24 + .../share/blesh/contrib/airline/badwolf.bash | 32 + .../share/blesh/contrib/airline/base16.bash | 26 + .../blesh/contrib/airline/base16_3024.bash | 21 + .../blesh/contrib/airline/base16_adwaita.bash | 21 + .../blesh/contrib/airline/base16_apathy.bash | 21 + .../blesh/contrib/airline/base16_ashes.bash | 21 + .../contrib/airline/base16_atelier_cave.bash | 26 + .../airline/base16_atelier_cave_light.bash | 26 + .../contrib/airline/base16_atelier_dune.bash | 26 + .../airline/base16_atelier_dune_light.bash | 26 + .../airline/base16_atelier_estuary.bash | 26 + .../airline/base16_atelier_estuary_light.bash | 26 + .../airline/base16_atelier_forest.bash | 26 + .../airline/base16_atelier_forest_light.bash | 26 + .../contrib/airline/base16_atelier_heath.bash | 26 + .../airline/base16_atelier_heath_light.bash | 26 + .../airline/base16_atelier_lakeside.bash | 26 + .../base16_atelier_lakeside_light.bash | 26 + .../airline/base16_atelier_plateau.bash | 26 + .../airline/base16_atelier_plateau_light.bash | 26 + .../airline/base16_atelier_savanna.bash | 26 + .../airline/base16_atelier_savanna_light.bash | 26 + .../airline/base16_atelier_seaside.bash | 26 + .../airline/base16_atelier_seaside_light.bash | 26 + .../airline/base16_atelier_sulphurpool.bash | 26 + .../base16_atelier_sulphurpool_light.bash | 26 + .../contrib/airline/base16_atelierdune.bash | 25 + .../contrib/airline/base16_atelierforest.bash | 21 + .../contrib/airline/base16_atelierheath.bash | 21 + .../airline/base16_atelierlakeside.bash | 21 + .../airline/base16_atelierseaside.bash | 21 + .../blesh/contrib/airline/base16_atlas.bash | 26 + .../blesh/contrib/airline/base16_bespin.bash | 21 + .../contrib/airline/base16_black_metal.bash | 26 + .../airline/base16_black_metal_bathory.bash | 26 + .../airline/base16_black_metal_burzum.bash | 26 + .../base16_black_metal_dark_funeral.bash | 26 + .../airline/base16_black_metal_gorgoroth.bash | 26 + .../airline/base16_black_metal_immortal.bash | 26 + .../airline/base16_black_metal_khold.bash | 26 + .../airline/base16_black_metal_marduk.bash | 26 + .../airline/base16_black_metal_mayhem.bash | 26 + .../airline/base16_black_metal_nile.bash | 26 + .../airline/base16_black_metal_venom.bash | 26 + .../blesh/contrib/airline/base16_brewer.bash | 21 + .../blesh/contrib/airline/base16_bright.bash | 21 + .../contrib/airline/base16_brogrammer.bash | 26 + .../contrib/airline/base16_brushtrees.bash | 26 + .../airline/base16_brushtrees_dark.bash | 26 + .../blesh/contrib/airline/base16_chalk.bash | 21 + .../blesh/contrib/airline/base16_circus.bash | 26 + .../blesh/contrib/airline/base16_classic.bash | 21 + .../contrib/airline/base16_classic_dark.bash | 26 + .../contrib/airline/base16_classic_light.bash | 26 + .../contrib/airline/base16_codeschool.bash | 21 + .../blesh/contrib/airline/base16_colors.bash | 21 + .../blesh/contrib/airline/base16_cupcake.bash | 26 + .../contrib/airline/base16_cupertino.bash | 25 + .../contrib/airline/base16_darktooth.bash | 26 + .../blesh/contrib/airline/base16_decaf.bash | 26 + .../blesh/contrib/airline/base16_default.bash | 21 + .../contrib/airline/base16_default_dark.bash | 26 + .../contrib/airline/base16_default_light.bash | 26 + .../blesh/contrib/airline/base16_dracula.bash | 26 + .../contrib/airline/base16_edge_dark.bash | 26 + .../contrib/airline/base16_edge_light.bash | 26 + .../contrib/airline/base16_eighties.bash | 21 + .../blesh/contrib/airline/base16_embers.bash | 21 + .../contrib/airline/base16_espresso.bash | 26 + .../blesh/contrib/airline/base16_flat.bash | 21 + .../blesh/contrib/airline/base16_framer.bash | 26 + .../contrib/airline/base16_fruit_soda.bash | 26 + .../contrib/airline/base16_gigavolt.bash | 26 + .../blesh/contrib/airline/base16_github.bash | 26 + .../blesh/contrib/airline/base16_google.bash | 21 + .../contrib/airline/base16_google_dark.bash | 26 + .../contrib/airline/base16_google_light.bash | 26 + .../contrib/airline/base16_grayscale.bash | 21 + .../airline/base16_grayscale_dark.bash | 26 + .../airline/base16_grayscale_light.bash | 26 + .../contrib/airline/base16_greenscreen.bash | 20 + .../airline/base16_gruvbox_dark_hard.bash | 24 + .../airline/base16_gruvbox_dark_medium.bash | 26 + .../airline/base16_gruvbox_dark_pale.bash | 26 + .../airline/base16_gruvbox_dark_soft.bash | 26 + .../airline/base16_gruvbox_light_hard.bash | 26 + .../airline/base16_gruvbox_light_medium.bash | 26 + .../airline/base16_gruvbox_light_soft.bash | 26 + .../contrib/airline/base16_harmonic16.bash | 21 + .../contrib/airline/base16_harmonic_dark.bash | 26 + .../airline/base16_harmonic_light.bash | 26 + .../blesh/contrib/airline/base16_heetch.bash | 26 + .../contrib/airline/base16_heetch_light.bash | 26 + .../blesh/contrib/airline/base16_helios.bash | 26 + .../contrib/airline/base16_hopscotch.bash | 21 + .../contrib/airline/base16_horizon_dark.bash | 26 + .../contrib/airline/base16_horizon_light.bash | 26 + .../airline/base16_horizon_terminal_dark.bash | 26 + .../base16_horizon_terminal_light.bash | 26 + .../blesh/contrib/airline/base16_ia_dark.bash | 26 + .../contrib/airline/base16_ia_light.bash | 26 + .../blesh/contrib/airline/base16_icy.bash | 26 + .../blesh/contrib/airline/base16_irblack.bash | 26 + .../blesh/contrib/airline/base16_isotope.bash | 21 + .../contrib/airline/base16_londontube.bash | 21 + .../contrib/airline/base16_macintosh.bash | 25 + .../contrib/airline/base16_marrakesh.bash | 21 + .../blesh/contrib/airline/base16_materia.bash | 26 + .../contrib/airline/base16_material.bash | 26 + .../airline/base16_material_darker.bash | 26 + .../airline/base16_material_lighter.bash | 26 + .../airline/base16_material_palenight.bash | 26 + .../airline/base16_material_vivid.bash | 26 + .../contrib/airline/base16_mellow_purple.bash | 26 + .../contrib/airline/base16_mexico_light.bash | 26 + .../blesh/contrib/airline/base16_mocha.bash | 21 + .../blesh/contrib/airline/base16_monokai.bash | 21 + .../blesh/contrib/airline/base16_nord.bash | 23 + .../blesh/contrib/airline/base16_nova.bash | 26 + .../blesh/contrib/airline/base16_ocean.bash | 21 + .../contrib/airline/base16_oceanicnext.bash | 21 + .../contrib/airline/base16_one_light.bash | 26 + .../blesh/contrib/airline/base16_onedark.bash | 26 + .../contrib/airline/base16_outrun_dark.bash | 26 + .../airline/base16_papercolor_dark.bash | 26 + .../airline/base16_papercolor_light.bash | 26 + .../blesh/contrib/airline/base16_paraiso.bash | 21 + .../blesh/contrib/airline/base16_phd.bash | 26 + .../blesh/contrib/airline/base16_pico.bash | 26 + .../blesh/contrib/airline/base16_pop.bash | 21 + .../blesh/contrib/airline/base16_porple.bash | 26 + .../contrib/airline/base16_railscasts.bash | 21 + .../blesh/contrib/airline/base16_rebecca.bash | 26 + .../contrib/airline/base16_sandcastle.bash | 26 + .../blesh/contrib/airline/base16_seti.bash | 21 + .../contrib/airline/base16_shapeshifter.bash | 21 + .../blesh/contrib/airline/base16_shell.bash | 28 + .../blesh/contrib/airline/base16_snazzy.bash | 36 + .../contrib/airline/base16_solarflare.bash | 26 + .../contrib/airline/base16_solarized.bash | 21 + .../airline/base16_solarized_dark.bash | 26 + .../airline/base16_solarized_light.bash | 26 + .../contrib/airline/base16_spacemacs.bash | 29 + .../contrib/airline/base16_summerfruit.bash | 21 + .../airline/base16_summerfruit_dark.bash | 26 + .../airline/base16_summerfruit_light.bash | 26 + .../airline/base16_synth_midnight_dark.bash | 26 + .../contrib/airline/base16_tomorrow.bash | 21 + .../airline/base16_tomorrow_night.bash | 26 + .../base16_tomorrow_night_eighties.bash | 26 + .../blesh/contrib/airline/base16_tube.bash | 26 + .../contrib/airline/base16_twilight.bash | 21 + .../contrib/airline/base16_unikitty_dark.bash | 26 + .../airline/base16_unikitty_light.bash | 26 + .../blesh/contrib/airline/base16_vim.bash | 26 + .../contrib/airline/base16_woodland.bash | 26 + .../contrib/airline/base16_xcode_dusk.bash | 26 + .../blesh/contrib/airline/base16_zenburn.bash | 26 + .../blesh/contrib/airline/base16color.bash | 40 + .../share/blesh/contrib/airline/behelit.bash | 27 + .../share/blesh/contrib/airline/biogoo.bash | 30 + .../blesh/contrib/airline/blood_red.bash | 22 + .../blesh/contrib/airline/bubblegum.bash | 28 + .../share/blesh/contrib/airline/cobalt2.bash | 26 + .local/share/blesh/contrib/airline/cool.bash | 25 + .../blesh/contrib/airline/cyberpunk.bash | 43 + .local/share/blesh/contrib/airline/dark.bash | 30 + .../blesh/contrib/airline/dark_minimal.bash | 13 + .../blesh/contrib/airline/desertink.bash | 36 + .local/share/blesh/contrib/airline/deus.bash | 30 + .../blesh/contrib/airline/distinguished.bash | 32 + .../share/blesh/contrib/airline/durant.bash | 28 + .../blesh/contrib/airline/fairyfloss.bash | 27 + .../blesh/contrib/airline/fruit_punch.bash | 28 + .../blesh/contrib/airline/google_dark.bash | 28 + .../blesh/contrib/airline/google_light.bash | 28 + .../share/blesh/contrib/airline/hybrid.bash | 24 + .../blesh/contrib/airline/hybridline.bash | 29 + .../blesh/contrib/airline/jellybeans.bash | 26 + .local/share/blesh/contrib/airline/jet.bash | 24 + .../share/blesh/contrib/airline/kalisi.bash | 29 + .local/share/blesh/contrib/airline/kolor.bash | 27 + .../share/blesh/contrib/airline/laederon.bash | 43 + .../blesh/contrib/airline/landscape.bash | 34 + .../blesh/contrib/airline/lessnoise.bash | 41 + .local/share/blesh/contrib/airline/light.bash | 34 + .../blesh/contrib/airline/lighthaus.bash | 30 + .../share/blesh/contrib/airline/lucius.bash | 26 + .local/share/blesh/contrib/airline/luna.bash | 29 + .../blesh/contrib/airline/minimalist.bash | 28 + .../share/blesh/contrib/airline/molokai.bash | 24 + .../blesh/contrib/airline/monochrome.bash | 19 + .../share/blesh/contrib/airline/murmur.bash | 26 + .../blesh/contrib/airline/night_owl.bash | 27 + .../blesh/contrib/airline/nord_minimal.bash | 13 + .../share/blesh/contrib/airline/onedark.bash | 38 + .local/share/blesh/contrib/airline/ouo.bash | 37 + .local/share/blesh/contrib/airline/owo.bash | 26 + .../blesh/contrib/airline/papercolor.bash | 22 + .../share/blesh/contrib/airline/peaksea.bash | 30 + .../blesh/contrib/airline/powerlineish.bash | 34 + .local/share/blesh/contrib/airline/qwq.bash | 30 + .local/share/blesh/contrib/airline/raven.bash | 30 + .../blesh/contrib/airline/ravenpower.bash | 22 + .../share/blesh/contrib/airline/seagull.bash | 36 + .../blesh/contrib/airline/selenized.bash | 30 + .../blesh/contrib/airline/selenized_bw.bash | 30 + .../share/blesh/contrib/airline/seoul256.bash | 27 + .../share/blesh/contrib/airline/serene.bash | 24 + .../share/blesh/contrib/airline/sierra.bash | 30 + .../share/blesh/contrib/airline/silver.bash | 30 + .../share/blesh/contrib/airline/simple.bash | 24 + .local/share/blesh/contrib/airline/soda.bash | 24 + .local/share/blesh/contrib/airline/sol.bash | 32 + .../blesh/contrib/airline/solarized.bash | 31 + .../contrib/airline/solarized_flood.bash | 49 + .../blesh/contrib/airline/supernova.bash | 26 + .local/share/blesh/contrib/airline/term.bash | 38 + .../blesh/contrib/airline/term_light.bash | 38 + .../share/blesh/contrib/airline/tomorrow.bash | 27 + .../blesh/contrib/airline/transparent.bash | 31 + .../share/blesh/contrib/airline/ubaryd.bash | 43 + .../blesh/contrib/airline/understated.bash | 23 + .../share/blesh/contrib/airline/violet.bash | 21 + .../share/blesh/contrib/airline/wombat.bash | 40 + .../blesh/contrib/airline/xtermlight.bash | 29 + .../share/blesh/contrib/airline/zenburn.bash | 21 + .local/share/blesh/contrib/bash-preexec.bash | 180 + .../share/blesh/contrib/colorglass.base16.dat | 578 + .local/share/blesh/contrib/colorglass.bash | 610 + .../share/blesh/contrib/config/execmark.bash | 155 + .../github265-prompt-path-level-colors.bash | 31 + .../github288-filter-sabbrev-completion.bash | 54 + .../config/github296-named-execmark.bash | 21 + .../config/github302-perlre-server.bash | 76 + ...ithub481-elapsed-mark-without-command.bash | 30 + .../github483-elapsed-mark-on-error.bash | 31 + .../github499-append-to-last-modified.bash | 37 + .../share/blesh/contrib/config/readline.bash | 128 + .../share/blesh/contrib/fzf-completion.bash | 101 + .local/share/blesh/contrib/fzf-git.bash | 322 + .../share/blesh/contrib/fzf-initialize.bash | 11 + .../share/blesh/contrib/fzf-key-bindings.bash | 44 + .local/share/blesh/contrib/histdb.bash | 1607 + .../contrib/integration/bash-completion.bash | 334 + .../contrib/integration/bash-preexec.bash | 180 + .../contrib/integration/fzf-completion.bash | 101 + .../blesh/contrib/integration/fzf-git.bash | 322 + .../contrib/integration/fzf-initialize.bash | 11 + .../contrib/integration/fzf-key-bindings.bash | 44 + .../blesh/contrib/integration/fzf-menu.bash | 125 + .../blesh/contrib/integration/fzf.common.bash | 164 + .../contrib/integration/nix-completion.bash | 27 + .../contrib/integration/skim-completion.bash | 29 + .../contrib/integration/skim-initialize.bash | 4 + .../integration/skim-key-bindings.bash | 50 + .../blesh/contrib/integration/zoxide.bash | 60 + .local/share/blesh/contrib/layer/pattern.bash | 317 + .../contrib/layer/sample.RandomColor.bash | 35 + .../contrib/layer/sample.RandomColor2.bash | 34 + .../blesh/contrib/layer/sample.adapter.bash | 373 + .local/share/blesh/contrib/prompt-defer.bash | 150 + .../share/blesh/contrib/prompt-elapsed.bash | 91 + .local/share/blesh/contrib/prompt-git.bash | 348 + .../share/blesh/contrib/prompt-vim-mode.bash | 20 + .local/share/blesh/contrib/scheme/base16.bash | 53 + .../contrib/scheme/catppuccin_mocha.bash | 63 + .../share/blesh/contrib/scheme/default.bash | 25 + .../contrib/syntax/edit.named-command.bash | 106 + .local/share/blesh/licenses/LICENSE.md | 12 + .local/share/blesh/licenses/contrib/LICENSE | 28 + .local/share/doc/blesh/CONTRIBUTING.md | 348 + .local/share/doc/blesh/ChangeLog.md | 3347 ++ .local/share/doc/blesh/README-ja_JP.md | 882 + .local/share/doc/blesh/README.md | 938 + .local/share/doc/blesh/Release.md | 797 + .local/share/doc/blesh/contrib/README-ja.md | 97 + .local/share/doc/blesh/contrib/README.md | 39 + .local/share/doc/blesh/contrib/colorglass.md | 109 + .../doc/blesh/contrib/integration/fzf.md | 195 + .local/share/doc/blesh/contrib/prompt.md | 83 + 290 files changed, 49346 insertions(+) create mode 100644 .local/share/blesh/ble.sh create mode 100644 .local/share/blesh/contrib/airline/alduin.bash create mode 100644 .local/share/blesh/contrib/airline/angr.bash create mode 100644 .local/share/blesh/contrib/airline/apprentice.bash create mode 100644 .local/share/blesh/contrib/airline/atomic.bash create mode 100644 .local/share/blesh/contrib/airline/ayu_dark.bash create mode 100644 .local/share/blesh/contrib/airline/ayu_light.bash create mode 100644 .local/share/blesh/contrib/airline/ayu_mirage.bash create mode 100644 .local/share/blesh/contrib/airline/badwolf.bash create mode 100644 .local/share/blesh/contrib/airline/base16.bash create mode 100644 .local/share/blesh/contrib/airline/base16_3024.bash create mode 100644 .local/share/blesh/contrib/airline/base16_adwaita.bash create mode 100644 .local/share/blesh/contrib/airline/base16_apathy.bash create mode 100644 .local/share/blesh/contrib/airline/base16_ashes.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_cave.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_cave_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_dune.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_dune_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_estuary.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_estuary_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_forest.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_forest_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_heath.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_heath_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_lakeside.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_lakeside_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_plateau.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_plateau_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_savanna.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_savanna_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_seaside.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_seaside_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_sulphurpool.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelier_sulphurpool_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelierdune.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelierforest.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelierheath.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelierlakeside.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atelierseaside.bash create mode 100644 .local/share/blesh/contrib/airline/base16_atlas.bash create mode 100644 .local/share/blesh/contrib/airline/base16_bespin.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_bathory.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_burzum.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_dark_funeral.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_gorgoroth.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_immortal.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_khold.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_marduk.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_mayhem.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_nile.bash create mode 100644 .local/share/blesh/contrib/airline/base16_black_metal_venom.bash create mode 100644 .local/share/blesh/contrib/airline/base16_brewer.bash create mode 100644 .local/share/blesh/contrib/airline/base16_bright.bash create mode 100644 .local/share/blesh/contrib/airline/base16_brogrammer.bash create mode 100644 .local/share/blesh/contrib/airline/base16_brushtrees.bash create mode 100644 .local/share/blesh/contrib/airline/base16_brushtrees_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_chalk.bash create mode 100644 .local/share/blesh/contrib/airline/base16_circus.bash create mode 100644 .local/share/blesh/contrib/airline/base16_classic.bash create mode 100644 .local/share/blesh/contrib/airline/base16_classic_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_classic_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_codeschool.bash create mode 100644 .local/share/blesh/contrib/airline/base16_colors.bash create mode 100644 .local/share/blesh/contrib/airline/base16_cupcake.bash create mode 100644 .local/share/blesh/contrib/airline/base16_cupertino.bash create mode 100644 .local/share/blesh/contrib/airline/base16_darktooth.bash create mode 100644 .local/share/blesh/contrib/airline/base16_decaf.bash create mode 100644 .local/share/blesh/contrib/airline/base16_default.bash create mode 100644 .local/share/blesh/contrib/airline/base16_default_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_default_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_dracula.bash create mode 100644 .local/share/blesh/contrib/airline/base16_edge_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_edge_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_eighties.bash create mode 100644 .local/share/blesh/contrib/airline/base16_embers.bash create mode 100644 .local/share/blesh/contrib/airline/base16_espresso.bash create mode 100644 .local/share/blesh/contrib/airline/base16_flat.bash create mode 100644 .local/share/blesh/contrib/airline/base16_framer.bash create mode 100644 .local/share/blesh/contrib/airline/base16_fruit_soda.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gigavolt.bash create mode 100644 .local/share/blesh/contrib/airline/base16_github.bash create mode 100644 .local/share/blesh/contrib/airline/base16_google.bash create mode 100644 .local/share/blesh/contrib/airline/base16_google_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_google_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_grayscale.bash create mode 100644 .local/share/blesh/contrib/airline/base16_grayscale_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_grayscale_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_greenscreen.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_dark_hard.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_dark_medium.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_dark_pale.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_dark_soft.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_light_hard.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_light_medium.bash create mode 100644 .local/share/blesh/contrib/airline/base16_gruvbox_light_soft.bash create mode 100644 .local/share/blesh/contrib/airline/base16_harmonic16.bash create mode 100644 .local/share/blesh/contrib/airline/base16_harmonic_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_harmonic_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_heetch.bash create mode 100644 .local/share/blesh/contrib/airline/base16_heetch_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_helios.bash create mode 100644 .local/share/blesh/contrib/airline/base16_hopscotch.bash create mode 100644 .local/share/blesh/contrib/airline/base16_horizon_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_horizon_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_horizon_terminal_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_horizon_terminal_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_ia_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_ia_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_icy.bash create mode 100644 .local/share/blesh/contrib/airline/base16_irblack.bash create mode 100644 .local/share/blesh/contrib/airline/base16_isotope.bash create mode 100644 .local/share/blesh/contrib/airline/base16_londontube.bash create mode 100644 .local/share/blesh/contrib/airline/base16_macintosh.bash create mode 100644 .local/share/blesh/contrib/airline/base16_marrakesh.bash create mode 100644 .local/share/blesh/contrib/airline/base16_materia.bash create mode 100644 .local/share/blesh/contrib/airline/base16_material.bash create mode 100644 .local/share/blesh/contrib/airline/base16_material_darker.bash create mode 100644 .local/share/blesh/contrib/airline/base16_material_lighter.bash create mode 100644 .local/share/blesh/contrib/airline/base16_material_palenight.bash create mode 100644 .local/share/blesh/contrib/airline/base16_material_vivid.bash create mode 100644 .local/share/blesh/contrib/airline/base16_mellow_purple.bash create mode 100644 .local/share/blesh/contrib/airline/base16_mexico_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_mocha.bash create mode 100644 .local/share/blesh/contrib/airline/base16_monokai.bash create mode 100644 .local/share/blesh/contrib/airline/base16_nord.bash create mode 100644 .local/share/blesh/contrib/airline/base16_nova.bash create mode 100644 .local/share/blesh/contrib/airline/base16_ocean.bash create mode 100644 .local/share/blesh/contrib/airline/base16_oceanicnext.bash create mode 100644 .local/share/blesh/contrib/airline/base16_one_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_onedark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_outrun_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_papercolor_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_papercolor_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_paraiso.bash create mode 100644 .local/share/blesh/contrib/airline/base16_phd.bash create mode 100644 .local/share/blesh/contrib/airline/base16_pico.bash create mode 100644 .local/share/blesh/contrib/airline/base16_pop.bash create mode 100644 .local/share/blesh/contrib/airline/base16_porple.bash create mode 100644 .local/share/blesh/contrib/airline/base16_railscasts.bash create mode 100644 .local/share/blesh/contrib/airline/base16_rebecca.bash create mode 100644 .local/share/blesh/contrib/airline/base16_sandcastle.bash create mode 100644 .local/share/blesh/contrib/airline/base16_seti.bash create mode 100644 .local/share/blesh/contrib/airline/base16_shapeshifter.bash create mode 100644 .local/share/blesh/contrib/airline/base16_shell.bash create mode 100644 .local/share/blesh/contrib/airline/base16_snazzy.bash create mode 100644 .local/share/blesh/contrib/airline/base16_solarflare.bash create mode 100644 .local/share/blesh/contrib/airline/base16_solarized.bash create mode 100644 .local/share/blesh/contrib/airline/base16_solarized_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_solarized_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_spacemacs.bash create mode 100644 .local/share/blesh/contrib/airline/base16_summerfruit.bash create mode 100644 .local/share/blesh/contrib/airline/base16_summerfruit_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_summerfruit_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_synth_midnight_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_tomorrow.bash create mode 100644 .local/share/blesh/contrib/airline/base16_tomorrow_night.bash create mode 100644 .local/share/blesh/contrib/airline/base16_tomorrow_night_eighties.bash create mode 100644 .local/share/blesh/contrib/airline/base16_tube.bash create mode 100644 .local/share/blesh/contrib/airline/base16_twilight.bash create mode 100644 .local/share/blesh/contrib/airline/base16_unikitty_dark.bash create mode 100644 .local/share/blesh/contrib/airline/base16_unikitty_light.bash create mode 100644 .local/share/blesh/contrib/airline/base16_vim.bash create mode 100644 .local/share/blesh/contrib/airline/base16_woodland.bash create mode 100644 .local/share/blesh/contrib/airline/base16_xcode_dusk.bash create mode 100644 .local/share/blesh/contrib/airline/base16_zenburn.bash create mode 100644 .local/share/blesh/contrib/airline/base16color.bash create mode 100644 .local/share/blesh/contrib/airline/behelit.bash create mode 100644 .local/share/blesh/contrib/airline/biogoo.bash create mode 100644 .local/share/blesh/contrib/airline/blood_red.bash create mode 100644 .local/share/blesh/contrib/airline/bubblegum.bash create mode 100644 .local/share/blesh/contrib/airline/cobalt2.bash create mode 100644 .local/share/blesh/contrib/airline/cool.bash create mode 100644 .local/share/blesh/contrib/airline/cyberpunk.bash create mode 100644 .local/share/blesh/contrib/airline/dark.bash create mode 100644 .local/share/blesh/contrib/airline/dark_minimal.bash create mode 100644 .local/share/blesh/contrib/airline/desertink.bash create mode 100644 .local/share/blesh/contrib/airline/deus.bash create mode 100644 .local/share/blesh/contrib/airline/distinguished.bash create mode 100644 .local/share/blesh/contrib/airline/durant.bash create mode 100644 .local/share/blesh/contrib/airline/fairyfloss.bash create mode 100644 .local/share/blesh/contrib/airline/fruit_punch.bash create mode 100644 .local/share/blesh/contrib/airline/google_dark.bash create mode 100644 .local/share/blesh/contrib/airline/google_light.bash create mode 100644 .local/share/blesh/contrib/airline/hybrid.bash create mode 100644 .local/share/blesh/contrib/airline/hybridline.bash create mode 100644 .local/share/blesh/contrib/airline/jellybeans.bash create mode 100644 .local/share/blesh/contrib/airline/jet.bash create mode 100644 .local/share/blesh/contrib/airline/kalisi.bash create mode 100644 .local/share/blesh/contrib/airline/kolor.bash create mode 100644 .local/share/blesh/contrib/airline/laederon.bash create mode 100644 .local/share/blesh/contrib/airline/landscape.bash create mode 100644 .local/share/blesh/contrib/airline/lessnoise.bash create mode 100644 .local/share/blesh/contrib/airline/light.bash create mode 100644 .local/share/blesh/contrib/airline/lighthaus.bash create mode 100644 .local/share/blesh/contrib/airline/lucius.bash create mode 100644 .local/share/blesh/contrib/airline/luna.bash create mode 100644 .local/share/blesh/contrib/airline/minimalist.bash create mode 100644 .local/share/blesh/contrib/airline/molokai.bash create mode 100644 .local/share/blesh/contrib/airline/monochrome.bash create mode 100644 .local/share/blesh/contrib/airline/murmur.bash create mode 100644 .local/share/blesh/contrib/airline/night_owl.bash create mode 100644 .local/share/blesh/contrib/airline/nord_minimal.bash create mode 100644 .local/share/blesh/contrib/airline/onedark.bash create mode 100644 .local/share/blesh/contrib/airline/ouo.bash create mode 100644 .local/share/blesh/contrib/airline/owo.bash create mode 100644 .local/share/blesh/contrib/airline/papercolor.bash create mode 100644 .local/share/blesh/contrib/airline/peaksea.bash create mode 100644 .local/share/blesh/contrib/airline/powerlineish.bash create mode 100644 .local/share/blesh/contrib/airline/qwq.bash create mode 100644 .local/share/blesh/contrib/airline/raven.bash create mode 100644 .local/share/blesh/contrib/airline/ravenpower.bash create mode 100644 .local/share/blesh/contrib/airline/seagull.bash create mode 100644 .local/share/blesh/contrib/airline/selenized.bash create mode 100644 .local/share/blesh/contrib/airline/selenized_bw.bash create mode 100644 .local/share/blesh/contrib/airline/seoul256.bash create mode 100644 .local/share/blesh/contrib/airline/serene.bash create mode 100644 .local/share/blesh/contrib/airline/sierra.bash create mode 100644 .local/share/blesh/contrib/airline/silver.bash create mode 100644 .local/share/blesh/contrib/airline/simple.bash create mode 100644 .local/share/blesh/contrib/airline/soda.bash create mode 100644 .local/share/blesh/contrib/airline/sol.bash create mode 100644 .local/share/blesh/contrib/airline/solarized.bash create mode 100644 .local/share/blesh/contrib/airline/solarized_flood.bash create mode 100644 .local/share/blesh/contrib/airline/supernova.bash create mode 100644 .local/share/blesh/contrib/airline/term.bash create mode 100644 .local/share/blesh/contrib/airline/term_light.bash create mode 100644 .local/share/blesh/contrib/airline/tomorrow.bash create mode 100644 .local/share/blesh/contrib/airline/transparent.bash create mode 100644 .local/share/blesh/contrib/airline/ubaryd.bash create mode 100644 .local/share/blesh/contrib/airline/understated.bash create mode 100644 .local/share/blesh/contrib/airline/violet.bash create mode 100644 .local/share/blesh/contrib/airline/wombat.bash create mode 100644 .local/share/blesh/contrib/airline/xtermlight.bash create mode 100644 .local/share/blesh/contrib/airline/zenburn.bash create mode 100644 .local/share/blesh/contrib/bash-preexec.bash create mode 100644 .local/share/blesh/contrib/colorglass.base16.dat create mode 100644 .local/share/blesh/contrib/colorglass.bash create mode 100644 .local/share/blesh/contrib/config/execmark.bash create mode 100644 .local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash create mode 100644 .local/share/blesh/contrib/config/github288-filter-sabbrev-completion.bash create mode 100644 .local/share/blesh/contrib/config/github296-named-execmark.bash create mode 100644 .local/share/blesh/contrib/config/github302-perlre-server.bash create mode 100644 .local/share/blesh/contrib/config/github481-elapsed-mark-without-command.bash create mode 100644 .local/share/blesh/contrib/config/github483-elapsed-mark-on-error.bash create mode 100644 .local/share/blesh/contrib/config/github499-append-to-last-modified.bash create mode 100644 .local/share/blesh/contrib/config/readline.bash create mode 100644 .local/share/blesh/contrib/fzf-completion.bash create mode 100644 .local/share/blesh/contrib/fzf-git.bash create mode 100644 .local/share/blesh/contrib/fzf-initialize.bash create mode 100644 .local/share/blesh/contrib/fzf-key-bindings.bash create mode 100644 .local/share/blesh/contrib/histdb.bash create mode 100644 .local/share/blesh/contrib/integration/bash-completion.bash create mode 100644 .local/share/blesh/contrib/integration/bash-preexec.bash create mode 100644 .local/share/blesh/contrib/integration/fzf-completion.bash create mode 100644 .local/share/blesh/contrib/integration/fzf-git.bash create mode 100644 .local/share/blesh/contrib/integration/fzf-initialize.bash create mode 100644 .local/share/blesh/contrib/integration/fzf-key-bindings.bash create mode 100644 .local/share/blesh/contrib/integration/fzf-menu.bash create mode 100644 .local/share/blesh/contrib/integration/fzf.common.bash create mode 100644 .local/share/blesh/contrib/integration/nix-completion.bash create mode 100644 .local/share/blesh/contrib/integration/skim-completion.bash create mode 100644 .local/share/blesh/contrib/integration/skim-initialize.bash create mode 100644 .local/share/blesh/contrib/integration/skim-key-bindings.bash create mode 100644 .local/share/blesh/contrib/integration/zoxide.bash create mode 100644 .local/share/blesh/contrib/layer/pattern.bash create mode 100644 .local/share/blesh/contrib/layer/sample.RandomColor.bash create mode 100644 .local/share/blesh/contrib/layer/sample.RandomColor2.bash create mode 100644 .local/share/blesh/contrib/layer/sample.adapter.bash create mode 100644 .local/share/blesh/contrib/prompt-defer.bash create mode 100644 .local/share/blesh/contrib/prompt-elapsed.bash create mode 100644 .local/share/blesh/contrib/prompt-git.bash create mode 100644 .local/share/blesh/contrib/prompt-vim-mode.bash create mode 100644 .local/share/blesh/contrib/scheme/base16.bash create mode 100644 .local/share/blesh/contrib/scheme/catppuccin_mocha.bash create mode 100644 .local/share/blesh/contrib/scheme/default.bash create mode 100644 .local/share/blesh/contrib/syntax/edit.named-command.bash create mode 100644 .local/share/blesh/licenses/LICENSE.md create mode 100644 .local/share/blesh/licenses/contrib/LICENSE create mode 100644 .local/share/doc/blesh/CONTRIBUTING.md create mode 100644 .local/share/doc/blesh/ChangeLog.md create mode 100644 .local/share/doc/blesh/README-ja_JP.md create mode 100644 .local/share/doc/blesh/README.md create mode 100644 .local/share/doc/blesh/Release.md create mode 100644 .local/share/doc/blesh/contrib/README-ja.md create mode 100644 .local/share/doc/blesh/contrib/README.md create mode 100644 .local/share/doc/blesh/contrib/colorglass.md create mode 100644 .local/share/doc/blesh/contrib/integration/fzf.md create mode 100644 .local/share/doc/blesh/contrib/prompt.md diff --git a/.bash_aliases b/.bash_aliases index dbaae94..adf46c4 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -111,3 +111,4 @@ HISTCONTROL=ignoredups:erasedups # When the shell exits, append to the history file instead of overwriting it. shopt -s histappend +source -- ~/.local/share/blesh/ble.sh diff --git a/.local/share/blesh/ble.sh b/.local/share/blesh/ble.sh new file mode 100644 index 0000000..c432f0d --- /dev/null +++ b/.local/share/blesh/ble.sh @@ -0,0 +1,29231 @@ +# Copyright 2015 Koichi Murase . All rights reserved. +# This script is a part of blesh (https://github.com/akinomyoga/ble.sh) +# provided under the BSD-3-Clause license. Do not edit this file because this +# is not the original source code: Various pre-processing has been applied. +# Also, the code comments and blank lines are stripped off in the installation +# process. Please find the corresponding source file(s) in the repository +# "akinomyoga/ble.sh". +# +# Source: /ble.pp +# Source: /src/def.sh +# Source: /src/util.sh +# Source: /src/util.hook.sh +# Source: /src/benchmark.sh +# Source: /src/decode.sh +# Source: /src/color.sh +# Source: /src/canvas.sh +# Source: /src/canvas.c2w.sh +# Source: /src/canvas.emoji.sh +# Source: /src/canvas.c2w.musl.sh +# Source: /src/canvas.GraphemeClusterBreak.sh +# Source: /src/history.sh +# Source: /src/edit.sh +# Source: /lib/core-cmdspec-def.sh +# Source: /lib/core-syntax-def.sh +# Source: /lib/core-complete-def.sh +# Source: /lib/core-debug-def.sh +# Source: /contrib/integration/bash-preexec-def.sh +{ + _ble_init_version=0.4.0-devel4+32bb63d + _ble_init_exit= + _ble_init_command= + _ble_init_skip= + for _ble_init_arg; do + if [ -n "$_ble_init_skip" ]; then + _ble_init_skip= + continue + fi + case $_ble_init_arg in + --version) + _ble_init_exit=0 + echo "ble.sh (Bash Line Editor), version $_ble_init_version" ;; + --help) + _ble_init_exit=0 + printf '%s\n' \ + "# ble.sh (Bash Line Editor), version $_ble_init_version" \ + 'usage: source ble.sh [OPTION...]' \ + '' \ + 'OPTION' \ + '' \ + ' --help' \ + ' Show this help and exit' \ + ' --version' \ + ' Show version and exit' \ + ' --clear-cache' \ + ' Clear ble.sh cache and exit' \ + ' --install PREFIX' \ + ' Install ble.sh and exit' \ + ' --lib' \ + ' Only load ble.sh and do nothing else' \ + ' --test' \ + ' Run test and exit' \ + ' --update' \ + ' Update ble.sh and exit' \ + '' \ + ' --rcfile=BLERC' \ + ' --init-file=BLERC' \ + ' Specify the ble init file. The default is ~/.blerc if any, or' \ + ' ~/.config/blesh/init.sh.' \ + '' \ + ' --norc' \ + ' Do not load the ble init file.' \ + '' \ + ' --attach=ATTACH' \ + ' --noattach' \ + ' The option "--attach" selects the strategy of "ble-attach" from the list:' \ + ' ATTACH = "attach" | "prompt" | "none". The default strategy is "prompt".' \ + ' When "attach" is specified, ble.sh immediately attaches to the session in' \ + ' "source ble.sh". When "prompt" is specified, ble.sh attaches to the' \ + ' session before the first prompt using PROMPT_COMMAND. When "none" is' \ + ' specified, ble.sh does not attach to the session automatically, so' \ + ' ble-attach needs to be called explicitly. The option "--noattach" is a' \ + ' synonym for "--attach=none".' \ + '' \ + ' --inputrc=TYPE' \ + ' --noinputrc' \ + ' The option "--inputrc" selects the strategy of reconstructing user' \ + ' keybindings from the list: "auto" (default), "diff", "all", "user", "none".' \ + ' When "diff" is specified, user keybindings are extracted by the diff of the' \ + ' outputs of the "bind" builtin between the current session and the plain' \ + ' Bash. When "all" is specified, the user keybindings are extracted from' \ + ' /etc/inputrc and ${INPUTRC:-~/.inputrc*}. When "user" is specified, the' \ + ' user keybindings are extracted from ${INPUTRC:-~/.inputrc*}. When "none"' \ + ' is specified, the user keybindings are not reconstructed from the state of' \ + ' Readline, and only the bindings by "ble-bind" are applied. The option' \ + ' "--noinputrc" is a synonym for "--inputrc=none".' \ + '' \ + ' --keep-rlvars' \ + ' Do not change readline settings for ble.sh' \ + '' \ + ' --bash-debug-version=TYPE' \ + ' This controls the warning mesage for the debug version of Bash. When' \ + ' "full" is specified to TYPE, ble.sh prints the full message to the terminal' \ + ' when it is loaded in a debug version of Bash. This is the default. When' \ + ' "short" is specified, a short version of the message is printed. When' \ + ' "once" is specified, the full message is printed only once for a specific' \ + ' version of debug Bash. When "ignore" is specified, the message is not' \ + ' printed even when ble.sh is loaded in a debug version of Bash.' \ + '' \ + ' -o BLEOPT=VALUE' \ + ' Set a value for the specified bleopt option.' \ + ' --debug-bash-output' \ + ' Internal settings for debugging' \ + '' ;; + --test | --update | --clear-cache | --lib | --install) _ble_init_command=1 ;; + -o | --attach | --inputrc | --rcfile | --init-file | --bash-debug-version) _ble_init_skip=1 ;; + -o* | --attach=* | --inputrc=* | --rcfile=* | --init-file=* | --bash-debug-version=*) ;; + noattach | --noattach | --noinputrc | --norc | --keep-rlvars | --debug-bash-output) ;; + -*) _ble_init_command=error ;; + esac + done + unset _ble_init_skip + unset _ble_init_arg + if [ -n "$_ble_init_exit" ]; then + unset _ble_init_exit + unset _ble_init_command + unset _ble_init_version + return 0 2>/dev/null || exit 0 + fi +} 2>/dev/null # set -x 対策 #D0930 +if [ -z "${BASH_VERSION-}" ]; then + echo "ble.sh: This shell is not Bash. Please use this script with Bash." >&3 + unset _ble_init_exit + unset _ble_init_command + unset _ble_init_version + return 1 2>/dev/null || exit 1 +fi 3>&2 >/dev/null 2>&1 # set -x 対策 #D0930 +if [ -z "${BASH_VERSINFO-}" ] || [ "${BASH_VERSINFO-0}" -lt 3 ]; then + echo "ble.sh: Bash with a version under 3.0 is not supported." >&3 + unset -v _ble_init_exit _ble_init_command _ble_init_version + return 1 2>/dev/null || exit 1 +fi 3>&2 >/dev/null 2>&1 # set -x 対策 #D0930 +if [[ ! $_ble_init_command ]]; then + if [[ ${BASH_EXECUTION_STRING+set} ]]; then + _ble_init_exit=1 + elif ((BASH_SUBSHELL)); then + builtin echo "ble.sh: ble.sh cannot be loaded into a subshell." >&3 + _ble_init_exit=1 + elif [[ $- != *i* ]]; then + case " ${BASH_SOURCE[*]##*/} " in + (*' .bashrc '* | *' .bash_profile '* | *' .profile '* | *' bashrc '* | *' profile '*) ((0)) ;; + esac && + builtin echo "ble.sh: This is not an interactive session." >&3 || ((1)) + _ble_init_exit=1 + elif ! [[ -t 4 && -t 5 ]] && + ! [[ :${bleopt_connect_tty-}: == *:inherit:* && -t ${_ble_util_fd_tty_stdin:-} && -t ${_ble_util_fd_tty_stdout:-} ]] 2>/dev/null && + ! { [[ ${bleopt_connect_tty-} ]] && >/dev/tty; } + then + if [[ ${bleopt_connect_tty-} ]]; then + builtin echo "ble.sh: cannot find a controlling TTY/PTY in this session." >&3 + else + builtin echo "ble.sh: stdout/stdin are not connected to TTY/PTY." >&3 + fi + _ble_init_exit=1 + elif [[ ${NRF_CONNECT_VSCODE-} && ! -t 3 ]]; then + _ble_init_exit=1 + fi + if [[ $_ble_init_exit ]]; then + builtin unset -v _ble_init_exit _ble_init_command _ble_init_version + return 1 2>/dev/null || builtin exit 1 + fi +fi 3>&2 4<&0 5>&1 &>/dev/null # set -x 対策 #D0930 +{ + _ble_bash=$((BASH_VERSINFO[0]*10000+BASH_VERSINFO[1]*100+BASH_VERSINFO[2])) + _ble_bash_POSIXLY_CORRECT_adjusted=1 + _ble_bash_POSIXLY_CORRECT_set=${POSIXLY_CORRECT+set} + _ble_bash_POSIXLY_CORRECT=${POSIXLY_CORRECT-} + POSIXLY_CORRECT=y + _ble_bash_expand_aliases= + \shopt -q expand_aliases && + _ble_bash_expand_aliases=1 && + \shopt -u expand_aliases || ((1)) + _ble_bash_FUNCNEST_adjusted= + _ble_bash_FUNCNEST= + _ble_bash_FUNCNEST_set= + _ble_bash_FUNCNEST_adjust=' + if [[ ! $_ble_bash_FUNCNEST_adjusted ]]; then + _ble_bash_FUNCNEST_adjusted=1 + _ble_bash_FUNCNEST_set=${FUNCNEST+set} + _ble_bash_FUNCNEST=${FUNCNEST-} + \builtin unset -v FUNCNEST + fi 2>/dev/null' + _ble_bash_FUNCNEST_restore=' + if [[ $_ble_bash_FUNCNEST_adjusted ]]; then + _ble_bash_FUNCNEST_adjusted= + if [[ $_ble_bash_FUNCNEST_set ]]; then + FUNCNEST=$_ble_bash_FUNCNEST + else + \builtin unset -v FUNCNEST + fi + fi 2>/dev/null' + _ble_bash_FUNCNEST_local_adjust=' + \local _ble_local_FUNCNEST _ble_local_FUNCNEST_set + _ble_local_FUNCNEST_set=${FUNCNEST+set} + _ble_local_FUNCNEST=${FUNCNEST-} + if [[ $_ble_local_FUNCNEST_set ]]; then + \local FUNCNEST + \builtin unset -v FUNCNEST + fi' + _ble_bash_FUNCNEST_local_leave=' + if [[ $_ble_local_FUNCNEST_set ]]; then + FUNCNEST=$_ble_local_FUNCNEST + fi' + \builtin eval -- "$_ble_bash_FUNCNEST_adjust" + \builtin unset -v POSIXLY_CORRECT + _ble_bash_POSIXLY_CORRECT_adjust=' + if [[ ! ${_ble_bash_POSIXLY_CORRECT_adjusted-} ]]; then + _ble_bash_POSIXLY_CORRECT_adjusted=1 + _ble_bash_POSIXLY_CORRECT_set=${POSIXLY_CORRECT+set} + _ble_bash_POSIXLY_CORRECT=${POSIXLY_CORRECT-} + if [[ $_ble_bash_POSIXLY_CORRECT_set ]]; then + \builtin unset -v POSIXLY_CORRECT + fi + ble/base/workaround-POSIXLY_CORRECT + fi' + _ble_bash_POSIXLY_CORRECT_unset=' + if [[ ${POSIXLY_CORRECT+set} ]]; then + \builtin unset -v POSIXLY_CORRECT + ble/base/workaround-POSIXLY_CORRECT + fi' + _ble_bash_POSIXLY_CORRECT_local_adjust=' + \builtin local _ble_local_POSIXLY_CORRECT _ble_local_POSIXLY_CORRECT_set + _ble_local_POSIXLY_CORRECT_set=${POSIXLY_CORRECT+set} + _ble_local_POSIXLY_CORRECT=${POSIXLY_CORRECT-} + '$_ble_bash_POSIXLY_CORRECT_unset + _ble_bash_POSIXLY_CORRECT_local_leave=' + if [[ $_ble_local_POSIXLY_CORRECT_set ]]; then + POSIXLY_CORRECT=$_ble_local_POSIXLY_CORRECT + fi' + _ble_bash_POSIXLY_CORRECT_local_enter=' + _ble_local_POSIXLY_CORRECT_set=${POSIXLY_CORRECT+set} + _ble_local_POSIXLY_CORRECT=${POSIXLY_CORRECT-} + '$_ble_bash_POSIXLY_CORRECT_unset + _ble_bash_POSIXLY_CORRECT_local_return=' + \builtin local _ble_local_POSIXLY_CORRECT_ext=$? + if [[ $_ble_local_POSIXLY_CORRECT_set ]]; then + POSIXLY_CORRECT=$_ble_local_POSIXLY_CORRECT + fi + \return "$_ble_local_POSIXLY_CORRECT_ext"' +} 2>/dev/null +function ble/base/workaround-POSIXLY_CORRECT { + true +} +function ble/base/restore-POSIXLY_CORRECT { + if [[ ! $_ble_bash_POSIXLY_CORRECT_adjusted ]]; then return 0; fi # Note: set -e の為 || は駄目 + _ble_bash_POSIXLY_CORRECT_adjusted= + if [[ $_ble_bash_POSIXLY_CORRECT_set ]]; then + POSIXLY_CORRECT=$_ble_bash_POSIXLY_CORRECT + else + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_unset" + fi +} +function ble/base/is-POSIXLY_CORRECT { + [[ $_ble_bash_POSIXLY_CORRECT_adjusted && $_ble_bash_POSIXLY_CORRECT_set ]] +} +function ble/variable#load-user-state/variable:FUNCNEST { + if [[ $_ble_bash_FUNCNEST_adjusted ]]; then + __ble_var_set=$_ble_bash_FUNCNEST_set + __ble_var_val=$_ble_bash_FUNCNEST + return 0 + elif [[ ${_ble_local_FUNCNEST_set-} ]]; then + __ble_var_set=$_ble_local_FUNCNEST_set + __ble_var_set=$_ble_local_FUNCNEST + return 0 + else + return 1 + fi +} +function ble/variable#load-user-state/variable:POSIXLY_CORRECT { + if [[ $_ble_bash_POSIXLY_CORRECT_adjusted ]]; then + __ble_var_set=$_ble_bash_POSIXLY_CORRECT_set + __ble_var_val=$_ble_bash_POSIXLY_CORRECT + return 0 + elif [[ ${_ble_local_POSIXLY_CORRECT_set-} ]]; then + __ble_var_set=$_ble_local_POSIXLY_CORRECT_set + __ble_var_set=$_ble_local_POSIXLY_CORRECT + return 0 + else + return 1 + fi +} +if ((_ble_bash>=40100)); then + function ble/base/list-shopt { shopt=$BASHOPTS; } +else + function ble/base/list-shopt { + shopt= + local name + for name; do + shopt -q "$name" 2>/dev/null && shopt=$shopt:$name + done + } +fi 2>/dev/null # set -x 対策 +function ble/base/evaldef { + local shopt + ble/base/list-shopt extglob expand_aliases + shopt -s extglob + shopt -u expand_aliases + builtin eval -- "$1"; local ext=$? + [[ :$shopt: == *:extglob:* ]] || shopt -u extglob + [[ :$shopt: != *:expand_aliases:* ]] || shopt -s expand_aliases + return "$ext" +} +if ((_ble_bash>=50300)); then + function ble/util/assign { builtin eval -- "$1=\${ builtin eval -- \"\$2\"; }"; } +else + function ble/util/assign { builtin eval -- "$1=\$(builtin eval -- \"\$2\")"; } +fi +{ + _ble_bash_builtins_adjusted= + _ble_bash_builtins_save= +} 2>/dev/null # set -x 対策 +function ble/base/adjust-builtin-wrappers/.impl1 { + unset -f builtin + builtin local builtins1 keywords1 + builtins1=(builtin unset enable unalias return break continue declare local typeset eval exec set) + keywords1=(if then elif else case esac while until for select do done '{' '}' '[[' function) + if [[ ! $_ble_bash_builtins_adjusted ]]; then + _ble_bash_builtins_adjusted=1 + builtin local defs + ble/util/assign defs ' + \builtin declare -f "${builtins1[@]}" || ((1)) + \builtin alias "${builtins1[@]}" "${keywords1[@]}" || ((1))' # set -e 対策 + _ble_bash_builtins_save=$defs + fi + builtin local POSIXLY_CORRECT=y + builtin unset -f "${builtins1[@]}" + builtin unalias "${builtins1[@]}" "${keywords1[@]}" || ((1)) # set -e 対策 + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_unset" +} +function ble/base/adjust-builtin-wrappers/.impl2 { + local defs + ble/util/assign defs 'LC_ALL= LC_MESSAGES=C builtin type :; alias :' || ((1)) # set -e 対策 + defs=${defs#$': is a shell builtin\n'} + _ble_bash_builtins_save=$_ble_bash_builtins_save$'\n'$defs + builtin unset -f : + builtin unalias : || ((1)) # set -e 対策 +} +function ble/base/adjust-builtin-wrappers { + ble/base/adjust-builtin-wrappers/.impl1 + builtin unset -v POSIXLY_CORRECT + ble/base/adjust-builtin-wrappers/.impl2 +} 2>/dev/null +function ble/base/restore-builtin-wrappers { + if [[ $_ble_bash_builtins_adjusted ]]; then + _ble_bash_builtins_adjusted= + ble/base/evaldef "$_ble_bash_builtins_save" + return 0 + fi +} +{ + ble/base/adjust-builtin-wrappers + if [[ $_ble_bash_expand_aliases ]]; then + shopt -s expand_aliases + fi +} 2>/dev/null # set -x 対策 +function ble/variable#copy-state { + local src=$1 dst=$2 + if [[ ${!src+set} ]]; then + builtin eval -- "$dst=\${$src}" + else + builtin unset -v "$dst[0]" 2>/dev/null || builtin unset -v "$dst" + fi +} +{ + _ble_bash_xtrace=() + _ble_bash_xtrace_debug_enabled= + _ble_bash_xtrace_debug_filename= + _ble_bash_xtrace_debug_fd= + _ble_bash_XTRACEFD= + _ble_bash_XTRACEFD_set= + _ble_bash_XTRACEFD_dup= + _ble_bash_PS4= +} 2>/dev/null # set -x 対策 +function ble/base/xtrace/.fdcheck { >&"$1"; } 2>/dev/null +function ble/base/xtrace/.fdnext { + local _ble_local_init=${_ble_util_openat_nextfd:=${bleopt_openat_base:-30}} + for (($1=_ble_local_init;$1<_ble_local_init+1024;$1++)); do + ble/base/xtrace/.fdcheck "${!1}" || break + done + (($1<_ble_local_init+1024)) || + { (($1=_ble_local_init,_ble_util_openat_nextfd++)); builtin eval "exec ${!1}>&-"; } || + ((1)) +} +function ble/base/xtrace/.log { + local open=---- close=---- + if ((_ble_bash>=40200)); then + builtin printf '%s [%(%F %T %Z)T] %s %s\n' "$open" -1 "$1" "$close" + else + local date + ble/util/assign date 'date 2>/dev/null' + builtin printf '%s [%s] %s %s\n' "$open" "$date" "$1" "$close" + fi >&"${BASH_XTRACEFD:-2}" +} +function ble/base/xtrace/adjust { + local level=${#_ble_bash_xtrace[@]} IFS=$' \t\n' + if [[ $- == *x* ]]; then + _ble_bash_xtrace[level]=1 + else + _ble_bash_xtrace[level]= + fi + set +x + ((_ble_bash>=40000&&level==0)) || return 0 + _ble_bash_xtrace_debug_enabled= + if [[ ${bleopt_debug_xtrace:-/dev/null} == /dev/null ]]; then + if [[ $_ble_bash_xtrace_debug_fd ]]; then + builtin eval "exec $_ble_bash_xtrace_debug_fd>&-" || return 0 # disable=#D2164 (here bash4+) + _ble_bash_xtrace_debug_filename= + _ble_bash_xtrace_debug_fd= + fi + else + if [[ $_ble_bash_xtrace_debug_filename != "$bleopt_debug_xtrace" ]]; then + _ble_bash_xtrace_debug_filename=$bleopt_debug_xtrace + [[ $_ble_bash_xtrace_debug_fd ]] || ble/base/xtrace/.fdnext _ble_bash_xtrace_debug_fd + builtin eval "exec $_ble_bash_xtrace_debug_fd>>\"$bleopt_debug_xtrace\"" || return 0 + fi + _ble_bash_XTRACEFD=${BASH_XTRACEFD-} + _ble_bash_XTRACEFD_set=${BASH_XTRACEFD+set} + if [[ ${BASH_XTRACEFD-} =~ ^[0-9]+$ ]] && ble/base/xtrace/.fdcheck "$BASH_XTRACEFD"; then + ble/base/xtrace/.fdnext _ble_bash_XTRACEFD_dup + builtin eval "exec $_ble_bash_XTRACEFD_dup>&$BASH_XTRACEFD" || return 0 + builtin eval "exec $BASH_XTRACEFD>&$_ble_bash_xtrace_debug_fd" || return 0 + else + _ble_bash_XTRACEFD_dup= + local newfd; ble/base/xtrace/.fdnext newfd + builtin eval "exec $newfd>&$_ble_bash_xtrace_debug_fd" || return 0 + BASH_XTRACEFD=$newfd + fi + ble/variable#copy-state PS4 _ble_base_PS4 + PS4=${bleopt_debug_xtrace_ps4:-'+ '} + _ble_bash_xtrace_debug_enabled=1 + ble/base/xtrace/.log "$FUNCNAME" + set -x + fi +} +function ble/base/xtrace/restore { + local level=$((${#_ble_bash_xtrace[@]}-1)) IFS=$' \t\n' + ((level>=0)) || return 0 + if [[ ${_ble_bash_xtrace[level]-} ]]; then + set -x + else + set +x + fi + builtin unset -v '_ble_bash_xtrace[level]' + ((_ble_bash>=40000&&level==0)) || return 0 + if [[ $_ble_bash_xtrace_debug_enabled ]]; then + ble/base/xtrace/.log "$FUNCNAME" + _ble_bash_xtrace_debug_enabled= + ble/variable#copy-state _ble_base_PS4 PS4 + if [[ $_ble_bash_XTRACEFD_dup ]]; then + builtin eval "exec $BASH_XTRACEFD>&$_ble_bash_XTRACEFD_dup" && + builtin eval "exec $_ble_bash_XTRACEFD_dup>&-" || ((1)) # disable=#D2164 (here bash4+) + else + if [[ $_ble_bash_XTRACEFD_set ]]; then + BASH_XTRACEFD=$_ble_bash_XTRACEFD + else + builtin unset -v BASH_XTRACEFD + fi + fi + fi +} +function ble/base/.adjust-bash-options { + builtin eval -- "$1=\$-" + set +evukT -B + ble/base/xtrace/adjust + [[ $2 == shopt ]] || local shopt + ble/base/list-shopt extdebug nocasematch + [[ $2 == shopt ]] || builtin eval -- "$2=\$shopt" + shopt -u extdebug + shopt -u nocasematch 2>/dev/null + return 0 +} 2>/dev/null # set -x 対策 +function ble/base/.restore-bash-options { + local set=${!1} shopt=${!2} + [[ :$shopt: == *:nocasematch:* ]] && shopt -s nocasematch + [[ :$shopt: == *:extdebug:* ]] && shopt -s extdebug + ble/base/xtrace/restore + [[ $set == *B* ]] || set +B + [[ $set == *T* ]] && set -T + [[ $set == *k* ]] && set -k + [[ $set == *u* ]] && set -u + [[ $set == *v* ]] && set -v + [[ $set == *e* ]] && set -e # set -e は最後 + return 0 +} 2>/dev/null # set -x 対策 +{ + : "${_ble_bash_options_adjusted=}" + _ble_bash_set=$- + _ble_bash_shopt=${BASHOPTS-} +} 2>/dev/null # set -x 対策 +function ble/base/adjust-bash-options { + [[ $_ble_bash_options_adjusted ]] && return 1 || ((1)) # set -e 対策 + _ble_bash_options_adjusted=1 + ble/base/.adjust-bash-options _ble_bash_set _ble_bash_shopt + _ble_bash_expand_aliases= + shopt -q expand_aliases 2>/dev/null && + _ble_bash_expand_aliases=1 + ble/variable#copy-state LC_ALL _ble_bash_LC_ALL + if [[ ${LC_ALL-} ]]; then + ble/variable#copy-state LC_CTYPE _ble_bash_LC_CTYPE + ble/variable#copy-state LC_MESSAGES _ble_bash_LC_MESSAGES + ble/variable#copy-state LC_NUMERIC _ble_bash_LC_NUMERIC + ble/variable#copy-state LC_TIME _ble_bash_LC_TIME + ble/variable#copy-state LANG _ble_bash_LANG + [[ ${LC_CTYPE-} ]] && LC_CTYPE=$LC_ALL + [[ ${LC_MESSAGES-} ]] && LC_MESSAGES=$LC_ALL + [[ ${LC_NUMERIC-} ]] && LC_NUMERIC=$LC_ALL + [[ ${LC_TIME-} ]] && LC_TIME=$LC_ALL + LANG=$LC_ALL + LC_ALL= + fi + ble/variable#copy-state LC_COLLATE _ble_bash_LC_COLLATE + LC_COLLATE=C + if local TMOUT= 2>/dev/null; then # #D1630 WA + _ble_bash_tmout_wa=() + else + _ble_bash_tmout_wa=(-t 2147483647) + fi +} 2>/dev/null # set -x 対策 #D0930 / locale 変更 +function ble/base/restore-bash-options { + [[ $_ble_bash_options_adjusted ]] || return 1 + _ble_bash_options_adjusted= + ble/variable#copy-state _ble_bash_LC_COLLATE LC_COLLATE + if [[ $_ble_bash_LC_ALL ]]; then + ble/variable#copy-state _ble_bash_LC_CTYPE LC_CTYPE + ble/variable#copy-state _ble_bash_LC_MESSAGES LC_MESSAGES + ble/variable#copy-state _ble_bash_LC_NUMERIC LC_NUMERIC + ble/variable#copy-state _ble_bash_LC_TIME LC_TIME + ble/variable#copy-state _ble_bash_LANG LANG + fi + ble/variable#copy-state _ble_bash_LC_ALL LC_ALL + [[ $_ble_bash_nocasematch ]] && shopt -s nocasematch + ble/base/.restore-bash-options _ble_bash_set _ble_bash_shopt +} 2>/dev/null # set -x 対策 #D0930 / locale 変更 +function ble/base/recover-bash-options { + if [[ $_ble_bash_expand_aliases ]]; then + shopt -s expand_aliases + else + shopt -u expand_aliases + fi +} +function ble/variable#load-user-state/variable:LC_ALL/.impl { + local __ble_save=_ble_bash_$1 + __ble_var_set=${!__ble_save+set} + __ble_var_val=${!__ble_save-} + [[ $__ble_var_set ]] && ble/variable#get-attr -v __ble_var_att "$1" + return 0 +} +function ble/variable#load-user-state/variable:LC_COLLATE { + ble/variable#load-user-state/variable:LC_ALL/.impl LC_COLLATE +} +function ble/variable#load-user-state/variable:LC_ALL { + ble/variable#load-user-state/variable:LC_ALL/.impl LC_ALL +} +function ble/variable#load-user-state/variable:LC_CTYPE { + [[ $_ble_bash_LC_ALL ]] && ble/variable#load-user-state/variable:LC_ALL/.impl LC_CTYPE +} +function ble/variable#load-user-state/variable:LC_MESSAGES { + [[ $_ble_bash_LC_ALL ]] && ble/variable#load-user-state/variable:LC_ALL/.impl LC_MESSAGES +} +function ble/variable#load-user-state/variable:LC_NUMERIC { + [[ $_ble_bash_LC_ALL ]] && ble/variable#load-user-state/variable:LC_ALL/.impl LC_NUMERIC +} +function ble/variable#load-user-state/variable:LC_TIME { + [[ $_ble_bash_LC_ALL ]] && ble/variable#load-user-state/variable:LC_ALL/.impl LC_TIME +} +function ble/variable#load-user-state/variable:LANG { + [[ $_ble_bash_LC_ALL ]] && ble/variable#load-user-state/variable:LC_ALL/.impl LANG +} +{ ble/base/adjust-bash-options; } &>/dev/null # set -x 対策 #D0930 +function ble/init/force-load-inputrc { + builtin unset -f "$FUNCNAME" + builtin bind &>/dev/null # force to load .inputrc + if [[ $OSTYPE == msys* ]]; then + local bind_emacs + ble/util/assign bind_emacs 'builtin bind -m emacs -p 2>/dev/null' + [[ $'\n'$bind_emacs$'\n' == *$'\n"\\C-?": backward-kill-line\n' ]] && + builtin bind -m emacs '"\C-?": backward-delete-char' 2>/dev/null + fi +} +ble/init/force-load-inputrc +if [[ ! -o emacs && ! -o vi && ! $_ble_init_command ]]; then + builtin echo "ble.sh: ble.sh is not intended to be used with the line-editing mode disabled (--noediting)." >&2 + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" + builtin unset -v _ble_bash + return 1 2>/dev/null || builtin exit 1 +fi +if shopt -q restricted_shell; then + builtin echo "ble.sh: ble.sh is not intended to be used in restricted shells (--restricted)." >&2 + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" + builtin unset -v _ble_bash + return 1 2>/dev/null || builtin exit 1 +fi +function ble/init/adjust-IFS { + _ble_init_original_IFS_set=${IFS+set} + _ble_init_original_IFS=$IFS + IFS=$' \t\n' +} +function ble/init/restore-IFS { + if [[ $_ble_init_original_IFS_set ]]; then + IFS=$_ble_init_original_IFS + else + builtin unset -v IFS + fi + builtin unset -v _ble_init_original_IFS_set + builtin unset -v _ble_init_original_IFS +} +function ble/variable#load-user-state/variable:IFS { + __ble_var_set=${_ble_init_original_IFS_set-} + __ble_var_val=${_ble_init_original_IFS-} + ble/variable#get-attr -v __ble_var_att IFS + return 0 +} +if ((_ble_bash>=50100)); then + _ble_bash_BASH_REMATCH_level=0 + _ble_bash_BASH_REMATCH=() + function ble/base/adjust-BASH_REMATCH { + ((_ble_bash_BASH_REMATCH_level++==0)) || return 0 + _ble_bash_BASH_REMATCH=("${BASH_REMATCH[@]}") + } + function ble/base/restore-BASH_REMATCH { + ((_ble_bash_BASH_REMATCH_level>0&& + --_ble_bash_BASH_REMATCH_level==0)) || return 0 + BASH_REMATCH=("${_ble_bash_BASH_REMATCH[@]}") + } +else + _ble_bash_BASH_REMATCH_level=0 + _ble_bash_BASH_REMATCH=() + _ble_bash_BASH_REMATCH_rex=none + function ble/base/adjust-BASH_REMATCH/increase { + local delta=$1 + ((delta)) || return 1 + ((i+=delta)) + if ((delta==1)); then + rex=$rex. + else + rex=$rex.{$delta} + fi + } + function ble/base/adjust-BASH_REMATCH/is-updated { + local i n=${#_ble_bash_BASH_REMATCH[@]} + ((n!=${#BASH_REMATCH[@]})) && return 0 + for ((i=0;i=0)) + } + function ble/base/adjust-BASH_REMATCH { + ((_ble_bash_BASH_REMATCH_level++==0)) || return 0 + ble/base/adjust-BASH_REMATCH/is-updated || return 1 + local size=${#BASH_REMATCH[@]} + if ((size==0)); then + _ble_bash_BASH_REMATCH=() + _ble_bash_BASH_REMATCH_rex=none + return 0 + fi + local rex= i=0 + local text=$BASH_REMATCH sub ret isub + local -a rparens=() + local isub rex i=0 count=0 + for ((isub=1;isub=1)); do + local end=${rparens[count-1]} + if ble/base/adjust-BASH_REMATCH/.find-substr "${text:i:end-i}" "$sub"; then + ble/base/adjust-BASH_REMATCH/increase "$ret" + ((rparens[count++]=i+${#sub})) + rex=$rex'(' + break + else + ble/base/adjust-BASH_REMATCH/increase "$((end-i))" + rex=$rex')' + builtin unset -v 'rparens[--count]' + fi + done + ((count>0)) && continue + if ble/base/adjust-BASH_REMATCH/.find-substr "${text:i}" "$sub"; then + ble/base/adjust-BASH_REMATCH/increase "$ret" + ((rparens[count++]=i+${#sub})) + rex=$rex'(' + else + break # 復元失敗 + fi + done + while ((count>=1)); do + local end=${rparens[count-1]} + ble/base/adjust-BASH_REMATCH/increase "$((end-i))" + rex=$rex')' + builtin unset -v 'rparens[--count]' + done + ble/base/adjust-BASH_REMATCH/increase "$((${#text}-i))" + _ble_bash_BASH_REMATCH=("${BASH_REMATCH[@]}") + _ble_bash_BASH_REMATCH_rex=$rex + } + function ble/base/restore-BASH_REMATCH { + ((_ble_bash_BASH_REMATCH_level>0&& + --_ble_bash_BASH_REMATCH_level==0)) || return 0 + [[ ${_ble_bash_BASH_REMATCH-} =~ $_ble_bash_BASH_REMATCH_rex ]] + } +fi +function ble/variable#load-user-state/variable:BASH_REMATCH { + if ((_ble_bash_BASH_REMATCH_level)); then + __ble_var_set=${BASH_REMATCH+set} + __ble_var_val=("${_ble_bash_BASH_REMATCH[@]}") + ble/variable#get-attr -v __ble_var_att BASH_REMATCH + return 0 + else + return 1 + fi +} +ble/init/adjust-IFS +ble/base/adjust-BASH_REMATCH +function ble/init/clean-up { + local ext=$? opts=$1 # preserve exit status + builtin unset -v _ble_init_version + builtin unset -v _ble_init_exit + builtin unset -v _ble_init_command + builtin unset -v _ble_init_attached + ble/base/restore-BASH_REMATCH + ble/init/restore-IFS + if [[ :$opts: != *:check-attach:* || ! $_ble_attached ]]; then + ble/base/restore-bash-options + ble/base/restore-POSIXLY_CORRECT + ble/base/restore-builtin-wrappers + builtin eval -- "$_ble_bash_FUNCNEST_restore" + fi + return "$ext" +} +function ble/util/put { builtin printf '%s' "$1"; } +function ble/util/print { builtin printf '%s\n' "$1"; } +function ble/util/print-lines { builtin printf '%s\n' "$@"; } +_ble_base_arguments_opts= +_ble_base_arguments_attach= +_ble_base_arguments_rcfile= +function ble/base/read-blesh-arguments { + local opts= + local opt_attach=prompt + local opt_inputrc=auto + builtin unset -v _ble_init_command # 再解析 + while (($#)); do + local arg=$1; shift + case $arg in + (--noattach|noattach) + opt_attach=none ;; + (--attach=*) opt_attach=${arg#*=} ;; + (--attach) + if (($#)); then + opt_attach=$1; shift + else + opt_attach=attach + opts=$opts:E + ble/util/print "ble.sh ($arg): an option argument is missing." >&2 + fi ;; + (--noinputrc) + opt_inputrc=none ;; + (--inputrc=*) opt_inputrc=${arg#*=} ;; + (--inputrc) + if (($#)); then + opt_inputrc=$1; shift + else + opt_inputrc=inputrc + opts=$opts:E + ble/util/print "ble.sh ($arg): an option argument is missing." >&2 + fi ;; + (--rcfile=*|--init-file=*|--rcfile|--init-file) + if [[ $arg != *=* ]]; then + local rcfile=$1; shift + else + local rcfile=${arg#*=} + fi + _ble_base_arguments_rcfile=${rcfile:-/dev/null} + if [[ ! $rcfile || ! -e $rcfile ]]; then + ble/util/print "ble.sh ($arg): '$rcfile' does not exist." >&2 + opts=$opts:E + elif [[ ! -r $rcfile ]]; then + ble/util/print "ble.sh ($arg): '$rcfile' is not readable." >&2 + opts=$opts:E + fi ;; + (--norc) + _ble_base_arguments_rcfile=/dev/null ;; + (--keep-rlvars) + opts=$opts:keep-rlvars ;; + (--bash-debug-version=*|--bash-debug-version) + local value= + if [[ $arg == *=* ]]; then + value=${arg#*=} + elif (($#)); then + value=$1; shift + else + opts=$opts:E + ble/util/print "ble.sh ($arg): an option argument is missing." >&2 + continue + fi + case $value in + (full|short|once|ignore) + opts=$opts:bash-debug-version=$value ;; + (*) + opts=$opts:E + ble/util/print "ble.sh ($arg): unrecognized value '$value'." >&2 + esac ;; + (--debug-bash-output) + bleopt_internal_suppress_bash_output= ;; + (--test | --update | --clear-cache | --lib | --install) + if [[ $_ble_init_command ]]; then + ble/util/print "ble.sh ($arg): the option '--$_ble_init_command' has already been specified." >&2 + opts=$opts:E + else + _ble_init_command=${arg#--} + fi ;; + (--*) + ble/util/print "ble.sh: unrecognized long option '$arg'" >&2 + opts=$opts:E ;; + (-?*) + local i c + for ((i=1;i<${#arg};i++)); do + c=${arg:i:1} + case -$c in + (-o) + if ((i+1<${#arg})); then + local oarg=${arg:i+1} + i=${#arg} + elif (($#)); then + local oarg=$1; shift + else + opts=$opts:E + i=${#arg} + continue + fi + local rex='^[_a-zA-Z][_a-zA-Z0-9]*=' + if [[ $oarg =~ $rex ]]; then + builtin eval -- "bleopt_${oarg%%=*}=\${oarg#*=}" + else + ble/util/print "ble.sh: unrecognized option '-o $oarg'" >&2 + opts=$opts:E + fi ;; + (-*) + ble/util/print "ble.sh: unrecognized option '-$c'" >&2 + opts=$opts:E ;; + esac + done + ;; + (*) + if [[ ${_ble_init_command-} ]]; then + _ble_init_command[${#_ble_init_command[@]}]=$arg + else + ble/util/print "ble.sh: unrecognized argument '$arg'" >&2 + opts=$opts:E + fi ;; + esac + done + _ble_base_arguments_opts=$opts + _ble_base_arguments_attach=$opt_attach + _ble_base_arguments_inputrc=$opt_inputrc + [[ :$opts: != *:E:* ]] +} +if ! ble/base/read-blesh-arguments "$@"; then + builtin echo "ble.sh: cancel initialization." >&2 + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + builtin unset -v _ble_bash + return 2 2>/dev/null || builtin exit 2 +fi +if [[ ${_ble_base-} ]]; then + [[ $_ble_init_command ]] && _ble_init_attached=$_ble_attached + if ! _ble_bash=$_ble_bash ble/base/unload-for-reload; then + builtin echo "ble.sh: an old version of ble.sh seems to be already loaded." >&2 + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 2>/dev/null || builtin exit 1 + fi +fi +_ble_bash_loaded_in_function=0 +local _ble_local_test 2>/dev/null && _ble_bash_loaded_in_function=1 +_ble_version=0 +BLE_VERSION=$_ble_init_version +function ble/base/initialize-version-variables { + local version=$BLE_VERSION + local hash= + if [[ $version == *+* ]]; then + hash=${version#*+} + version=${version%%+*} + fi + local status=release + if [[ $version == *-* ]]; then + status=${version#*-} + version=${version%%-*} + fi + local major=${version%%.*}; version=${version#*.} + local minor=${version%%.*}; version=${version#*.} + local patch=${version%%.*} + ((_ble_version=major*10000+minor*100+patch)) + BLE_VERSINFO=("$major" "$minor" "$patch" "$hash" "$status" noarch) + BLE_VER=$_ble_version +} +function ble/base/clear-version-variables { + builtin unset -v _ble_bash _ble_version BLE_VERSION BLE_VERSINFO BLE_VER +} +ble/base/initialize-version-variables +function ble/bash/read { + local TMOUT= 2>/dev/null # #D1630 WA readonly TMOUT + builtin read "${_ble_bash_tmout_wa[@]}" -r "$@" +} +function ble/bash/read-timeout { builtin read -t "$@"; } +_ble_bash_read_winch= +if ((50200<=_ble_bash&&_ble_bash<50300)); then + function ble/bash/read/.process-winch { + if [[ $_ble_bash_read_winch != - ]]; then + local _ble_local_handler=$_ble_bash_read_winch + local _ble_bash_read_winch= + builtin eval -- "$_ble_local_handler" + fi + } + function ble/bash/read { + local TMOUT= 2>/dev/null # #D1630 WA readonly TMOUT + local _ble_bash_read_winch=- + builtin read "${_ble_bash_tmout_wa[@]}" -r "$@"; local _ble_local_ext=$? + ble/bash/read/.process-winch + return "$_ble_local_ext" + } + function ble/bash/read-timeout { + local _ble_bash_read_winch=- + builtin read -t "$@"; local _ble_local_ext=$? + ble/bash/read/.process-winch + return "$_ble_local_ext" + } +fi +if ((_ble_bash>=40000)); then + function ble/bin#has { builtin type -t -- "$@" &>/dev/null; } +else + function ble/bin#has { + local cmd + for cmd; do builtin type -t -- "$cmd" || return 1; done &>/dev/null + return 0 + } +fi +function ble/bin#get-path { + local cmd=$1 + ble/util/assign path 'builtin type -P -- "$cmd" 2>/dev/null' && [[ $path ]] || return 1 + if [[ ( $path == ./* || $path == ../* ) && -r $PWD/$path && -x $PWD/$path ]]; then + path=$PWD/$path + fi + return 0 +} +function ble/bin/.default-utility-path { + local cmd + for cmd; do + builtin eval "function ble/bin/$cmd { command $cmd \"\$@\"; }" + done +} +function ble/bin#freeze-utility-path { + local cmd path q=\' Q="'\''" fail= flags= + for cmd; do + if [[ $cmd == -n ]]; then + flags=n$flags + continue + fi + [[ $flags == *n* ]] && ble/bin#has ble/bin/"$cmd" && continue + ble/bin#has ble/bin/.frozen:"$cmd" && continue + if ble/bin#get-path "$cmd"; then + builtin eval "function ble/bin/$cmd { command '${path//$q/$Q}' \"\$@\"; }" + else + fail=1 + fi + done + ((!fail)) +} +_ble_init_posix_command_list=(sed date rm mkdir mkfifo sleep stty tty sort awk chmod grep cat wc mv sh od cp ps) +function ble/init/check-environment { + if ! ble/bin#has "${_ble_init_posix_command_list[@]}"; then + local cmd commandMissing= + for cmd in "${_ble_init_posix_command_list[@]}"; do + if ! ble/bin#has "$cmd"; then + commandMissing="$commandMissing\`$cmd', " + fi + done + ble/util/print "ble.sh: insane environment: The command(s), ${commandMissing}are not found. Check your environment variable PATH. If these commands are not available in your system, please install them." >&2 + local default_path + ble/util/assign default_path 'command -p getconf PATH 2>/dev/null' + [[ $default_path ]] || return 1 + local original_path=$PATH + export PATH=${default_path}${PATH:+:}${PATH} + [[ :$PATH: == *:/bin:* ]] || PATH=/bin${PATH:+:}$PATH + [[ :$PATH: == *:/usr/bin:* ]] || PATH=/usr/bin${PATH:+:}$PATH + if ! ble/bin#has "${_ble_init_posix_command_list[@]}"; then + PATH=$original_path + return 1 + fi + ble/util/print "ble.sh: modified PATH=${PATH::${#PATH}-${#original_path}}\$PATH" >&2 + fi + if [[ ! ${USER-} ]]; then + ble/util/print-lines \ + 'ble.sh: insane environment: $USER is empty. Please consider checking the' \ + ' terminal'\''s settings or setting export USER=$(id -un) in your .bash_profile.' >&2 + if ble/util/assign USER 'id -un 2>/dev/null' && [[ $USER ]]; then + export USER + ble/util/print "ble.sh: modified USER=$USER" >&2 + fi + fi + _ble_base_env_USER=$USER + if [[ ! ${HOSTNAME-} ]]; then + ble/util/print-lines \ + 'ble.sh: suspicious environment: $HOSTNAME is empty. Please consider checking' \ + ' the terminal'\''settings or setting export HOSTNAME=$(hostname), etc. in your' \ + ' .bash_profile' >&2 + if ble/util/assign HOSTNAME 'uname -n 2>/dev/null' && [[ $HOSTNAME ]]; then + export HOSTNAME + ble/util/print "ble.sh: fixed HOSTNAME=$HOSTNAME" >&2 + fi + fi + _ble_base_env_HOSTNAME=$HOSTNAME + if [[ ! ${HOME-} ]]; then + ble/util/print-lines \ + 'ble.sh: insane environment: $HOME is empty. Please consider checking' \ + ' the terminal'\''s settings or setting export HOME=... in your .bash_profile.' >&2 + local home + if ble/util/assign home 'getent passwd 2>/dev/null | awk -F : -v UID="$UID" '\''$3 == UID {print $6}'\''' && [[ $home && -d $home ]] || + { [[ $USER && -d /home/$USER && -O /home/$USER ]] && home=/home/$USER; } || + { [[ $USER && -d /Users/$USER && -O /Users/$USER ]] && home=/Users/$USER; } || + { [[ $home && ! ( -e $home && -h $home ) ]] && ble/bin/mkdir -p "$home" 2>/dev/null; } + then + export HOME=$home + ble/util/print "ble.sh: modified HOME=$HOME" >&2 + fi + fi + if [[ ! ${LANG-} ]]; then + ble/util/print-lines \ + 'ble.sh: suspicious environment: $LANG is empty. Please consider checking the' \ + ' terminal'\''s settings or setting export LANG=... in your .bash_profile.' >&2 + fi + if ((_ble_bash>=50200)); then + local error + ble/util/assign error '{ LC_ALL= LC_CTYPE=C ble/util/put; } 2>&1' + if [[ $error ]]; then + ble/util/print "$error" >&2 + ble/util/print "ble.sh: please check the locale settings (LANG and LC_*)." >&2 + ((_ble_bash>=50300)) || { LC_ALL= LC_CTYPE=C ble/util/put; } 2>/dev/null + local dummy + builtin read -et 0.000001 dummy &2 + ble/base/clear-version-variables + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 +fi +_ble_bin_awk_type= +function ble/bin/awk/.instantiate { + local path q=\' Q="'\''" ext=1 + if ble/bin#get-path nawk; then + local version + ble/util/assign version '"$path" -W version' 2>/dev/null /dev/null /dev/null /dev/null + /usr/bin/awk -v AWKTYPE=nawk "$@"; local ext=$? + ble/util/unlocal LC_ALL LC_CTYPE LC_COLLATE 2>/dev/null + return "$ext" + } + elif [[ $_ble_bin_awk_type == [gmn]awk ]] && ! ble/is-function ble/bin/"$_ble_bin_awk_type" ; then + builtin eval "function ble/bin/$_ble_bin_awk_type { command '${path//$q/$Q}' -v AWKTYPE=$_ble_bin_awk_type \"\$@\"; }" + fi + fi + fi + return "$ext" +} +function ble/bin/awk { + if ble/bin/awk/.instantiate; then + ble/bin/awk "$@" + else + awk "$@" + fi +} +function ble/bin/.frozen:awk { return 0; } +function ble/bin/.frozen:nawk { return 0; } +function ble/bin/.frozen:mawk { return 0; } +function ble/bin/.frozen:gawk { return 0; } +if [[ $OSTYPE == darwin* ]]; then + function ble/bin/sed/.instantiate { + local path= + ble/bin#get-path sed || return 1 + if [[ $path == /usr/bin/sed ]]; then + function ble/bin/sed { + local -x LC_ALL= LC_CTYPE=C LC_COLLATE=C 2>/dev/null + /usr/bin/sed "$@"; local ext=$? + ble/util/unlocal LC_ALL LC_CTYPE LC_COLLATE 2>/dev/null + return "$ext" + } + else + local q=\' Q="'\''" + builtin eval "function ble/bin/sed { command '${path//$q/$Q}' \"\$@\"; }" + fi + return 0 + } + function ble/bin/sed { + if ble/bin/sed/.instantiate; then + ble/bin/sed "$@" + else + command sed "$@" + fi + } + function ble/bin/.frozen:sed { return 0; } + function ble/bin/stty/.instantiate { + local path= + ble/bin#get-path stty || return 1 + if [[ $path == */coreutils/libexec/gnubin/stty ]]; then + if [[ -r /bin/stty && -x /bin/stty ]]; then + path=/bin/stty + fi + fi + local q=\' Q="'\''" + builtin eval "function ble/bin/stty { command '${path//$q/$Q}' \"\$@\"; }" + return 0 + } + function ble/bin/stty { + if ble/bin/stty/.instantiate; then + ble/bin/stty "$@" + else + command stty "$@" + fi + } + function ble/bin/.frozen:stty { return 0; } +else + function ble/bin/sed/.instantiate { return 0; } + function ble/bin/stty/.instantiate { return 0; } +fi +function ble/bin/awk0.available/test { + local count=0 cmd_awk=$1 awk_script='BEGIN { RS = "\0"; } { count++; } END { print count; }' + ble/util/assign count 'printf "a\0b\0" | "$cmd_awk" "$awk_script"' + ((count==2)) +} +function ble/bin/awk0.available { + local awk + for awk in mawk gawk; do + if ble/bin#freeze-utility-path -n "$awk" && + ble/bin/awk0.available/test ble/bin/"$awk" && + builtin eval -- "function ble/bin/awk0 { ble/bin/$awk -v AWKTYPE=$awk \"\$@\"; }"; then + function ble/bin/awk0.available { return 0; } + return 0 + fi + done + if ble/bin/awk0.available/test ble/bin/awk && + function ble/bin/awk0 { ble/bin/awk "$@"; }; then + function ble/bin/awk0.available { return 0; } + return 0 + fi + function ble/bin/awk0.available { return 1; } + return 1 +} +function ble/base/is-msys1 { + local cr; cr=$'\r' + [[ $OSTYPE == msys && ! $cr ]] +} +function ble/base/is-wsl { + local kernel_version + if [[ -d /usr/lib/wsl/lib && -r /proc/version ]] && + ble/bash/read kernel_version < /proc/version && + [[ $kernel_version == *-microsoft-* ]] + then + function ble/base/is-wsl { return 0; } + return 0 + else + function ble/base/is-wsl { return 1; } + return 1 + fi +} +function ble/util/mkd { + local dir + for dir; do + [[ -d $dir ]] && continue + [[ -e $dir || -L $dir ]] && ble/bin/rm -f "$dir" + ble/bin/mkdir -p "$dir" + done +} +if ((_ble_bash>=40000)); then + _ble_util_readlink_visited_init='local -A visited=()' + function ble/util/readlink/.visited { + [[ ${visited[$1]+set} ]] && return 0 + visited[$1]=1 + return 1 + } +else + _ble_util_readlink_visited_init="local -a visited=()" + function ble/util/readlink/.visited { + local key + for key in "${visited[@]}"; do + [[ $1 == "$key" ]] && return 0 + done + visited=("$1" "${visited[@]}") + return 1 + } +fi +function ble/util/readlink/.readlink { + local path=$1 + if ble/bin#has ble/bin/readlink; then + ble/util/assign link 'ble/bin/readlink -- "$path"' + [[ $link ]] + elif ble/bin#has ble/bin/ls; then + ble/util/assign link 'ble/bin/ls -ld -- "$path"' && + [[ $link == *" $path -> "?* ]] && + link=${link#*" $path -> "} + else + false + fi +} 2>/dev/null +function ble/util/readlink/.resolve-physical-directory { + [[ $path == */?* ]] || return 0 + local PWD=$PWD OLDPWD=$OLDPWD CDPATH= + if builtin cd -L .; then + local pwd=$PWD + builtin cd -P "${path%/*}/" && + path=${PWD%/}/${path##*/} + builtin cd "$pwd" + fi + return 0 +} +function ble/util/readlink/.resolve-loop { + local path=$ret + while [[ $path == ?*/ ]]; do path=${path%/}; done + builtin eval -- "$_ble_util_readlink_visited_init" + while [[ -h $path ]]; do + local link + ble/util/readlink/.visited "$path" && break + ble/util/readlink/.readlink "$path" || break + if [[ $link == /* || $path != */* ]]; then + path=$link + else + ble/util/readlink/.resolve-physical-directory + path=${path%/*}/$link + fi + while [[ $path == ?*/ ]]; do path=${path%/}; done + done + ret=$path +} +function ble/util/readlink/.resolve { + _ble_util_readlink_type= + case $OSTYPE in + (cygwin | msys | linux-gnu) + local readlink + ble/util/assign readlink 'type -P readlink' + case $readlink in + (/bin/readlink | /usr/bin/readlink) + _ble_util_readlink_type=readlink-f + builtin eval "function ble/util/readlink/.resolve { ble/util/assign ret '$readlink -f -- \"\$ret\"'; }" ;; + esac ;; + esac + if [[ ! $_ble_util_readlink_type ]]; then + _ble_util_readlink_type=loop + ble/bin#freeze-utility-path readlink ls + function ble/util/readlink/.resolve { ble/util/readlink/.resolve-loop; } + fi + ble/util/readlink/.resolve +} +function ble/util/readlink { + ret=$1 + if [[ -h $ret ]]; then ble/util/readlink/.resolve; fi +} +function ble/init/adjust-environment { + builtin unset -f "$FUNCNAME" + if [[ ${IN_NIX_SHELL-} ]]; then + local ret= + ble/util/readlink "/proc/$$/exe" 2>/dev/null + [[ -x $ret ]] && BASH=$ret + fi +} +ble/init/adjust-environment +_ble_bash_path= +function ble/bin/.load-builtin { + local name=$1 path=$2 + if [[ ! $_ble_bash_path ]]; then + local ret; ble/util/readlink "$BASH" + _ble_bash_path=$ret + fi + if [[ ! $path ]]; then + local bash_prefix=${ret%/*/*} + path=$bash_prefix/lib/bash/$name + [[ -s $path ]] || return 1 + fi + if (enable -f "$path" "$name") &>/dev/null; then + enable -f "$path" "$name" + builtin eval -- "function ble/bin/$name { builtin $name \"\$@\"; }" + return 0 + else + return 1 + fi +} +function ble/base/.create-user-directory { + local var=$1 dir=$2 + if [[ ! -d $dir ]]; then + [[ ! -e $dir && -h $dir ]] && ble/bin/rm -f "$dir" + if [[ -e $dir || -h $dir ]]; then + ble/util/print "ble.sh: cannot create a directory '$dir' since there is already a file." >&2 + return 1 + fi + if ! (umask 077; ble/bin/mkdir -p "$dir" && [[ -O $dir ]]); then + ble/util/print "ble.sh: failed to create a directory '$dir'." >&2 + return 1 + fi + elif ! [[ -r $dir && -w $dir && -x $dir ]]; then + ble/util/print "ble.sh: permission of '$dir' is not correct." >&2 + return 1 + elif [[ ! -O $dir ]]; then + ble/util/print "ble.sh: owner of '$dir' is not correct." >&2 + return 1 + fi + builtin eval "$var=\$dir" +} +function ble/base/initialize-base-directory { + local src=$1 + local defaultDir=${2-} + _ble_base_blesh_raw=$src + if [[ -h $src ]]; then + local ret; ble/util/readlink "$src"; src=$ret + fi + _ble_base_blesh=$src + if [[ -s $src && $src != */* ]]; then + _ble_base=$PWD + elif [[ $src == */* ]]; then + local dir=${src%/*} + if [[ ! $dir ]]; then + _ble_base=/ + elif [[ $dir != /* ]]; then + _ble_base=$PWD/$dir + else + _ble_base=$dir + fi + else + _ble_base=${defaultDir:-$HOME/.local/share/blesh} + fi + [[ -d $_ble_base ]] +} +if ! ble/base/initialize-base-directory "${BASH_SOURCE[0]}"; then + ble/util/print "ble.sh: ble base directory not found!" >&2 + ble/base/clear-version-variables + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 +fi +function ble/base/initialize-runtime-directory/.xdg { + local runtime_dir= + if [[ $XDG_RUNTIME_DIR ]]; then + if [[ ! -d $XDG_RUNTIME_DIR ]]; then + ble/util/print "ble.sh: XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR' is not a directory." >&2 + return 1 + elif [[ -O $XDG_RUNTIME_DIR ]]; then + runtime_dir=$XDG_RUNTIME_DIR + else + false + fi + fi + if [[ ! $runtime_dir ]]; then + runtime_dir=/run/user/$UID + [[ -d $runtime_dir && -O $runtime_dir ]] || return 1 + fi + [[ $runtime_dir == /run/user/* ]] && ble/base/is-wsl && return 1 + if ! [[ -r $runtime_dir && -w $runtime_dir && -x $runtime_dir ]]; then + [[ $runtime_dir == "$XDG_RUNTIME_DIR" ]] && + ble/util/print "ble.sh: XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR' doesn't have a proper permission." >&2 + return 1 + fi + ble/base/.create-user-directory _ble_base_run "$runtime_dir/blesh" +} +function ble/base/initialize-runtime-directory/.tmp { + [[ -r /tmp && -w /tmp && -x /tmp ]] || return 1 + ble/base/is-wsl && return 1 + local tmp_dir=/tmp/blesh + if [[ ! -d $tmp_dir ]]; then + [[ ! -e $tmp_dir && -h $tmp_dir ]] && ble/bin/rm -f "$tmp_dir" + if [[ -e $tmp_dir || -h $tmp_dir ]]; then + ble/util/print "ble.sh: cannot create a directory '$tmp_dir' since there is already a file." >&2 + return 1 + fi + ble/bin/mkdir -p "$tmp_dir" || return 1 + ble/bin/chmod a+rwxt "$tmp_dir" || return 1 + elif ! [[ -r $tmp_dir && -w $tmp_dir && -x $tmp_dir ]]; then + ble/util/print "ble.sh: permission of '$tmp_dir' is not correct." >&2 + return 1 + fi + ble/base/.create-user-directory _ble_base_run "$tmp_dir/$UID" +} +function ble/base/initialize-runtime-directory/.base { + local tmp_dir=$_ble_base/run + if [[ ! -d $tmp_dir ]]; then + ble/bin/mkdir -p "$tmp_dir" || return 1 + ble/bin/chmod a+rwxt "$tmp_dir" || return 1 + fi + ble/base/.create-user-directory _ble_base_run "$tmp_dir/${USER:-$UID}@$HOSTNAME" +} +function ble/base/initialize-runtime-directory/.home { + local cache_dir=${XDG_CACHE_HOME:-$HOME/.cache} + if [[ ! -d $cache_dir ]]; then + if [[ $XDG_CACHE_HOME ]]; then + ble/util/print "ble.sh: XDG_CACHE_HOME='$XDG_CACHE_HOME' is not a directory." >&2 + return 1 + else + ble/bin/mkdir -p "$cache_dir" || return 1 + fi + fi + if ! [[ -r $cache_dir && -w $cache_dir && -x $cache_dir ]]; then + if [[ $XDG_CACHE_HOME ]]; then + ble/util/print "ble.sh: XDG_CACHE_HOME='$XDG_CACHE_HOME' doesn't have a proper permission." >&2 + else + ble/util/print "ble.sh: '$cache_dir' doesn't have a proper permission." >&2 + fi + return 1 + fi + ble/base/.create-user-directory _ble_base_run "$cache_dir/blesh/run" +} +function ble/base/initialize-runtime-directory { + ble/base/initialize-runtime-directory/.xdg && return 0 + ble/base/initialize-runtime-directory/.tmp && return 0 + ble/base/initialize-runtime-directory/.base && return 0 + ble/base/initialize-runtime-directory/.home +} +if ! ble/base/initialize-runtime-directory; then + ble/util/print "ble.sh: failed to initialize \$_ble_base_run." >&2 + ble/base/clear-version-variables + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 +fi +>| "$_ble_base_run/$$.load" +function ble/base/clean-up-runtime-directory { + local opts=$1 failglob= noglob= + if [[ $- == *f* ]]; then + noglob=1 + set +f + fi + if shopt -q failglob &>/dev/null; then + failglob=1 + shopt -u failglob + fi + local -a alive=() removed=() bgpids=() + [[ :$opts: == *:finalize:* ]] && alive[$$]=0 + local file pid iremoved=0 ibgpid=0 + for file in "$_ble_base_run"/[1-9]*.*; do + [[ -e $file || -h $file ]] || continue + pid=${file##*/}; pid=${pid%%.*} + [[ $pid && ! ${pid//[0-9]} ]] || continue + if [[ ! ${alive[pid]+set} ]]; then + builtin kill -0 "$pid" &>/dev/null + ((alive[pid]=$?==0)) + fi + ((alive[pid])) && continue + if [[ $file == *.pid && -s $file ]]; then + local run_pid IFS= + ble/bash/read run_pid < "$file" + if ble/string#match "$run_pid" '^-?[0-9]+$' && kill -0 "$run_pid" &>/dev/null; then + if ((pid==$$)); then + bgpids[ibgpid++]=$run_pid + else + builtin kill -- "$run_pid" &>/dev/null + ble/util/msleep 50 + builtin kill -0 "$run_pid" &>/dev/null && + (ble/util/nohup "ble/util/conditional-sync '' '((1))' 100 progressive-weight:pid=$run_pid:no-wait-pid:timeout=3000:SIGKILL") + fi + fi + fi + removed[iremoved++]=$file + done + ((iremoved)) && ble/bin/rm -rf "${removed[@]}" 2>/dev/null + ((ibgpid)) && (ble/util/nohup 'ble/bin/sleep 3; builtin kill -- "${bgpids[@]}" &>/dev/null') + [[ $failglob ]] && shopt -s failglob + [[ $noglob ]] && set -f + return 0 +} +function ble/base/initialize-cache-directory/.xdg { + [[ $_ble_base != */out ]] || return 1 + local cache_dir=${XDG_CACHE_HOME:-$HOME/.cache} + if [[ ! -d $cache_dir ]]; then + [[ $XDG_CACHE_HOME ]] && + ble/util/print "ble.sh: XDG_CACHE_HOME='$XDG_CACHE_HOME' is not a directory." >&2 + return 1 + fi + if ! [[ -r $cache_dir && -w $cache_dir && -x $cache_dir ]]; then + [[ $XDG_CACHE_HOME ]] && + ble/util/print "ble.sh: XDG_CACHE_HOME='$XDG_CACHE_HOME' doesn't have a proper permission." >&2 + return 1 + fi + local ver=${BLE_VERSINFO[0]}.${BLE_VERSINFO[1]} + ble/base/.create-user-directory _ble_base_cache "$cache_dir/blesh/$ver" +} +function ble/base/initialize-cache-directory { + ble/base/initialize-cache-directory/.xdg && return 0 + local cache_dir=$_ble_base/cache.d + if [[ ! -d $cache_dir ]]; then + ble/bin/mkdir -p "$cache_dir" || return 1 + ble/bin/chmod a+rwxt "$cache_dir" || return 1 + local old_cache_dir=$_ble_base/cache + if [[ -d $old_cache_dir && ! -h $old_cache_dir ]]; then + mv "$old_cache_dir" "$cache_dir/$UID" + ln -s "$cache_dir/$UID" "$old_cache_dir" + fi + fi + ble/base/.create-user-directory _ble_base_cache "$cache_dir/$UID" +} +function ble/base/migrate-cache-directory/.move { + local old=$1 new=$2 + [[ -e $old ]] || return 0 + if [[ -e $new || -L $old ]]; then + ble/bin/rm -rf "$old" + else + ble/bin/mv "$old" "$new" + fi +} +function ble/base/migrate-cache-directory/.check-old-prefix { + local old_prefix=$_ble_base_cache/$1 + local new_prefix=$_ble_base_cache/$2 + local file + for file in "$old_prefix"*; do + local old=$file + local new=$new_prefix${file#"$old_prefix"} + ble/base/migrate-cache-directory/.move "$old" "$new" + done +} +function ble/base/migrate-cache-directory { + local failglob= + shopt -q failglob && { failglob=1; shopt -u failglob; } + ble/base/migrate-cache-directory/.check-old-prefix cmap+default.binder-source decode.cmap.allseq + ble/base/migrate-cache-directory/.check-old-prefix cmap+default decode.cmap + ble/base/migrate-cache-directory/.check-old-prefix ble-decode-bind decode.bind + local file + for file in "$_ble_base_cache"/*.term; do + local old=$file + local new=$_ble_base_cache/term.${file#"$_ble_base_cache/"}; new=${new%.term} + ble/base/migrate-cache-directory/.move "$old" "$new" + done + ble/base/migrate-cache-directory/.move "$_ble_base_cache/man" "$_ble_base_cache/complete.mandb" + [[ $failglob ]] && shopt -s failglob +} +if ! ble/base/initialize-cache-directory; then + ble/util/print "ble.sh: failed to initialize \$_ble_base_cache." >&2 + ble/base/clear-version-variables + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 +fi +ble/base/migrate-cache-directory +function ble/base/initialize-state-directory/.xdg { + local state_dir=${XDG_STATE_HOME:-$HOME/.local/state} + if [[ -e $state_dir || -L $state_dir ]]; then + if [[ ! -d $state_dir ]]; then + if [[ $XDG_STATE_HOME ]]; then + ble/util/print "ble.sh: XDG_STATE_HOME='$XDG_STATE_HOME' is not a directory." >&2 + else + ble/util/print "ble.sh: '$state_dir' is not a directory." >&2 + fi + return 1 + fi + if ! [[ -r $state_dir && -w $state_dir && -x $state_dir ]]; then + if [[ $XDG_STATE_HOME ]]; then + ble/util/print "ble.sh: XDG_STATE_HOME='$XDG_STATE_HOME' doesn't have a proper permission." >&2 + else + ble/util/print "ble.sh: '$state_dir' doesn't have a proper permission." >&2 + fi + return 1 + fi + fi + ble/base/.create-user-directory _ble_base_state "$state_dir/blesh" +} +function ble/base/initialize-state-directory { + ble/base/initialize-state-directory/.xdg && return 0 + local state_dir=$_ble_base/state.d + if [[ ! -d $state_dir ]]; then + ble/bin/mkdir -p "$state_dir" || return 1 + ble/bin/chmod a+rwxt "$state_dir" || return 1 + local old_state_dir=$_ble_base/state + if [[ -d $old_state_dir && ! -h $old_state_dir ]]; then + mv "$old_state_dir" "$state_dir/$UID" + ln -s "$state_dir/$UID" "$old_state_dir" + fi + fi + ble/util/print "ble.sh: using the non-standard position of the state directory: '$state_dir/$UID'" >&2 + ble/base/.create-user-directory _ble_base_state "$state_dir/$UID" +} +if ! ble/base/initialize-state-directory; then + ble/util/print "ble.sh: failed to initialize \$_ble_base_state." >&2 + ble/base/clear-version-variables + ble/init/clean-up 2>/dev/null # set -x 対策 #D0930 + return 1 +fi +function ble/base/print-usage-for-no-argument-command { + local name=${FUNCNAME[1]} desc=$1; shift + ble/util/print-lines \ + "usage: $name" \ + "$desc" >&2 + [[ $1 != --help ]] && return 2 + return 0 +} +function ble-reload { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local -a _ble_local_options=() + [[ ! -e $_ble_base_rcfile ]] || + ble/array#push _ble_local_options --rcfile="${_ble_base_rcfile:-/dev/null}" + [[ $_ble_base_arguments_inputrc == auto ]] || + ble/array#push _ble_local_options --inputrc="$_ble_base_arguments_inputrc" + local name + for name in keep-rlvars; do + if [[ :$_ble_base_arguments_opts: == *:"$name":* ]]; then + ble/array#push _ble_local_options "--$name" + fi + done + ble/util/unlocal name + ble/array#push _ble_local_options '--bash-debug-version=ignore' + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + source -- "$_ble_base/ble.sh" "${_ble_local_options[@]}" +} +_ble_base_repository='/home/shaun/Code/Clones/ble.sh' +_ble_base_branch='master' +_ble_base_repository_url=https://github.com/akinomyoga/ble.sh +_ble_base_build_git_version='git version 2.43.0' +_ble_base_build_make_version='GNU Make 4.3' +_ble_base_build_gawk_version='GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)' +function ble-update/.check-install-directory-ownership { + if [[ ! -O $_ble_base ]]; then + ble/util/print 'ble-update: install directory is owned by another user:' >&2 + ls -ld "$_ble_base" + return 1 + elif [[ ! -r $_ble_base || ! -w $_ble_base || ! -x $_ble_base ]]; then + ble/util/print 'ble-update: install directory permission denied:' >&2 + ls -ld "$_ble_base" + return 1 + fi +} +function ble-update/.make { + local sudo= + if [[ $1 == --sudo ]]; then + sudo=1 + shift + fi + if ! "$make" -q "$@"; then + if [[ $sudo ]]; then + sudo "$make" "$@" + else + "$make" "$@" + fi + else + return 6 + fi +} +function ble-update/.reload { + local ext=$1 + if [[ $ext -eq 0 || $ext -eq 6 && $_ble_base/ble.sh -nt $_ble_base_run/$$.load ]]; then + if [[ ! -e $_ble_base/ble.sh ]]; then + ble/util/print "ble-update: new ble.sh not found at '$_ble_base/ble.sh'." >&2 + return 1 + elif [[ ! -s $_ble_base/ble.sh ]]; then + ble/util/print "ble-update: new ble.sh '$_ble_base/ble.sh' is empty." >&2 + return 1 + elif [[ $- == *i* && $_ble_attached ]] && ! ble/util/is-running-in-subshell; then + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + ble-reload + ext=$? + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_enter" + return "$ext" + fi + return 0 + fi + ((ext==6)) && ext=0 + return "$ext" +} +function ble-update/.download-nightly-build { + if ! ble/bin#has tar xz; then + local command + for command in tar xz; do + ble/bin#has "$command" || + ble/util/print "ble-update (nightly): '$command' command is not available." >&2 + done + return 1 + fi + if ((EUID!=0)) && ! ble-update/.check-install-directory-ownership; then + sudo "$BASH" "$_ble_base/ble.sh" --update && + ble-update/.reload 6 + return "$?" + fi + local tarname=ble-nightly.tar.xz + local url_tar=$_ble_base_repository_url/releases/download/nightly/$tarname + ( + ble/util/joblist/__suppress__ + set +f + shopt -u failglob nullglob + if ! ble/bin/mkdir -p "$_ble_base/src"; then + ble/util/print "ble-update (nightly): failed to create the directory '$_ble_base/src'" >&2 + return 1 + fi + if ! builtin cd "$_ble_base/src"; then + ble/util/print "ble-update (nightly): failed to enter the directory '$_ble_base/src'" >&2 + return 1 + fi + local ret + ble/file#hash "$tarname"; local ohash=$ret + local retry max_retry=5 + for ((retry=0;retry<=max_retry;retry++)); do + if ((retry>0)); then + local wait=$((retry<3?retry*10:30)) + ble/util/print "ble-update (nightly): retry downloading in $wait seconds... ($retry/$max_retry)" >&2 + ble/util/sleep "$wait" + fi + if ble/bin#has wget; then + wget -N "$url_tar" && break + elif ble/bin#has curl; then + curl -LRo "$tarname" -z "$tarname" "$url_tar" && break + else + ble/util/print "ble-update (nightly): command 'wget' nor 'curl' is available." >&2 + return 1 + fi + done + if ((retry>max_retry)); then + ble/util/print "ble-update (nightly): failed to download the archive from '$url_tar'." >&2 + return 7 + fi + ble/file#hash "$tarname"; local nhash=$ret + [[ $ohash == "$nhash" ]] && return 6 + ble/bin/rm -rf ble-nightly*/ + if ! tar xJf "$tarname"; then + ble/util/print 'ble-update (nightly): failed to extract the tarball. Removing possibly broken tarball.' >&2 + ble/bin/rm -rf "$tarname" + return 1 + fi + local extracted_dir=ble-nightly + if [[ ! -d $extracted_dir ]]; then + ble/util/print "ble-update (nightly): the directory 'ble-nightly' not found in the tarball '$PWD/$tarname'." >&2 + return 1 + fi + ble/bin/cp -Rf "$extracted_dir"/* "$_ble_base/" || return 1 + ble/bin/rm -rf "$extracted_dir" + ) && + ble-update/.reload +} +function ble-update/.check-build-dependencies { + make= + if ble/bin#has gmake; then + make=gmake + elif ble/bin#has make && make --version 2>&1 | ble/bin/grep -qiF 'GNU Make'; then + make=make + else + ble/util/print "ble-update: GNU Make is not available." >&2 + return 1 + fi + if ! ble/bin#has git gawk; then + local command + for command in git gawk; do + ble/bin#has "$command" || + ble/util/print "ble-update: '$command' command is not available." >&2 + done + return 1 + fi + return 0 +} +function ble-update/.check-repository { + if [[ ${_ble_base_repository-} && $_ble_base_repository != release:* ]]; then + if [[ ! -e $_ble_base_repository/.git ]]; then + ble/util/print "ble-update: git repository not found at '$_ble_base_repository'." >&2 + elif [[ ! -O $_ble_base_repository ]]; then + ble/util/print "ble-update: git repository is owned by another user:" >&2 + ls -ld "$_ble_base_repository" + elif [[ ! -r $_ble_base_repository || ! -w $_ble_base_repository || ! -x $_ble_base_repository ]]; then + ble/util/print 'ble-update: git repository permission denied:' >&2 + ls -ld "$_ble_base_repository" + else + return 0 + fi + fi + return 1 +} +function ble-update/.impl { + if (($#)); then + ble/base/print-usage-for-no-argument-command 'Update and reload ble.sh.' "$@" + return "$?" + fi + if [[ ${_ble_base_package_type-} ]] && ble/is-function ble/base/package:"$_ble_base_package_type"/update; then + ble/util/print "ble-update: delegate to '$_ble_base_package_type' package manager..." >&2 + ble/base/package:"$_ble_base_package_type"/update; local ext=$? + if ((ext==125)); then + ble/util/print 'ble-update: fallback to the default update process.' >&2 + else + ble-update/.reload "$ext" + return "$?" + fi + fi + if [[ ${_ble_base_repository-} == release:nightly-* ]]; then + if ble-update/.download-nightly-build; local ext=$?; ((ext==0||ext==6||ext==7)); then + if ((ext==6)); then + ble/util/print 'ble-update (nightly): Already up to date.' >&2 + elif ((ext==7)); then + ble/util/print 'ble-update (nightly): Remote temporarily unavailable. Try it again later.' >&2 + fi + return 0 + fi + fi + local make + ble-update/.check-build-dependencies || return 1 + local insdir_doc=$_ble_base/doc + [[ ! -d $insdir_doc && -d ${_ble_base%/*}/doc/blesh ]] && + insdir_doc=${_ble_base%/*}/doc/blesh + if ble-update/.check-repository; then + ( ble/util/print "cd into $_ble_base_repository..." >&2 && + builtin cd "$_ble_base_repository" && + git pull && git submodule update --recursive --remote && + if [[ $_ble_base == "$_ble_base_repository"/out ]]; then + ble-update/.make all + elif ((EUID!=0)) && ! ble-update/.check-install-directory-ownership; then + ble-update/.make all + ble-update/.make --sudo INSDIR="$_ble_base" INSDIR_DOC="$insdir_doc" install + else + ble-update/.make INSDIR="$_ble_base" INSDIR_DOC="$insdir_doc" install + fi ) + ble-update/.reload "$?" + return "$?" + fi + if ((EUID!=0)) && ! ble-update/.check-install-directory-ownership; then + sudo "$BASH" "$_ble_base/ble.sh" --update && + ble-update/.reload 6 + return "$?" + else + local branch=${_ble_base_branch:-master} + ( ble/bin/mkdir -p "$_ble_base/src" && builtin cd "$_ble_base/src" && + git clone --recursive --depth 1 "$_ble_base_repository_url" "$_ble_base/src/ble.sh" -b "$branch" && + builtin cd ble.sh && "$make" all && + "$make" INSDIR="$_ble_base" INSDIR_DOC="$insdir_doc" install ) && + ble-update/.reload + return "$?" + fi + return 1 +} +function ble-update { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble-update/.impl "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_attached= +BLE_ATTACHED= +_ble_term_nl=$'\n' +_ble_term_FS=$'\034' +_ble_term_SOH=$'\001' +_ble_term_DEL=$'\177' +_ble_term_IFS=$' \t\n' +_ble_term_CR=$'\r' +_ble_term_blank=$' \t' # WA #D2055 +function blehook/declare { + local name=$1 + builtin eval "_ble_hook_h_$name=()" + builtin eval "_ble_hook_c_$name=0" +} +blehook/declare EXIT +blehook/declare INT +blehook/declare internal_EXIT +blehook/declare internal_INT +blehook/declare internal_ERR +blehook/declare internal_RETURN +blehook/declare internal_DEBUG +blehook/declare unload +blehook/declare ATTACH +blehook/declare DETACH +blehook/declare term_DA1R +blehook/declare term_DA2R +blehook/declare idle_after_task +blehook/declare color_defface_load +blehook/declare color_setface_load +blehook/declare ADDHISTORY +blehook/declare history_reset_background +blehook/declare history_leave +blehook/declare history_change +blehook/declare history_message +blehook/declare WINCH +blehook/declare internal_WINCH +blehook/declare CHPWD +blehook/declare PRECMD +blehook/declare internal_PRECMD +blehook/declare PREEXEC +blehook/declare internal_PREEXEC +blehook/declare POSTEXEC +blehook/declare ERREXEC +blehook/declare widget_bell +blehook/declare textarea_render_defer +blehook/declare info_reveal +blehook/declare exec_register +blehook/declare exec_end +blehook/declare keymap_load +blehook/declare keymap_vi_load +blehook/declare keymap_emacs_load +blehook/declare syntax_load +blehook/declare complete_load +blehook/declare complete_insert +function blehook/.compatibility-ble-0.3 { + blehook keymap_load!='ble/util/invoke-hook _ble_keymap_default_load_hook' + blehook keymap_emacs_load!='ble/util/invoke-hook _ble_keymap_emacs_load_hook' + blehook keymap_vi_load!='ble/util/invoke-hook _ble_keymap_vi_load_hook' + blehook complete_load!='ble/util/invoke-hook _ble_complete_load_hook' +} +function blehook/.compatibility-ble-0.3/check { + if ble/is-array _ble_keymap_default_load_hook || + ble/is-array _ble_keymap_vi_load_hook || + ble/is-array _ble_keymap_emacs_load_hook || + ble/is-array _ble_complete_load_hook + then + ble/bin/cat << EOF +# [Change in ble-0.4.0] +# +# Please update your blerc settings for ble-0.4+. +# In ble-0.4+, use the following form: +# +# blehook/eval-after-load keymap SHELL-COMMAND +# blehook/eval-after-load keymap_vi SHELL-COMMAND +# blehook/eval-after-load keymap_emacs SHELL-COMMAND +# blehook/eval-after-load complete SHELL-COMMAND +# +# instead of the following older form: +# +# ble/array#push _ble_keymap_default_load_hook SHELL-COMMAND +# ble/array#push _ble_keymap_vi_load_hook SHELL-COMMAND +# ble/array#push _ble_keymap_emacs_load_hook SHELL-COMMAND +# ble/array#push _ble_complete_load_hook SHELL-COMMAND +# +# Note: "blehook/eval-after-load" should be called +# after you defined SHELL-COMMAND. +# +EOF + fi +} +function ble-edit/prompt/print { ble/prompt/print "$@"; } +function ble-edit/prompt/process-prompt-string { ble/prompt/process-prompt-string "$@"; } +function ble/widget/@nomarked { ble/decode/widget/dispatch "$@"; } +function ble/complete/action/inherit-from { + ble/complete/action#inherit-from "$@" +} +function bleopt/.read-arguments/process-option { + local name=$1 + case $name in + (help) + flags=H$flags ;; + (color|color=always) + flags=c${flags//[cn]} ;; + (color=never) + flags=n${flags//[cn]} ;; + (color=auto) + flags=${flags//[cn]} ;; + (color=*) + ble/util/print "bleopt: '${name#*=}': unrecognized option argument for '--color'." >&2 + flags=E$flags ;; + (reset) flags=r$flags ;; + (changed) flags=u$flags ;; + (initialize) flags=I$flags ;; + (*) + ble/util/print "bleopt: unrecognized long option '--$name'." >&2 + flags=E$flags ;; + esac +} +function bleopt/expand-variable-pattern { + ret=() + local pattern=$1 + if [[ $pattern == *[@*?]* ]]; then + builtin eval -- "ret=(\"\${!${pattern%%[@*?]*}@}\")" + ble/array#filter-by-glob ret "${pattern//@/*}" + elif [[ ${!pattern+set} || :$opts: == :allow-undefined: ]]; then + ret=("$pattern") + fi + ((${#ret[@]})) +} +function bleopt/.read-arguments { + flags= pvars=() specs=() + local stop_option= + while (($#)); do + local arg=$1; shift + if [[ ! $stop_option && $arg == -?* ]]; then + case $arg in + (--) + stop_option=1 ;; + (--*) + bleopt/.read-arguments/process-option "${arg:2}" ;; + (*) + local i c + for ((i=1;i<${#arg};i++)); do + c=${arg:i:1} + case $c in + (r) bleopt/.read-arguments/process-option reset ;; + (u) bleopt/.read-arguments/process-option changed ;; + (I) bleopt/.read-arguments/process-option initialize ;; + (*) + ble/util/print "bleopt: unrecognized option '-$c'." >&2 + flags=E$flags ;; + esac + done ;; + esac + continue + elif local rex='^([_a-zA-Z0-9@*?]+)([:+-]?=|$)(.*)'; [[ $arg =~ $rex ]]; then + local name=${BASH_REMATCH[1]#bleopt_} + local var + var=("bleopt_$name") + local op=${BASH_REMATCH[2]} + local value=${BASH_REMATCH[3]} + if [[ $op == ':=' ]]; then + if [[ $var == *[@*?]* ]]; then + ble/util/print "bleopt: \`${var#bleopt_}': wildcard cannot be used in the definition." >&2 + flags=E$flags + continue + fi + else + local ret; bleopt/expand-variable-pattern "$var" + var=() + local v i=0 + for v in "${ret[@]}"; do + ble/is-function "bleopt/obsolete:${v#bleopt_}" && continue + var[i++]=$v + done + if ((${#var[@]} == 0 && ${#ret[*]})); then + if [[ $op == [+-]= ]]; then + ble/util/print "bleopt: \`$op' cannot be applied to the obsolete option(s), \`$name'" >&2 + flags=E$flags + continue + fi + var=("${ret[@]}") + fi + if ((${#var[@]}==0)); then + ble/util/print "bleopt: option \`$name' not found" >&2 + flags=E$flags + continue + fi + fi + if [[ $op ]]; then + ble/array#map-suffix var "${op#:}$value" + ble/array#push specs "${var[@]}" + else + ble/array#push pvars "${var[@]}" + fi + else + ble/util/print "bleopt: unrecognized argument '$arg'" >&2 + flags=E$flags + fi + done +} +function bleopt/changed.predicate { + local cur=$1 def=_ble_opt_def_${1#bleopt_} + [[ ! ${!def+set} || ${!cur} != "${!def}" ]] +} +function bleopt/default { + local def=_ble_opt_def_${1#bleopt_} + ret=${!def} +} +function bleopt { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local flags pvars specs + bleopt/.read-arguments "$@" + if [[ $flags == *E* ]]; then + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return 2 + elif [[ $flags == *H* ]]; then + ble/util/print-lines \ + 'usage: bleopt [OPTION] [NAME|NAME=VALUE|NAME[:+-]=VALUE]...' \ + ' Set ble.sh options. Without arguments, this prints all the settings.' \ + '' \ + ' Options' \ + ' --help Print this help.' \ + ' -r, --reset Reset options to the default values' \ + ' -I, --initialize Re-initialize settings' \ + ' -u, --changed Only select changed options' \ + ' --color[=always|never|auto]' \ + ' Change color settings.' \ + '' \ + ' Arguments' \ + ' NAME Print the value of the option.' \ + ' NAME=VALUE Set the value to the option.' \ + ' NAME:=VALUE Set or create the value to the option.' \ + ' NAME+=VALUE Add the value to the colon-separated list.' \ + ' NAME-=VALUE Remove the value to the colon-separated list.' \ + '' \ + ' NAME can contain "@", "*", and "?" as wildcards.' \ + '' + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return 0 + fi + if ((${#pvars[@]}==0&&${#specs[@]}==0)); then + local var ip=0 + for var in "${!bleopt_@}"; do + ble/is-function "bleopt/obsolete:${var#bleopt_}" && continue + pvars[ip++]=$var + done + fi + [[ $flags == *u* ]] && + ble/array#filter pvars bleopt/changed.predicate + if [[ $flags == *r* ]]; then + local var + for var in "${pvars[@]}"; do + local name=${var#bleopt_} + ble/is-function bleopt/obsolete:"$name" && continue + local def=_ble_opt_def_$name + [[ ${!def+set} && ${!var-} != "${!def}" ]] && + ble/array#push specs "$var=${!def}" + done + pvars=() + elif [[ $flags == *I* ]]; then + local var + for var in "${pvars[@]}"; do + bleopt/reinitialize "${var#bleopt_}" + done + pvars=() + fi + if ((${#specs[@]})); then + local spec + for spec in "${specs[@]}"; do + if ! ble/string#match "$spec" '^([_a-zA-Z0-9]+)([+-]?=)(.*)$'; then + ble/util/print "bleopt: internal error: unrecognized assignment ($spec)." >&2 + return 3 + fi + local var=${BASH_REMATCH[1]} op=${BASH_REMATCH[2]} value=${BASH_REMATCH[3]} + if [[ $op == [+-]= ]]; then + local rhs=$value value=${!var} + if [[ $op == += ]]; then + ble/opts#append-unique value "$rhs" + else + ble/opts#remove value "$rhs" + fi + fi + [[ ${!var+set} && ${!var} == "$value" ]] && continue + if ble/is-function bleopt/check:"${var#bleopt_}"; then + local bleopt_source=${BASH_SOURCE[1]} + local bleopt_lineno=${BASH_LINENO[0]} + if ! bleopt/check:"${var#bleopt_}"; then + flags=E$flags + continue + fi + fi + builtin eval -- "$var=\"\$value\"" + done + fi + if ((${#pvars[@]})); then + local sgr0= sgr1= sgr2= sgr3= sgr4= + if [[ $flags == *c* || $flags != *n* && -t 1 ]]; then + local ret + ble/color/face2sgr command_function; sgr1=$ret + ble/color/face2sgr syntax_varname; sgr2=$ret + ble/color/face2sgr syntax_quoted; sgr3=$ret + ble/color/face2sgr syntax_escape; sgr4=$ret + sgr0=$_ble_term_sgr0 + fi + local var + for var in "${pvars[@]}"; do + local ret + ble/string#quote-word "${!var}" sgrq="$sgr3":sgre="$sgr4":sgr0="$sgr0" + ble/util/print "${sgr1}bleopt$sgr0 ${sgr2}${var#bleopt_}$sgr0=$ret" + done + fi + [[ $flags != *E* ]] + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function bleopt/declare/.check-renamed-option { + var=bleopt_$2 + local sgr0= sgr1= sgr2= sgr3= + if [[ -t 2 ]]; then + sgr0=$_ble_term_sgr0 + sgr1=${_ble_term_setaf[2]} + sgr2=${_ble_term_setaf[1]}$_ble_term_bold + sgr3=${_ble_term_setaf[4]}$_ble_term_bold + fi + local locate=$sgr1${BASH_SOURCE[3]-'(stdin)'}:${BASH_LINENO[2]}$sgr0 + ble/util/print "$locate (bleopt): The option '$sgr2$1$sgr0' has been renamed. Please use '$sgr3$2$sgr0' instead." >&2 + if ble/is-function bleopt/check:"$2"; then + bleopt/check:"$2" + return "$?" + fi + return 0 +} +function bleopt/declare { + local type=$1 name=bleopt_$2 default_value=${3-} + case $type in + (-o) + if [[ ${3-} ]]; then + builtin eval -- "$name='[obsolete: renamed to $3]'" + else + builtin eval -- "$name='[obsolete]'" + fi + builtin eval -- "function bleopt/check:$2 { bleopt/declare/.check-renamed-option $2 $3; }" + builtin eval -- "function bleopt/obsolete:$2 { return 0; }" ;; + (-n) + builtin eval -- "_ble_opt_def_$2=\$3" + builtin eval -- ": \"\${$name:=\$default_value}\"" ;; + (*) + builtin eval -- "_ble_opt_def_$2=\$3" + builtin eval -- ": \"\${$name=\$default_value}\"" ;; + esac + return 0 +} +function bleopt/reinitialize { + local name=$1 + local defname=_ble_opt_def_$name + local varname=bleopt_$name + [[ ${!defname+set} ]] || return 1 + [[ ${!varname} == "${!defname}" ]] && return 0 + ble/is-function bleopt/obsolete:"$name" && return 0 + ble/is-function bleopt/check:"$name" || return 0 + local value=${!varname} + builtin eval -- "$varname=\$$defname" + bleopt/check:"$name" && + builtin eval "$varname=\$value" +} +bleopt/declare -n input_encoding UTF-8 +function bleopt/check:input_encoding { + if ! ble/is-function ble/encoding:"$value"/decode; then + ble/util/print "bleopt: Invalid value input_encoding='$value'. A function 'ble/encoding:$value/decode' is not defined." >&2 + return 1 + elif ! ble/is-function ble/encoding:"$value"/b2c; then + ble/util/print "bleopt: Invalid value input_encoding='$value'. A function 'ble/encoding:$value/b2c' is not defined." >&2 + return 1 + elif ! ble/is-function ble/encoding:"$value"/c2bc; then + ble/util/print "bleopt: Invalid value input_encoding='$value'. A function 'ble/encoding:$value/c2bc' is not defined." >&2 + return 1 + elif ! ble/is-function ble/encoding:"$value"/generate-binder; then + ble/util/print "bleopt: Invalid value input_encoding='$value'. A function 'ble/encoding:$value/generate-binder' is not defined." >&2 + return 1 + elif ! ble/is-function ble/encoding:"$value"/is-intermediate; then + ble/util/print "bleopt: Invalid value input_encoding='$value'. A function 'ble/encoding:$value/is-intermediate' is not defined." >&2 + return 1 + fi + if [[ $bleopt_input_encoding != "$value" ]]; then + local bleopt_input_encoding=$value + ble/decode/readline/rebind + fi + return 0 +} +bleopt/declare -v internal_stackdump_enabled 0 +bleopt/declare -n openat_base 30 +bleopt/declare -v pager '' +bleopt/declare -v editor '' +shopt -s checkwinsize +function ble/util/setexit { return "$1"; } +_ble_util_upvar_setup='local var=ret ret; [[ $1 == -v ]] && var=$2 && shift 2' +_ble_util_upvar='local "${var%%\[*\]}" && ble/util/upvar "$var" "$ret"' +if ((_ble_bash>=50000)); then + function ble/util/unlocal { + if shopt -q localvar_unset; then + shopt -u localvar_unset + builtin unset -v "$@" + shopt -s localvar_unset + else + builtin unset -v "$@" + fi + } + function ble/util/upvar { ble/util/unlocal "${1%%\[*\]}" && builtin eval "$1=\"\$2\""; } + function ble/util/uparr { ble/util/unlocal "$1" && builtin eval "$1=(\"\${@:2}\")"; } +else + function ble/util/unlocal { builtin unset -v "$@"; } + function ble/util/upvar { builtin unset -v "${1%%\[*\]}" && builtin eval "$1=\"\$2\""; } + function ble/util/uparr { builtin unset -v "$1" && builtin eval "$1=(\"\${@:2}\")"; } +fi +function ble/util/save-vars { + local __ble_name __ble_prefix=$1; shift + for __ble_name; do + if ble/is-array "$__ble_name"; then + if ble/array#is-sparse "$__ble_name"; then + ble/idict#copy "$__ble_prefix$__ble_name" "$__ble_name" + else + builtin eval "$__ble_prefix$__ble_name=(\"\${$__ble_name[@]}\")" + fi + else + builtin eval "$__ble_prefix$__ble_name=\"\$$__ble_name\"" + fi + done +} +function ble/util/restore-vars { + local __ble_name __ble_prefix=$1; shift + for __ble_name; do + if ble/is-array "$__ble_prefix$__ble_name"; then + if ble/array#is-sparse "$__ble_name"; then + ble/idict#copy "$__ble_name" "$__ble_prefix$__ble_name" + else + builtin eval "$__ble_name=(\${$__ble_prefix$__ble_name[@]+\"\${$__ble_prefix$__ble_name[@]}\"})" + fi + else + builtin eval "$__ble_name=\"\${$__ble_prefix$__ble_name-}\"" + fi + done +} +if ((_ble_bash>=40400)); then + function ble/variable#get-attr { + if [[ $1 == -v ]]; then + builtin eval -- "$2=\${!3@a}" + else + attr=${!1@a} + fi + } + function ble/variable#has-attr { [[ ${!1@a} == *["$2"]* ]]; } +else + function ble/variable#get-attr { + if [[ $1 == -v ]]; then + local __ble_var=$2 __ble_tmp=$3 + else + local __ble_var=attr __ble_tmp=$1 + fi + ble/util/assign __ble_tmp 'declare -p "$__ble_tmp" 2>/dev/null' + local rex='^declare -([a-zA-Z]*)'; [[ $__ble_tmp =~ $rex ]] + builtin eval -- "$__ble_var=\${BASH_REMATCH[1]-}" + return 0 + } + function ble/variable#has-attr { + local __ble_tmp=$1 + ble/util/assign __ble_tmp 'declare -p "$__ble_tmp" 2>/dev/null' + local rex='^declare -([a-zA-Z]*)' + [[ $__ble_tmp =~ $rex && ${BASH_REMATCH[1]} == *["$2"]* ]] + } +fi +function ble/is-inttype { ble/variable#has-attr "$1" i; } +function ble/is-readonly { ble/variable#has-attr "$1" r; } +function ble/is-transformed { ble/variable#has-attr "$1" luc; } +function ble/variable#is-declared { [[ ${!1+set} ]] || declare -p "$1" &>/dev/null; } +function ble/variable#is-global/.test { ! local "$1"; } +function ble/variable#is-global { + (builtin readonly "$1"; ble/variable#is-global/.test "$1") 2>/dev/null +} +function ble/variable#copy-state { + local src=$1 dst=$2 + if [[ ${!src+set} ]]; then + builtin eval -- "$dst=\${$src}" + else + builtin unset -v "$dst[0]" 2>/dev/null || builtin unset -v "$dst" + fi +} +_ble_array_prototype=() +function ble/array#reserve-prototype { + local n=$1 i + for ((i=${#_ble_array_prototype[@]};i=40400)); then + function ble/is-array { [[ ${!1@a} == *a* ]]; } + function ble/is-assoc { [[ ${!1@a} == *A* ]]; } +else + function ble/is-array { + local "decl$1" + ble/util/assign "decl$1" "declare -p $1" 2>/dev/null || return 1 + local rex='^declare -[b-zAB-Z]*a' + builtin eval "[[ \$decl$1 =~ \$rex ]]" + } + function ble/is-assoc { + local "decl$1" + ble/util/assign "decl$1" "declare -p $1" 2>/dev/null || return 1 + local rex='^declare -[ab-zB-Z]*A' + builtin eval "[[ \$decl$1 =~ \$rex ]]" + } + ((_ble_bash>=40000)) || + function ble/is-assoc { return 1; } +fi +function ble/array#is-sparse { + builtin eval "((\${#$1[@]})) && set -- \"\${$1[@]:\${#$1[@]}:1}\"" && (($#)) +} +function ble/array#set { builtin eval "$1=(\"\${@:2}\")"; } +if ((_ble_bash>=40000)); then + function ble/array#push { + builtin eval "$1+=(\"\${@:2}\")" + } +elif ((_ble_bash>=30100)); then + function ble/array#push { + IFS=$_ble_term_IFS builtin eval "$1+=(\"\${@:2}\")" + } +else + function ble/array#push { + while (($#>=2)); do + builtin eval -- "$1[\${#$1[@]}]=\"\$2\"" + set -- "$1" "${@:3}" + done + } +fi +function ble/array#pop { + builtin eval "local i$1=\$((\${#$1[@]}-1))" + if ((i$1>=0)); then + builtin eval "ret=\${$1[i$1]}" + builtin unset -v "$1[i$1]" + return 0 + else + ret= + return 1 + fi +} +function ble/array#unshift { + builtin eval -- "$1=(\"\${@:2}\" \"\${$1[@]}\")" +} +function ble/array#shift { + builtin eval -- "$1=(\"\${$1[@]:$((${2:-1}))}\")" +} +function ble/array#reverse { + builtin eval " + set -- \"\${$1[@]}\"; $1=() + local e$1 i$1=\$# + for e$1; do $1[--i$1]=\"\$e$1\"; done" +} +function ble/array#insert-at { + builtin eval "$1=(\"\${$1[@]::$2}\" \"\${@:3}\" \"\${$1[@]:$2}\")" +} +function ble/array#insert-after { + local _ble_local_script=' + local iNAME=0 eNAME aNAME= + for eNAME in "${NAME[@]}"; do + ((iNAME++)) + [[ $eNAME == "$2" ]] && aNAME=iNAME && break + done + [[ $aNAME ]] && ble/array#insert-at "$1" "$aNAME" "${@:3}" + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/array#insert-before { + local _ble_local_script=' + local iNAME=0 eNAME aNAME= + for eNAME in "${NAME[@]}"; do + [[ $eNAME == "$2" ]] && aNAME=iNAME && break + ((iNAME++)) + done + [[ $aNAME ]] && ble/array#insert-at "$1" "$aNAME" "${@:3}" + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/array#filter/.eval { + builtin eval -- "$_ble_local_predicate_cmd" +} +function ble/array#filter { + local _ble_local_predicate=$2 _ble_local_predicate_cmd= + if [[ $2 == *'$'* ]] || ! ble/is-function "$2"; then + _ble_local_predicate=ble/array#filter/.eval + _ble_local_predicate_cmd=$2 + fi + local _ble_local_script=' + local -a aNAME=() eNAME + for eNAME in "${NAME[@]}"; do + "$_ble_local_predicate" "$eNAME" && ble/array#push "aNAME" "$eNAME" + done + NAME=("${aNAME[@]}") + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/array#filter/not.predicate { ! "$_ble_local_pred" "$1"; } +function ble/array#remove-if { + local _ble_local_pred=$2 + ble/array#filter "$1" ble/array#filter/not.predicate +} +function ble/array#filter/regex.predicate { [[ $1 =~ $_ble_local_rex ]]; } +function ble/array#filter-by-regex { + local _ble_local_rex=$2 + local LC_ALL= LC_COLLATE=C 2>/dev/null + ble/array#filter "$1" ble/array#filter/regex.predicate + ble/util/unlocal LC_COLLATE LC_ALL 2>/dev/null +} +function ble/array#remove-by-regex { + local _ble_local_rex=$2 + local LC_ALL= LC_COLLATE=C 2>/dev/null + ble/array#remove-if "$1" ble/array#filter/regex.predicate + ble/util/unlocal LC_COLLATE LC_ALL 2>/dev/null +} +function ble/array#filter/glob.predicate { [[ $1 == $_ble_local_glob ]]; } +function ble/array#filter-by-glob { + local _ble_local_glob=$2 + local LC_ALL= LC_COLLATE=C 2>/dev/null + ble/array#filter "$1" ble/array#filter/glob.predicate + ble/util/unlocal LC_COLLATE LC_ALL 2>/dev/null +} +function ble/array#remove-by-glob { + local _ble_local_glob=$2 + local LC_ALL= LC_COLLATE=C 2>/dev/null + ble/array#remove-if "$1" ble/array#filter/glob.predicate + ble/util/unlocal LC_COLLATE LC_ALL 2>/dev/null +} +function ble/array#remove/.predicate { [[ $1 != "$_ble_local_value" ]]; } +function ble/array#remove { + local _ble_local_value=$2 + ble/array#filter "$1" ble/array#remove/.predicate +} +function ble/array#index { + local _ble_local_script=' + local eNAME iNAME=0 + for eNAME in "${NAME[@]}"; do + if [[ $eNAME == "$2" ]]; then ret=$iNAME; return 0; fi + ((++iNAME)) + done + ret=-1; return 1 + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/array#last-index { + local _ble_local_script=' + local eNAME iNAME=${#NAME[@]} + while ((iNAME--)); do + [[ ${NAME[iNAME]} == "$2" ]] && { ret=$iNAME; return 0; } + done + ret=-1; return 1 + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/array#remove-at { + local _ble_local_script=' + builtin unset -v "NAME[$2]" + NAME=("${NAME[@]}") + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +if ((_ble_bash>=50200)); then + function ble/array#map-prefix { + local _ble_local_script='NAME=("${NAME[@]/#/"$2"}")' # disable=#D1570,#D1751,#D2352 + if shopt -q compat42; then + shopt -u compat42 + builtin eval -- "${_ble_local_script//NAME/$1}" + shopt -s compat42 + else + builtin eval -- "${_ble_local_script//NAME/$1}" + fi + } + function ble/array#map-suffix { + local _ble_local_script='NAME=("${NAME[@]/%/"$2"}")' # disable=#D1570,#D1751,#D2352 + if shopt -q compat42; then + shopt -u compat42 + builtin eval -- "${_ble_local_script//NAME/$1}" + shopt -s compat42 + else + builtin eval -- "${_ble_local_script//NAME/$1}" + fi + } +elif ((_ble_bash<30100||40300<=_ble_bash&&_ble_bash<40400)); then + function ble/array#map-prefix { + local _ble_local_script=' + NAME=("${NAME[@]}") # WA for #D1570 + NAME=("${NAME[@]/#/$2}") # disable=#D1570,#D1738,#D2352' + builtin eval -- "${_ble_local_script//NAME/$1}" + } + function ble/array#map-suffix { + local _ble_local_script=' + NAME=("${NAME[@]}") # WA for #D1570 + NAME=("${NAME[@]/%/$2}") # disable=#D1570,#D1738,#D2352' + builtin eval -- "${_ble_local_script//NAME/$1}" + } +elif ((40200<=_ble_bash&&_ble_bash<40300)); then + function ble/array#map-prefix { + local _ble_local_script=' + if ((${#NAME[@]}==1)); then + NAME=("${NAME[@]}") # compaction + NAME[0]=$2${NAME[0]} # WA for #D2352 + else + NAME=("${NAME[@]/#/$2}") # disable=#D1570,#D1738,#D2352 + fi' + builtin eval -- "${_ble_local_script//NAME/$1}" + } + function ble/array#map-suffix { + local _ble_local_script=' + if ((${#NAME[@]}==1)); then + NAME=("${NAME[@]}") # compaction + NAME[0]=${NAME[0]}$2 # WA for #D2352 + else + NAME=("${NAME[@]/%/$2}") # disable=#D1570,#D1738,#D2352 + fi' + builtin eval -- "${_ble_local_script//NAME/$1}" + } +else + function ble/array#map-prefix { + local _ble_local_script=' + NAME=("${NAME[@]/#/$2}") # disable=#D1570,#D1738,#D2352' + builtin eval -- "${_ble_local_script//NAME/$1}" + } + function ble/array#map-suffix { + local _ble_local_script=' + NAME=("${NAME[@]/%/$2}") # disable=#D1570,#D1738,#D2352' + builtin eval -- "${_ble_local_script//NAME/$1}" + } +fi +function ble/array#fill-range { + local _ble_local_script=' + local iNAME=$2 + while ((iNAME<'"$(($3))"')); do NAME[iNAME++]=$4; done' + builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/idict#replace { + local _ble_local_script=' + local iNAME=0 extNAME=1 + for iNAME in "${!NAME[@]}"; do + [[ ${NAME[iNAME]} == "$2" ]] || continue + extNAME=0 + if (($#>=3)); then + NAME[iNAME]=$3 + else + builtin unset -v '\''NAME[iNAME]'\'' + fi + done + return "$extNAME" + '; builtin eval -- "${_ble_local_script//NAME/$1}" +} +function ble/idict#copy { + local __ble_script=' + '$1'=() + local __ble_i + for __ble_i in "${!'$2'[@]}"; do + '$1'[__ble_i]=${'$2'[__ble_i]} + done' + builtin eval -- "$__ble_script" +} +_ble_string_prototype=' ' +function ble/string#reserve-prototype { + local n=$1 c + for ((c=${#_ble_string_prototype};c${#b})) && local a=$b b=$a + b=${b::${#a}} + if [[ $a == "$b" ]]; then + ret=$a + return 0 + fi + local l=0 u=${#a} m + while ((l+1${#b})) && local a=$b b=$a + b=${b:${#b}-${#a}} + if [[ $a == "$b" ]]; then + ret=$a + return 0 + fi + local l=0 u=${#a} m + while ((l+1=40000)); then + function ble/string#split-lines { + mapfile -t "$1" <<< "$2" + } +else + function ble/string#split-lines { + ble/util/mapfile "$1" <<< "$2" + } +fi +function ble/string#count-char { + local text=$1 char=$2 + text=${text//[!"$char"]} + ret=${#text} +} +function ble/string#count-string { + local text=${1//"$2"} + ((ret=(${#1}-${#text})/${#2})) +} +function ble/string#index-of { + local haystack=$1 needle=$2 count=${3:-1} + ble/string#repeat '*"$needle"' "$count"; local pattern=$ret + builtin eval "local transformed=\${haystack#$pattern}" + ((ret=${#haystack}-${#transformed}-${#needle}, + ret<0&&(ret=-1),ret>=0)) +} +function ble/string#last-index-of { + local haystack=$1 needle=$2 count=${3:-1} + ble/string#repeat '"$needle"*' "$count"; local pattern=$ret + builtin eval "local transformed=\${haystack%$pattern}" + if [[ $transformed == "$haystack" ]]; then + ret=-1 + else + ret=${#transformed} + fi + ((ret>=0)) +} +_ble_util_string_lower_list=abcdefghijklmnopqrstuvwxyz +_ble_util_string_upper_list=ABCDEFGHIJKLMNOPQRSTUVWXYZ +function ble/string#islower { [[ $1 == ["$_ble_util_string_lower_list"] ]]; } +function ble/string#isupper { [[ $1 == ["$_ble_util_string_upper_list"] ]]; } +function ble/string#toggle-case { + local text=$1 ch i + local -a buff + for ((i=0;i<${#text};i++)); do + ch=${text:i:1} + if ble/string#isupper "$ch"; then + ch=${_ble_util_string_upper_list%%"$ch"*} + ch=${_ble_util_string_lower_list:${#ch}:1} + elif ble/string#islower "$ch"; then + ch=${_ble_util_string_lower_list%%"$ch"*} + ch=${_ble_util_string_upper_list:${#ch}:1} + fi + ble/array#push buff "$ch" + done + IFS= builtin eval 'ret="${buff[*]-}"' +} +if ((_ble_bash>=40000)); then + function ble/string#tolower { ret=${1,,}; } + function ble/string#toupper { ret=${1^^}; } +else + function ble/string#tolower { + local i text=$1 ch + local -a buff=() + for ((i=0;i<${#text};i++)); do + ch=${text:i:1} + if ble/string#isupper "$ch"; then + ch=${_ble_util_string_upper_list%%"$ch"*} + ch=${_ble_util_string_lower_list:${#ch}:1} + fi + ble/array#push buff "$ch" + done + IFS= builtin eval 'ret="${buff[*]-}"' + } + function ble/string#toupper { + local i text=$1 ch + local -a buff=() + for ((i=0;i<${#text};i++)); do + ch=${text:i:1} + if ble/string#islower "$ch"; then + ch=${_ble_util_string_lower_list%%"$ch"*} + ch=${_ble_util_string_upper_list:${#ch}:1} + fi + ble/array#push buff "$ch" + done + IFS= builtin eval 'ret="${buff[*]-}"' + } +fi +function ble/string#capitalize { + local tail=$1 + local rex='^[^a-zA-Z0-9]*' + [[ $tail =~ $rex ]] + local out=$BASH_REMATCH + tail=${tail:${#BASH_REMATCH}} + rex='^[a-zA-Z0-9]+[^a-zA-Z0-9]*' + while [[ $tail =~ $rex ]]; do + local rematch=$BASH_REMATCH + ble/string#toupper "${rematch::1}"; out=$out$ret + ble/string#tolower "${rematch:1}" ; out=$out$ret + tail=${tail:${#rematch}} + done + ret=$out$tail +} +function ble/string#trim { + ret=$1 + local rex=$'^[ \t\n]+' + [[ $ret =~ $rex ]] && ret=${ret:${#BASH_REMATCH}} + local rex=$'[ \t\n]+$' + [[ $ret =~ $rex ]] && ret=${ret::${#ret}-${#BASH_REMATCH}} +} +function ble/string#ltrim { + ret=$1 + local rex=$'^[ \t\n]+' + [[ $ret =~ $rex ]] && ret=${ret:${#BASH_REMATCH}} +} +function ble/string#rtrim { + ret=$1 + local rex=$'[ \t\n]+$' + [[ $ret =~ $rex ]] && ret=${ret::${#ret}-${#BASH_REMATCH}} +} +if ((_ble_bash>=50200)); then + function ble/string#escape-characters { + ret=$1 + if [[ $ret == *["$2"]* ]]; then + if [[ ! $3 ]]; then + local patsub_replacement= + shopt -q patsub_replacement && patsub_replacement=1 + shopt -s patsub_replacement + ret=${ret//["$2"]/\\&} # #D1738 patsub_replacement + [[ $patsub_replacement ]] || shopt -u patsub_replacement + else + local chars1=$2 chars2=${3:-$2} + local i n=${#chars1} a b + for ((i=0;i()!^' + [[ $2 != *G* ]] && chars=$chars'*?[' + [[ $2 == *c* ]] && chars=$chars'=:' + [[ $2 == *b* ]] && chars=$chars'{,}' + ble/string#escape-characters "$1" "$chars" + [[ $2 != *[HT]* && $ret == '~'* ]] && ret=\\$ret + [[ $2 != *H* && $ret == '#'* ]] && ret=\\$ret + if [[ $ret == *[$']\n\t']* ]]; then + local a b + a=']' b=\\$a ret=${ret//"$a"/"$b"} + a=$'\n' b="\$'\n'" ret=${ret//"$a"/"$b"} # WA #D1751 checked + a=$'\t' b=$'\\\t' ret=${ret//"$a"/"$b"} + fi + if [[ $2 == *G* ]] && shopt -q extglob; then + local a b + a='!\(' b='!(' ret=${ret//"$a"/"$b"} + a='@\(' b='@(' ret=${ret//"$a"/"$b"} + a='?\(' b='?(' ret=${ret//"$a"/"$b"} + a='*\(' b='*(' ret=${ret//"$a"/"$b"} + a='+\(' b='+(' ret=${ret//"$a"/"$b"} + fi +} +function ble/string#escape-for-display { + local head= tail=$1 opts=$2 + local sgr0= sgr1= + local rex_csi=$'\e\\[[ -?]*[@-~]' # disable=#D1440 (LC_COLLATE=C is set) + if [[ :$opts: == *:revert:* ]]; then + ble/color/g2sgr "$_ble_color_gflags_Revert" + sgr1=$ret sgr0=$_ble_term_sgr0 + else + if ble/string#match-safe ":$opts:" ":sgr1=(($rex_csi|[^:])*):"; then + sgr1=${BASH_REMATCH[1]} sgr0=$_ble_term_sgr0 + fi + if ble/string#match-safe ":$opts:" ":sgr0=(($rex_csi|[^:])*):"; then + sgr0=${BASH_REMATCH[1]} + fi + fi + while [[ $tail ]]; do + if ble/util/isprint+ "$tail"; then + head=$head$BASH_REMATCH + tail=${tail:${#BASH_REMATCH}} + else + ble/util/s2c "${tail::1}"; local code=$ret + if ble/unicode/GraphemeCluster/ControlRepresentation "$ret"; then + ret=$sgr1$ret$sgr0 + else + ret=${tail::1} + fi + head=$head$ret + tail=${tail:1} + fi + done + ret=$head +} +if ((_ble_bash>=40400)); then + function ble/string#quote-words { + local IFS=$_ble_term_IFS + ret="${*@Q}" + } + function ble/string#quote-command { + local IFS=$_ble_term_IFS + ret=$1; shift + (($#)) && ret="$ret ${*@Q}" + } +else + function ble/string#quote-words { + local q=\' Q="'\''" IFS=$_ble_term_IFS + if (($#==1)); then + ret=("${1//$q/$Q}") # WA for #D2352 + ret=("${ret[0]/%/$q}") # WA for #D2352 (disable=#D1738) + else + ret=("${@//$q/$Q}") # disable=#D2352 + ret=("${ret[@]/%/$q}") # disable=#D1570,#D1738,#D2352 + fi + ret="${ret[*]/#/$q}" # disable=#D1570,#D1738 + } + function ble/string#quote-command { + if (($#<=1)); then + ret=$1 + return 0 + fi + local q=\' Q="'\''" IFS=$_ble_term_IFS + ret=("${@:2}") + ret=("${ret[@]//$q/$Q}") # disable=#D1570,#D1738,#D2352 + ret=("${ret[@]/%/$q}") # disable=#D1570,#D1738,#D2352 + ret="$1 ${ret[*]/#/$q}" # disable=#D1570,#D1738 + } +fi +function ble/string#quote-word { + ret=${1-} + local opts=${2-} sgrq= sgre= sgrq0= sgre0= + if [[ $opts ]]; then + local rex_csi=$'\e\\[[ -?]*[@-~]' # disable=#D1440 (LC_COLLATE is set) + local sgr0 + if ble/string#match-safe ":$opts:" ":sgr0=(($rex_csi|[^:])*):"; then + sgr0=${BASH_REMATCH[1]} + elif [[ :$opts: == *:ansi:* ]]; then + sgr0=$'\e[m' + else + sgr0=$_ble_term_sgr0 + fi + if ble/string#match-safe ":$opts:" ":sgrq=(($rex_csi|[^:])*):"; then + sgrq=${BASH_REMATCH[1]} sgrq0=$sgr0 + fi + if ble/string#match-safe ":$opts:" ":sgre=(($rex_csi|[^:])*):"; then + sgre=${BASH_REMATCH[1]} sgre0=$sgr0 + fi + fi + if [[ ! $ret ]]; then + if [[ :$opts: == *:quote-empty:* ]]; then + ret=$sgrq\'\'$sgrq0 + fi + return 0 + fi + local chars=$'\a\b\e\f\n\r\t\v\001-\037\177' + if [[ $ret == *[$chars]* ]]; then + ble/string#escape-for-bash-escape-string "$ret" + ret=$sgrq\$\'$ret\'$sgrq0 + return 0 + fi + local chars=$_ble_term_IFS'"`$\<>()|&;*?[]!^=:{,}#~' q=\' + if [[ $ret == *["$chars"]* ]]; then + local Q="'$sgrq0$sgre\'$sgre0$sgrq'" + ret=$sgrq$q${ret//$q/$Q}$q$sgrq0 + ret=${ret#"$sgrq$q$q$sgrq0"} ret=${ret%"$sgrq$q$q$sgrq0"} + elif [[ $ret == *["$q"]* ]]; then + local Q="$sgre\'$sgre0" + ret=${ret//$q/$Q} + fi +} +function ble/string#match { [[ $1 =~ $2 ]]; } +function ble/string#match-safe/.impl { + local LC_ALL= LC_COLLATE=C + [[ $1 =~ $2 ]] +} +function ble/string#match-safe { + ble/string#match-safe/.impl "$@" 2>/dev/null # suppress locale error #D1440 +} +function ble/string#create-unicode-progress-bar/.block { + local block=$1 + if ((block<=0)); then + ble/util/c2w "$((0x2588))" + ble/string#repeat ' ' "$ret" + elif ((block>=8)); then + ble/util/c2s "$((0x2588))" + ((${#ret}==1)) || ret='*' # LC_CTYPE が非対応の文字の時 + else + ble/util/c2s "$((0x2590-block))" + if ((${#ret}!=1)); then + ble/util/c2w "$((0x2588))" + ble/string#repeat ' ' "$((ret-1))" + ret=$block$ret + fi + fi +} +function ble/string#create-unicode-progress-bar { + local value=$1 max=$2 width=$3 opts=:$4: + local opt_unlimited= + if [[ $opts == *:unlimited:* ]]; then + opt_unlimited=1 + ((value%=max,width--)) + fi + local progress=$((value*8*width/max)) + local progress_fraction=$((progress%8)) progress_integral=$((progress/8)) + local out= + if ((progress_integral)); then + if [[ $opt_unlimited ]]; then + ble/string#create-unicode-progress-bar/.block 0 + else + ble/string#create-unicode-progress-bar/.block 8 + fi + ble/string#repeat "$ret" "$progress_integral" + out=$ret + fi + if ((progress_fraction)); then + if [[ $opt_unlimited ]]; then + ble/string#create-unicode-progress-bar/.block "$progress_fraction" + out=$out$'\e[7m'$ret$'\e[27m' + fi + ble/string#create-unicode-progress-bar/.block "$progress_fraction" + out=$out$ret + ((progress_integral++)) + else + if [[ $opt_unlimited ]]; then + ble/string#create-unicode-progress-bar/.block 8 + out=$out$ret + fi + fi + if ((progress_integral/dev/null # suppress locale error #D1440 +} +function ble/util/substr.impl { + local LC_ALL= LC_CTYPE=C + ret=${1:$2:$3} +} +function ble/util/substr { + ble/util/substr.impl "$@" 2>/dev/null # suppress locale error #D1440 +} +function ble/path#append { + local _ble_local_script='opts=$opts${opts:+:}$2' + _ble_local_script=${_ble_local_script//opts/"$1"} + builtin eval -- "$_ble_local_script" +} +function ble/path#prepend { + local _ble_local_script='opts=$2${opts:+:}$opts' + _ble_local_script=${_ble_local_script//opts/"$1"} + builtin eval -- "$_ble_local_script" +} +function ble/path#remove { + [[ $2 ]] || return 1 + local _ble_local_script=' + opts=:${opts//:/::}: + opts=${opts//:"$2":} + opts=${opts//::/:} opts=${opts#:} opts=${opts%:}' + _ble_local_script=${_ble_local_script//opts/"$1"} + if shopt -q nocasematch 2>/dev/null; then + shopt -u nocasematch + _ble_local_script=$_ble_local_script';shopt -s nocasematch' + fi + builtin eval -- "$_ble_local_script" +} +function ble/path#remove-glob/.impl { + local IFS=: nocasematch= + if shopt -q nocasematch 2>/dev/null; then + shopt -u nocasematch + nocasematch=1 + fi + local str=$1 pat=$2 paths i + ble/string#split paths : "$str" + for i in "${!paths[@]}"; do + if [[ ${paths[i]} == $pat ]]; then + builtin unset -v 'paths[i]' + fi + done + ret="${paths[*]}" + if [[ $nocasematch ]]; then + shopt -s nocasematch + fi +} +function ble/path#remove-glob { + [[ $2 ]] || return 1 + [[ $1 == ret ]] || local ret + IFS=: ble/path#remove-glob/.impl "${!1}" "$2" + [[ $1 == ret ]] || builtin eval -- "$1=\$ret" +} +function ble/path#contains { + builtin eval "[[ :\${$1}: == *:\"\$2\":* ]]" +} +function ble/opts#has { + local rex=':'$2'[=:]' + [[ :$1: =~ $rex ]] +} +function ble/opts#remove { + ble/path#remove "$@" +} +function ble/opts#append { + ble/util/set "$1" "${!1:+${!1}:}$2" +} +function ble/opts#append-unique { + [[ :${!1}: == *:"$2":* ]] || ble/opts#append "$1" "$2" +} +function ble/opts#extract-first-optarg { + ret= + local rex=':'$2'(=[^:]*)?:' + [[ :$1: =~ $rex ]] || return 1 + if [[ ${BASH_REMATCH[1]} ]]; then + ret=${BASH_REMATCH[1]:1} + elif [[ ${3+set} ]]; then + ret=$3 + fi + return 0 +} +function ble/opts#extract-last-optarg { + ret= + local rex='.*:'$2'(=[^:]*)?:' + [[ :$1: =~ $rex ]] || return 1 + if [[ ${BASH_REMATCH[1]} ]]; then + ret=${BASH_REMATCH[1]:1} + elif [[ ${3+set} ]]; then + ret=$3 + fi + return 0 +} +function ble/opts#extract-all-optargs { + ret=() + local value=:$1: rex=':'$2'(=[^:]*)?(:.*)$' count=0 + while [[ $value =~ $rex ]]; do + ((count++)) + if [[ ${BASH_REMATCH[1]} ]]; then + ble/array#push ret "${BASH_REMATCH[1]:1}" + elif [[ ${3+set} ]]; then + ble/array#push ret "$3" + fi + value=${BASH_REMATCH[2]} + done + ((count)) +} +if ((_ble_bash>=40000)); then + _ble_util_set_declare=(declare -A NAME) + function ble/set#add { builtin eval -- "$1[x\$2]=1"; } + function ble/set#remove { builtin unset -v "$1[x\$2]"; } + function ble/set#contains { builtin eval "[[ \${$1[x\$2]+set} ]]"; } +else + _ble_util_set_declare=(declare NAME) + function ble/set#.escape { + _ble_local_value=${_ble_local_value//$_ble_term_FS/"$_ble_term_FS$_ble_term_FS"} + _ble_local_value=${_ble_local_value//:/"$_ble_term_FS."} + } + function ble/set#add { + local _ble_local_value=$2; ble/set#.escape + ble/path#append "$1" "$_ble_local_value" + } + function ble/set#remove { + local _ble_local_value=$2; ble/set#.escape + ble/path#remove "$1" "$_ble_local_value" + } + function ble/set#contains { + local _ble_local_value=$2; ble/set#.escape + builtin eval "[[ :\$$1: == *:\"\$_ble_local_value\":* ]]" + } +fi +_ble_util_adict_declare='declare NAME NAME_keylist' +function ble/adict#.resolve { + _ble_local_key=$2 + _ble_local_key=${_ble_local_key//$_ble_term_FS/"$_ble_term_FS,"} + _ble_local_key=${_ble_local_key//:/"$_ble_term_FS."} + local keylist=${1}_keylist; keylist=:${!keylist} + local vec=${keylist%%:"$_ble_local_key":*} + if [[ $vec != "$keylist" ]]; then + vec=${vec//[!:]} + _ble_local_index=${#vec} + else + _ble_local_index=-1 + fi +} +function ble/adict#set { + local _ble_local_key _ble_local_index + ble/adict#.resolve "$1" "$2" + if ((_ble_local_index>=0)); then + builtin eval -- "$1[_ble_local_index]=\$3" + else + local _ble_local_script=' + local _ble_local_vec=${NAME_keylist//[!:]} + NAME[${#_ble_local_vec}]=$3 + NAME_keylist=$NAME_keylist$_ble_local_key: + ' + builtin eval -- "${_ble_local_script//NAME/$1}" + fi + return 0 +} +function ble/adict#get { + local _ble_local_key _ble_local_index + ble/adict#.resolve "$1" "$2" + if ((_ble_local_index>=0)); then + builtin eval -- "ret=\${$1[_ble_local_index]}; [[ \${$1[_ble_local_index]+set} ]]" + else + builtin eval -- ret= + return 1 + fi +} +function ble/adict#unset { + local _ble_local_key _ble_local_index + ble/adict#.resolve "$1" "$2" + ((_ble_local_index>=0)) && + builtin eval -- "builtin unset -v '$1[_ble_local_index]'" + return 0 +} +function ble/adict#has { + local _ble_local_key _ble_local_index + ble/adict#.resolve "$1" "$2" + ((_ble_local_index>=0)) && + builtin eval -- "[[ \${$1[_ble_local_index]+set} ]]" +} +function ble/adict#clear { + builtin eval -- "${1}_keylist= $1=()" +} +function ble/adict#keys { + local _ble_local_keylist=${1}_keylist + _ble_local_keylist=${!_ble_local_keylist%:} + ble/string#split ret : "$_ble_local_keylist" + if [[ $_ble_local_keylist == *"$_ble_term_FS"* ]]; then + if ((40200<=_ble_bash&&_ble_bash<40300&&${#ret[@]}==1)); then + ret=("${ret[0]//$_ble_term_FS./:}") # WA for #D2352 + ret=("${ret[0]//$_ble_term_FS,/$_ble_term_FS}") # WA for #D2352 (disable=#D1738) + else + ret=("${ret[@]//$_ble_term_FS./:}") # disable=#D1570,#D2352 + ret=("${ret[@]//$_ble_term_FS,/$_ble_term_FS}") # disable=#D1570,#D1738,#D2352 + fi + fi + local _ble_local_keys _ble_local_i _ble_local_ref=$1[_ble_local_i] + _ble_local_keys=("${ret[@]}") ret=() + for _ble_local_i in "${!_ble_local_keys[@]}"; do + [[ ${_ble_local_ref+set} ]] && + ble/array#push ret "${_ble_local_keys[_ble_local_i]}" + done +} +if ((_ble_bash>=40000)); then + _ble_util_dict_declare='declare -A NAME' + function ble/dict#set { builtin eval -- "$1[x\$2]=\$3"; } + function ble/dict#get { builtin eval -- "ret=\${$1[x\$2]-}; [[ \${$1[x\$2]+set} ]]"; } + function ble/dict#unset { builtin eval -- "builtin unset -v '$1[x\$2]'"; } + function ble/dict#has { builtin eval -- "[[ \${$1[x\$2]+set} ]]"; } + function ble/dict#clear { builtin eval -- "$1=()"; } + if ((40200<=_ble_bash&&_ble_bash<50200)); then + function ble/dict#keys { + builtin eval -- 'ret=("${!'"$1"'[@]}")' + if ((${#ret[@]}==1)); then + ret[0]=${ret[0]#x} # WA for #D2352 + else + ret=("${ret[@]#x}") # disable=#D2352 + fi + } + else + function ble/dict#keys { builtin eval -- 'ret=("${!'"$1"'[@]}"); ret=("${ret[@]#x}")'; } # disable=#D2352 + fi +else + _ble_util_dict_declare='declare NAME NAME_keylist=' + function ble/dict#set { ble/adict#set "$@"; } + function ble/dict#get { ble/adict#get "$@"; } + function ble/dict#unset { ble/adict#unset "$@"; } + function ble/dict#has { ble/adict#has "$@"; } + function ble/dict#clear { ble/adict#clear "$@"; } + function ble/dict#keys { ble/adict#keys "$@"; } +fi +if ((_ble_bash>=40200)); then + _ble_util_gdict_declare='{ builtin unset -v NAME; declare -gA NAME; NAME=(); }' + function ble/gdict#set { ble/dict#set "$@"; } + function ble/gdict#get { ble/dict#get "$@"; } + function ble/gdict#unset { ble/dict#unset "$@"; } + function ble/gdict#has { ble/dict#has "$@"; } + function ble/gdict#clear { ble/dict#clear "$@"; } + function ble/gdict#keys { ble/dict#keys "$@"; } +elif ((_ble_bash>=40000)); then + _ble_util_gdict_declare='{ if ! ble/is-assoc NAME; then if local _ble_local_test 2>/dev/null; then NAME_keylist=; else builtin unset -v NAME NAME_keylist; declare -A NAME; fi fi; NAME=(); }' + function ble/gdict#.is-adict { + local keylist=${1}_keylist + [[ ${!keylist+set} ]] + } + function ble/gdict#set { if ble/gdict#.is-adict "$1"; then ble/adict#set "$@"; else ble/dict#set "$@"; fi; } + function ble/gdict#get { if ble/gdict#.is-adict "$1"; then ble/adict#get "$@"; else ble/dict#get "$@"; fi; } + function ble/gdict#unset { if ble/gdict#.is-adict "$1"; then ble/adict#unset "$@"; else ble/dict#unset "$@"; fi; } + function ble/gdict#has { if ble/gdict#.is-adict "$1"; then ble/adict#has "$@"; else ble/dict#has "$@"; fi; } + function ble/gdict#clear { if ble/gdict#.is-adict "$1"; then ble/adict#clear "$@"; else ble/dict#clear "$@"; fi; } + function ble/gdict#keys { if ble/gdict#.is-adict "$1"; then ble/adict#keys "$@"; else ble/dict#keys "$@"; fi; } +else + _ble_util_gdict_declare='{ builtin unset -v NAME NAME_keylist; NAME_keylist= NAME=(); }' + function ble/gdict#set { ble/adict#set "$@"; } + function ble/gdict#get { ble/adict#get "$@"; } + function ble/gdict#unset { ble/adict#unset "$@"; } + function ble/gdict#has { ble/adict#has "$@"; } + function ble/gdict#clear { ble/adict#clear "$@"; } + function ble/gdict#keys { ble/adict#keys "$@"; } +fi +function ble/dict/.print { + declare -p "$2" &>/dev/null || return 1 + local ret _ble_local_key _ble_local_value + ble/util/print "builtin eval -- \"\${_ble_util_${1}_declare//NAME/$2}\"" + ble/"$1"#keys "$2" + for _ble_local_key in "${ret[@]}"; do + ble/"$1"#get "$2" "$_ble_local_key" + ble/string#quote-word "$ret" quote-empty + _ble_local_value=$ret + ble/string#quote-word "$_ble_local_key" quote-empty + _ble_local_key=$ret + ble/util/print "ble/$1#set $2 $_ble_local_key $_ble_local_value" + done +} +function ble/dict#print { ble/dict/.print dict "$1"; } +function ble/adict#print { ble/dict/.print adict "$1"; } +function ble/gdict#print { ble/dict/.print gdict "$1"; } +function ble/dict/.copy { + local ret + ble/"$1"#keys "$2" + ble/"$1"#clear "$3" + local _ble_local_key + for _ble_local_key in "${ret[@]}"; do + ble/"$1"#get "$2" "$_ble_local_key" + ble/"$1"#set "$3" "$_ble_local_key" "$ret" + done +} +function ble/dict#cp { ble/dict/.copy dict "$1" "$2"; } +function ble/adict#cp { ble/dict/.copy adict "$1" "$2"; } +function ble/gdict#cp { ble/dict/.copy gdict "$1" "$2"; } +if ((_ble_bash>=40000)); then + function ble/util/readfile { # 155ms for man bash + local -a _ble_local_buffer=() + mapfile _ble_local_buffer < "$2"; local _ble_local_ext=$? + IFS= builtin eval "$1=\"\${_ble_local_buffer[*]-}\"" + return "$_ble_local_ext" + } + function ble/util/mapfile { + mapfile -t "$1" + } +else + function ble/util/readfile { # 465ms for man bash + [[ -r $2 && ! -d $2 ]] || return 1 + local IFS= + ble/bash/read -d '' "$1" < "$2" + return 0 + } + function ble/util/mapfile { + local IFS= + local _ble_local_i=0 _ble_local_val _ble_local_arr; _ble_local_arr=() + while ble/bash/read _ble_local_val || [[ $_ble_local_val ]]; do + _ble_local_arr[_ble_local_i++]=$_ble_local_val + done + builtin eval "$1=(\"\${_ble_local_arr[@]}\")" + } +fi +function ble/util/copyfile { + local src=$1 dst=$2 content + ble/util/readfile content "$1" || return "$?" + ble/util/put "$content" >| "$dst" +} +function ble/util/writearray/.read-arguments { + _ble_local_array= + _ble_local_nlfix= + _ble_local_delim=$'\n' + local flags= + while (($#)); do + local arg=$1; shift + if [[ $flags != *-* && $arg == -* ]]; then + case $arg in + (--nlfix) _ble_local_nlfix=1 ;; + (-d) + if (($#)); then + _ble_local_delim=$1; shift + else + ble/util/print "${FUNCNAME[1]}: '$arg': missing option argument." >&2 + flags=E$flags + fi ;; + (--) flags=-$flags ;; + (*) + ble/util/print "${FUNCNAME[1]}: '$arg': unrecognized option." >&2 + flags=E$flags ;; + esac + else + if local rex='^[_a-zA-Z][_a-zA-Z0-9]*$'; ! [[ $arg =~ $rex ]]; then + ble/util/print "${FUNCNAME[1]}: '$arg': invalid array name." >&2 + flags=E$flags + elif [[ $flags == *A* ]]; then + ble/util/print "${FUNCNAME[1]}: '$arg': an array name has been already specified." >&2 + flags=E$flags + else + _ble_local_array=$arg + flags=A$flags + fi + fi + done + [[ $_ble_local_nlfix ]] && _ble_local_delim=$'\n' + [[ $flags != *E* ]] +} +_ble_bin_awk_libES=' + function s2i_initialize(_, i) { + for (i = 0; i < 16; i++) + xdigit2int[sprintf("%x", i)] = i; + for (i = 10; i < 16; i++) + xdigit2int[sprintf("%X", i)] = i; + } + function s2i(s, base, _, i, n, r) { + if (!base) base = 10; + r = 0; + n = length(s); + for (i = 1; i <= n; i++) + r = r * base + xdigit2int[substr(s, i, 1)]; + return r; + } + function c2s_initialize(_, i, n, buff) { + if (sprintf("%c", 945) == "α") { + C2S_UNICODE_PRINTF_C = 1; + n = split(ENVIRON["__ble_rawbytes"], buff); + for (i = 1; i <= n; i++) + c2s_byte2raw[127 + i] = buff[i]; + } else { + C2S_UNICODE_PRINTF_C = 0; + for (i = 1; i <= 255; i++) + c2s_byte2char[i] = sprintf("%c", i); + } + } + function c2s(code, _, leadbyte_mark, leadbyte_sup, tail) { + if (C2S_UNICODE_PRINTF_C) + return sprintf("%c", code); + leadbyte_sup = 128; # 0x80 + leadbyte_mark = 0; + tail = ""; + while (leadbyte_sup && code >= leadbyte_sup) { + leadbyte_sup /= 2; + leadbyte_mark = leadbyte_mark ? leadbyte_mark / 2 : 65472; # 0xFFC0 + tail = c2s_byte2char[128 + int(code % 64)] tail; + code = int(code / 64); + } + return c2s_byte2char[(leadbyte_mark + code) % 256] tail; + } + function c2s_raw(code, _, ret) { + if (code >= 128 && C2S_UNICODE_PRINTF_C) { + ret = c2s_byte2raw[code]; + if (ret != "") return ret; + } + return sprintf("%c", code); + } + function es_initialize(_, c) { + s2i_initialize(); + c2s_initialize(); + es_control_chars["a"] = "\a"; + es_control_chars["b"] = "\b"; + es_control_chars["t"] = "\t"; + es_control_chars["n"] = "\n"; + es_control_chars["v"] = "\v"; + es_control_chars["f"] = "\f"; + es_control_chars["r"] = "\r"; + es_control_chars["e"] = "\033"; + es_control_chars["E"] = "\033"; + es_control_chars["?"] = "?"; + es_control_chars["'\''"] = "'\''"; + es_control_chars["\""] = "\""; + es_control_chars["\\"] = "\\"; + for (c = 32; c < 127; c++) + es_s2c[sprintf("%c", c)] = c; + } + function es_unescape(s, _, head, c) { + head = ""; + while (match(s, /^[^\\]*\\/)) { + head = head substr(s, 1, RLENGTH - 1); + s = substr(s, RLENGTH + 1); + if ((c = es_control_chars[substr(s, 1, 1)])) { + head = head c; + s = substr(s, 2); + } else if (match(s, /^[0-9]([0-9][0-9]?)?/)) { + head = head c2s_raw(s2i(substr(s, 1, RLENGTH), 8) % 256); + s = substr(s, RLENGTH + 1); + } else if (match(s, /^x[0-9a-fA-F][0-9a-fA-F]?/)) { + head = head c2s_raw(s2i(substr(s, 2, RLENGTH - 1), 16)); + s = substr(s, RLENGTH + 1); + } else if (match(s, /^U[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]([0-9a-fA-F]([0-9a-fA-F][0-9a-fA-F]?)?)?/)) { + head = head c2s(s2i(substr(s, 2, RLENGTH - 1), 16)); + s = substr(s, RLENGTH + 1); + } else if (match(s, /^[uU][0-9a-fA-F]([0-9a-fA-F]([0-9a-fA-F][0-9a-fA-F]?)?)?/)) { + head = head c2s(s2i(substr(s, 2, RLENGTH - 1), 16)); + s = substr(s, RLENGTH + 1); + } else if (match(s, /^c[ -~]/)) { # disable=#D1440 (caller is checked) + c = es_s2c[substr(s, 2, 1)]; + head = head c2s(_ble_bash >= 40400 && c == 63 ? 127 : c % 32); + s = substr(s, 3); + } else { + head = head "\\"; + } + } + return head s; + } +' +_ble_bin_awk_libNLFIX=' + function nlfix_escape(str) { + gsub(/\\/, nlfix_rep_double_slash, str); + gsub(/'\''/, nlfix_rep_slash "'\''", str); + gsub(/\007/, nlfix_rep_slash "a", str); + gsub(/\010/, nlfix_rep_slash "b", str); + gsub(/\011/, nlfix_rep_slash "t", str); + gsub(/\012/, nlfix_rep_slash "n", str); + gsub(/\013/, nlfix_rep_slash "v", str); + gsub(/\014/, nlfix_rep_slash "f", str); + gsub(/\015/, nlfix_rep_slash "r", str); + return "$'\''" str "'\''"; + } + function nlfix_unescape(str) { + if (str !~ /^\$'\''.*'\''$/) return str; + str = substr(str, 3, length(str) - 3); + gsub(/\\'\''/, "'\''", str); + gsub(/\\a/, "\007", str); + gsub(/\\b/, "\010", str); + gsub(/\\t/, "\011", str); + gsub(/\\n/, "\012", str); + gsub(/\\v/, "\013", str); + gsub(/\\f/, "\014", str); + gsub(/\\r/, "\015", str); + gsub(/\\\\/, nlfix_rep_slash, str); + return str; + } + function nlfix_put(s) { + if (file) + printf("%s", s) > file; + else + printf("%s", s); + } + function nlfix_begin(_, tmp) { + nlfix_rep_slash = "\\"; + if (AWKTYPE == "xpg4") nlfix_rep_slash = "\\\\"; + nlfix_rep_double_slash = "\\\\"; + sub(/.*/, nlfix_rep_double_slash, tmp); + if (tmp == "\\") nlfix_rep_double_slash = "\\\\\\\\"; + nlfix_indices = ""; + nlfix_index = 0; + } + function nlfix_push(elem, file) { + if (elem ~ /\n/) { + nlfix_put(nlfix_escape(elem) "\n"); + nlfix_indices = nlfix_indices != "" ? nlfix_indices " " nlfix_index : nlfix_index; + } else { + nlfix_put(elem "\n"); + } + nlfix_index++; + } + function nlfix_end(file) { + nlfix_put(nlfix_indices "\n"); + } +' +_ble_util_writearray_rawbytes= +function ble/util/writearray { + local _ble_local_array + local -x _ble_local_nlfix _ble_local_delim + ble/util/writearray/.read-arguments "$@" || return 2 + local __ble_awk=ble/bin/awk __ble_awktype=$_ble_bin_awk_type + if ble/is-function ble/bin/mawk; then + __ble_awk=ble/bin/mawk __ble_awktype=mawk + elif ble/is-function ble/bin/nawk; then + __ble_awk=ble/bin/nawk __ble_awktype=nawk + fi + if ((!_ble_local_nlfix)) && ! [[ _ble_bash -ge 50200 && $__ble_awktype == [mn]awk ]]; then + if [[ $_ble_local_delim ]]; then + if [[ $_ble_local_delim == *["%\'"]* ]]; then + local __ble_q=\' __ble_Q="'\''" + _ble_local_delim=${_ble_local_delim//'%'/'%%'} + _ble_local_delim=${_ble_local_delim//'\'/'\\'} + _ble_local_delim=${_ble_local_delim//$__ble_q/$__ble_Q} + fi + builtin eval "printf '%s$_ble_local_delim' \"\${$_ble_local_array[@]}\"" + else + builtin eval "printf '%s\0' \"\${$_ble_local_array[@]}\"" + fi + return "$?" + fi + local __ble_function_gensub_dummy= + [[ $__ble_awktype == gawk ]] || + __ble_function_gensub_dummy='function gensub(rex, rep, n, str) { exit 3; }' + if [[ ! $_ble_util_writearray_rawbytes ]]; then + local IFS=$_ble_term_IFS __ble_tmp; __ble_tmp=('\'{2,3}{0..7}{0..7}) + builtin eval "local _ble_util_writearray_rawbytes=\$'${__ble_tmp[*]}'" + fi + local -x __ble_rawbytes=$_ble_util_writearray_rawbytes + local __ble_rex_dq='^"([^\\"]|\\.)*"' + local __ble_rex_es='^\$'\''([^\\'\'']|\\.)*'\''' + local __ble_rex_sq='^'\''([^'\'']|'\'\\\\\'\'')*'\''' + local __ble_rex_normal=$'^[^'$_ble_term_blank'$`"'\''()|&;<>\\]' # Note: []{}?*#!~^, @(), +() は quote されていなくても OK とする + declare -p "$_ble_local_array" | "$__ble_awk" -v _ble_bash="$_ble_bash" ' + '"$__ble_function_gensub_dummy"' + BEGIN { + DELIM = ENVIRON["_ble_local_delim"]; + FLAG_NLFIX = ENVIRON["_ble_local_nlfix"]; + if (FLAG_NLFIX) DELIM = "\n"; + IS_GAWK = AWKTYPE == "gawk"; + IS_XPG4 = AWKTYPE == "xpg4"; + REP_SL = "\\"; + if (IS_XPG4) REP_SL = "\\\\"; + es_initialize(); + decl = ""; + } + '"$_ble_bin_awk_libES"' + '"$_ble_bin_awk_libNLFIX"' + function str2rep(str) { + if (IS_XPG4) sub(/\\/, "\\\\\\\\", str); + return str; + } + function unquote_dq(s, _, head) { + if (IS_GAWK) { + return gensub(/\\([$`"\\])/, "\\1", "g", s); + } else { + if (s ~ /\\[$`"\\]/) { + gsub(/\\\$/, "$" , s); + gsub(/\\`/ , "`" , s); + gsub(/\\"/ , "\"", s); + gsub(/\\\\/, "\\", s); + } + return s; + } + } + function unquote_sq(s) { + gsub(/'\'\\\\\'\''/, "'\''", s); + return s; + } + function unquote_dqes(s) { + if (s ~ /^"/) + return unquote_dq(substr(s, 2, length(s) - 2)); + else + return es_unescape(substr(s, 3, length(s) - 3)); # disable=#D1440 (\c? is unused) + } + function unquote(s) { + if (s ~ /^"/) + return unquote_dq(substr(s, 2, length(s) - 2)); + else if (s ~ /^\$/) + return es_unescape(substr(s, 3, length(s) - 3)); # disable=#D1440 (\c? is unused) + else if (s ~ /^'\''/) + return unquote_sq(substr(s, 2, length(s) - 2)); + else if (s ~ /^\\/) + return substr(s, 2, 1); + else + return s; + } + function analyze_elements_dq(decl, _, arr, i, n) { + if (decl ~ /^\[[0-9]+\]="([^'$'\1\2''"\n\\]|\\.)*"( \[[0-9]+\]="([^\1\2"\\]|\\.)*")*$/) { + if (IS_GAWK) { + decl = gensub(/\[[0-9]+\]="(([^"\\]|\\.)*)" ?/, "\\1\001", "g", decl); + sub(/\001$/, "", decl); + decl = gensub(/\\([\\$"`])/, "\\1", "g", decl); + } else { + gsub(/\[[0-9]+\]="([^"\\]|\\.)*" /, "&\001", decl); + gsub(/" \001\[[0-9]+\]="/, "\001", decl); + sub(/^\[[0-9]+\]="/, "", decl); + sub(/"$/, "", decl); + gsub(/\\\\/, "\002", decl); + gsub(/\\\$/, "$", decl); + gsub(/\\"/, "\"", decl); + gsub(/\\`/, "`", decl); + gsub(/\002/, REP_SL, decl); + } + if (DELIM != "") { + gsub(/\001/, str2rep(DELIM), decl); + printf("%s", decl DELIM); + } else { + n = split(decl, arr, /\001/); + for (i = 1; i <= n; i++) + printf("%s%c", arr[i], 0); + } + if (FLAG_NLFIX) printf("\n"); + return 1; + } + return 0; + } + function _process_elem(elem) { + if (FLAG_NLFIX) { + nlfix_push(elem); + } else if (DELIM != "") { + printf("%s", elem DELIM); + } else { + printf("%s%c", elem, 0); + } + } + function analyze_elements_general(decl, _, arr, i, n, str, elem, m) { + if (FLAG_NLFIX) + nlfix_begin(); + n = split(decl, arr, /\]=/); + str = " " arr[1]; + elem = ""; + first = 1; + for (i = 2; i <= n; i++) { + str = str "]=" arr[i]; + if (sub(/^ \[[0-9]+\]=/, "", str)) { + if (first) + first = 0; + else + _process_elem(elem); + elem = ""; + } + if (match(str, /('"$__ble_rex_dq"'|'"$__ble_rex_es"') /)) { + mlen = RLENGTH; + elem = elem unquote_dqes(substr(str, 1, mlen - 1)); + str = substr(str, mlen); + continue; + } else if (i == n || str !~ /^[\$"]/) { + while (match(str, /'"$__ble_rex_dq"'|'"$__ble_rex_es"'|'"$__ble_rex_sq"'|'"$__ble_rex_normal"'|^\\./)) { + mlen = RLENGTH; + elem = elem unquote(substr(str, 1, mlen)); + str = substr(str, mlen + 1); + } + } + } + _process_elem(elem); + if (FLAG_NLFIX) + nlfix_end(); + return 1; + } + function process_declaration(decl) { + sub(/^declare +(-[-aAilucnrtxfFgGI]+ +)?(-- +)?/, "", decl); + if (decl ~ /^([_a-zA-Z][_a-zA-Z0-9]*)='\''\(.*\)'\''$/) { + sub(/(=)'\''\(/, "=(", decl); + sub(/\)'\''$/, ")", decl); + gsub(/'\'\\\\\'\''/, "'\''", decl); + } + if (_ble_bash < 30100) gsub(/\\\n/, "\n", decl); + if (_ble_bash < 40400) { + gsub(/\001\001/, "\001", decl); + gsub(/\001\177/, "\177", decl); + } + sub(/^([_a-zA-Z][_a-zA-Z0-9]*)=\(['"$_ble_term_blank"']*/, "", decl); + sub(/['"$_ble_term_blank"']*\)['"$_ble_term_blank"']*$/, "", decl); + if (decl == "") return 1; + if (AWKTYPE != "mawk" && analyze_elements_dq(decl)) return 1; + return analyze_elements_general(decl); + } + { decl = decl ? decl "\n" $0: $0; } + END { process_declaration(decl); } + ' +} +function ble/util/readarray { + local _ble_local_array + local -x _ble_local_nlfix _ble_local_delim + ble/util/writearray/.read-arguments "$@" || return 2 + if ((_ble_bash>=40400)); then + local _ble_local_script=' + mapfile -t -d "$_ble_local_delim" NAME' + elif ((_ble_bash>=40000)) && [[ $_ble_local_delim == $'\n' ]]; then + local _ble_local_script=' + mapfile -t NAME' + else + local _ble_local_script=' + local IFS= NAMEI=0; NAME=() + while ble/bash/read -d "$_ble_local_delim" "NAME[NAMEI++]"; do ((1)); done' + fi + if [[ $_ble_local_nlfix ]]; then + _ble_local_script=$_ble_local_script' + local NAMEN=${#NAME[@]} NAMEF NAMEI + if ((NAMEN--)); then + ble/string#split-words NAMEF "${NAME[NAMEN]}" + builtin unset -v "NAME[NAMEN]" + for NAMEI in "${NAMEF[@]}"; do + builtin eval -- "NAME[NAMEI]=${NAME[NAMEI]}" + done + fi' + fi + builtin eval -- "${_ble_local_script//NAME/$_ble_local_array}" +} +_ble_util_assign_base=$_ble_base_run/$$.util.assign.tmp +_ble_util_assign_level=0 +if ((_ble_bash>=40000)); then + function ble/util/assign/mktmp { + _ble_local_tmpfile=$_ble_util_assign_base.$((_ble_util_assign_level++)) + ((BASH_SUBSHELL)) && _ble_local_tmpfile=$_ble_local_tmpfile.$BASHPID + } +else + function ble/util/assign/mktmp { + _ble_local_tmpfile=$_ble_util_assign_base.$((_ble_util_assign_level++)) + ((BASH_SUBSHELL)) && _ble_local_tmpfile=$_ble_local_tmpfile.$RANDOM + } +fi +function ble/util/assign/rmtmp { + ((_ble_util_assign_level--)) + if ((BASH_SUBSHELL)); then + printf 'caller %s\n' "${FUNCNAME[@]}" >| "$_ble_local_tmpfile" + else + >| "$_ble_local_tmpfile" + fi +} +if ((_ble_bash>=50300)); then + function ble/util/assign { + builtin eval -- "$1=\${ builtin eval -- \"\$2\"; }" + } +elif ((_ble_bash>=40000)); then + function ble/util/assign { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? _ble_local_arr= + mapfile -t _ble_local_arr < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + local IFS=$'\n' # avoid tmpenv to make it POSIXLY_CORRECT-safe + builtin eval -- "$1=\"\${_ble_local_arr[*]}\"" + return "$_ble_local_ret" + } +else + function ble/util/assign { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? IFS= + ble/bash/read -d '' "$1" < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + builtin eval -- "$1=\${$1%\$_ble_term_nl}" + return "$_ble_local_ret" + } +fi +if ((_ble_bash>=40000)); then + function ble/util/assign-array { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? + mapfile -t "$1" < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + return "$_ble_local_ret" + } +else + function ble/util/assign-array { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? + ble/util/mapfile "$1" < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + return "$_ble_local_ret" + } +fi +if ! ((_ble_bash>=40400)); then + function ble/util/assign-array0 { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? + mapfile -d '' -t "$1" < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + return "$_ble_local_ret" + } +else + function ble/util/assign-array0 { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$2" >| "$_ble_local_tmpfile" + local _ble_local_ret=$? + local IFS= i=0 _ble_local_arr + while ble/bash/read -d '' "_ble_local_arr[i++]"; do ((1)); done < "$_ble_local_tmpfile" + ble/util/assign/rmtmp + [[ ${_ble_local_arr[--i]} ]] || builtin unset -v "_ble_local_arr[i]" + ble/util/unlocal i IFS + builtin eval "$1=(\"\${_ble_local_arr[@]}\")" + return "$_ble_local_ret" + } +fi +function ble/util/assign.has-output { + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin eval -- "$1" >| "$_ble_local_tmpfile" + [[ -s $_ble_local_tmpfile ]] + local _ble_local_ret=$? + ble/util/assign/rmtmp + return "$_ble_local_ret" +} +function ble/util/assign-words { + ble/util/assign "$1" "$2" + ble/string#split-words "$1" "${!1}" +} +function ble/util/eval-stdout { + local _ble_local_script + ble/util/assign _ble_local_script "$1" + builtin eval -- "$_ble_local_script" +} +if ((_ble_bash>=50300)); then + function ble/util/compgen { builtin compgen -V "$@"; } +else + function ble/util/compgen { + local _ble_local_args + _ble_local_compgen_args=("${@:2}") + ble/util/assign-array "$1" 'builtin compgen "${_ble_local_compgen_args[@]}"' + } +fi +if ((_ble_bash>=30200)); then + function ble/is-function { + declare -F -- "$1" &>/dev/null + } +else + function ble/is-function { + local type + ble/util/type type "$1" + [[ $type == function ]] + } +fi +ble/bin/awk/.instantiate +if ((_ble_bash>=30200)); then + function ble/function#getdef { + local name=$1 + ble/is-function "$name" || return 1 + if [[ -o posix ]]; then + ble/util/assign def 'builtin type -- "$name"' + def=${def#*$'\n'} + else + ble/util/assign def 'declare -f -- "$name"' + fi + } +else + function ble/function#getdef { + local name=$1 + ble/is-function "$name" || return 1 + ble/util/assign def 'builtin type -- "$name"' + def=${def#*$'\n'} + } +fi +function ble/function#evaldef { + ble/base/evaldef "$1" +} +function ble/function#has-attr { + local __ble_tmp=$1 + ble/util/assign-array __ble_tmp 'declare -pf -- "$__ble_tmp" 2>/dev/null' + local nline=${#__ble_tmp[@]} + ((nline)) && + ble/string#match "${__ble_tmp[nline-1]}" '^declare -([a-zA-Z]*)' && + [[ ${BASH_REMATCH[1]} == *["$2"]* ]] +} +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_util_function_traced}" +function ble/function#trace { + local func + for func; do + declare -ft -- "$func" &>/dev/null || continue + ble/gdict#set _ble_util_function_traced "$func" 1 + done +} +function ble/function#.has-trace { + ble/gdict#has _ble_util_function_traced "$1" +} +function ble/function#has-trace { + ble/function#.has-trace "$1" || ble/function#has-attr "$1" t +} +function ble/function#copy-trace { + ble/function#has-trace "$1" && ble/function#trace "$2" +} +function ble/function#.copy-primitive { + local def + ble/function#getdef "$1" || return 1 + local def_new=${def/#"$1"/"$2"} + [[ $def_new == "$def" ]] && return 1 + ble/function#evaldef "$def_new" || return 1 + ble/function#copy-trace "$1" "$2" + return 0 +} +function ble/function/is-global-trace-context { + local func depth=1 ndepth=${#FUNCNAME[*]} + for func in "${FUNCNAME[@]:1}"; do + local src=${BASH_SOURCE[depth]} + [[ $- == *T* && ( $func == ble || $func == ble[-/]* || $func == source && $src == "$_ble_base_blesh_raw" ) ]] || + [[ $func == source && depth -eq ndepth-1 && BASH_LINENO[depth] -eq 0 && ( ${src##*/} == .bashrc || ${src##*/} == .bash_profile || ${src##*/} == .profile ) ]] || + ble/gdict#has _ble_util_function_traced "$func" || return 1 + ((depth++)) + done + return 0 +} +function ble/function#try { + local lastexit=$? + ble/is-function "$1" || return 127 + ble/util/setexit "$lastexit" + "$@" +} +function ble/function#get-source-and-lineno { + local func=$1 ret unset_extdebug= + shopt -q extdebug || { unset_extdebug=1; shopt -s extdebug; } + ble/util/assign ret 'declare -F -- "$func" 2>/dev/null'; local ext=$? + [[ ! $unset_extdebug ]] || shopt -u extdebug + if ((ext==0)); then + ret=${ret#*' '} + lineno=${ret%%' '*} + source=${ret#*' '} + [[ $lineno && ! ${lineno//[0-9]} && $source ]] || return 1 + fi + return "$ext" +} +function ble/function#advice/do { + ble/util/setexit "$advice_lastexit" "$advice_lastarg" + ble/function#advice/original:"${ADVICE_WORDS[@]}" + ADVICE_EXIT=$? +} +function ble/function#advice/.proc { + local advice_lastexit=$? advice_lastarg=$_ + local ADVICE_WORDS ADVICE_EXIT=127 + ADVICE_WORDS=("$@") + local -a ADVICE_FUNCNAME=() + local func + for func in "${FUNCNAME[@]}"; do + [[ $func == ble/function#advice/* ]] || + ble/array#push ADVICE_FUNCNAME "$func" + done + ble/util/unlocal func + ble/function#try ble/function#advice/before:"${ADVICE_WORDS[@]}" + if ble/is-function ble/function#advice/around:"${ADVICE_WORDS[0]}"; then + ble/function#advice/around:"${ADVICE_WORDS[@]}" + else + ble/function#advice/do + fi + ble/function#try ble/function#advice/after:"${ADVICE_WORDS[@]}" + return "$ADVICE_EXIT" +} +ble/function#trace ble/function#advice/.proc +function ble/function#advice { + local flags= + while [[ ${1-} == -[!-]* ]]; do + flags=$flags${1#-} + shift + done + local type=$1 name=$2 proc=$3 + if ! ble/is-function "$name"; then + local t=; ble/util/type t "$name" + case $t in + (builtin|file) builtin eval "function $name { : ZBe85Oe28nBdg; command $name \"\$@\"; }" ;; + (*) + if [[ $flags == *f* ]]; then + ble/util/print "ble/function#advice: $name is not a function." >&2 + return 1 + fi ;; + esac + fi + local def; ble/function#getdef "$name" + case $type in + (remove) + if [[ $def == *'ble/function#advice/.proc'* ]]; then + ble/function#getdef ble/function#advice/original:"$name" + if [[ $def ]]; then + if [[ $def == *ZBe85Oe28nBdg* ]]; then + builtin unset -f "$name" + else + ble/function#evaldef "${def#*:}" + ble/function#copy-trace ble/function#advice/original:"$name" "$name" + fi + fi + fi + builtin unset -f ble/function#advice/{before,after,around,original}:"$name" 2>/dev/null + return 0 ;; + (before|after|around) + if [[ $def != *'ble/function#advice/.proc'* ]]; then + ble/function#evaldef ble/function#advice/original:"$def" + ble/function#copy-trace "$name" ble/function#advice/original:"$name" + builtin eval "function $name { ble/function#advice/.proc \"\$FUNCNAME\" \"\$@\"; }" + ble/function#copy-trace ble/function#advice/original:"$name" "$name" + fi + local q=\' Q="'\''" + builtin eval "ble/function#advice/$type:$name() { builtin eval -- '${proc//$q/$Q}'; }" + ble/function#copy-trace ble/function#advice/original:"$name" ble/function#advice/$type:"$name" + return 0 ;; + (*) + ble/util/print "ble/function#advice unknown advice type '$type'" >&2 + return 2 ;; + esac +} +function ble/function#push { + local name=$1 proc=$2 + if ble/is-function "$name"; then + local index=0 + while ble/is-function "ble/function#push/$index:$name"; do + ((++index)) + done + ble/function#.copy-primitive "$name" "ble/function#push/$index:$name" + fi + if [[ $proc ]]; then + local q=\' Q="'\''" + builtin eval "function $name { builtin eval -- '${proc//$q/$Q}'; }" + else + builtin unset -f "$name" + fi + return 0 +} +function ble/function#pop { + local name=$1 proc=$2 + local index=-1 + while ble/is-function "ble/function#push/$((index+1)):$name"; do + ((++index)) + done + if ((index<0)); then + if ble/is-function "$name"; then + builtin unset -f "$name" + return 0 + elif ble/bin#has "$name"; then + ble/util/print "ble/function#pop: $name is not a function." >&2 + return 1 + else + return 0 + fi + else + ble/function#.copy-primitive "ble/function#push/$index:$name" "$name" + builtin unset -f "ble/function#push/$index:$name" + return 0 + fi +} +function ble/function#push/call-top { + local func=${FUNCNAME[1]} + if ! ble/is-function "$func"; then + ble/util/print "ble/function#push/call-top: This function should be called from a function" >&2 + return 1 + fi + local index=0 + if [[ $func == ble/function#push/?*:?* ]]; then + index=${func#*/*/}; index=${index%%:*} + func=${func#*:} + else + while ble/is-function "ble/function#push/$index:$func"; do ((index++)); done + fi + if ((index==0)); then + command "$func" "$@" + else + "ble/function#push/$((index-1)):$func" "$@" + fi +} +ble/function#trace ble/function#push/call-top +: "${_ble_util_lambda_count:=0}" +function ble/function#lambda { + local _ble_local_q=\' _ble_local_Q="'\''" + if ((_ble_bash>=50300)); then + ble/util/set "$1" "ble::function#lambda::$((_ble_util_lambda_count++))" # WA #D2221 + else + ble/util/set "$1" "ble/function#lambda/$((_ble_util_lambda_count++))" + fi + builtin eval -- "function ${!1} { builtin eval -- '${2//$_ble_local_q/$_ble_local_Q}'; }" +} +function ble/function#suppress-stderr { + local name=$1 + if ! ble/is-function "$name"; then + ble/util/print "$FUNCNAME: '$name' is not a function name" >&2 + return 2 + fi + local lambda=ble/function#suppress-stderr:$name + if ! ble/is-function "$lambda"; then + ble/function#.copy-primitive "$name" "$lambda" + fi + builtin eval "function $name { $lambda \"\$@\" 2>/dev/null; }" + return 0 +} +function ble/function#copy { + [[ $1 == "$2" ]] && return 0 + ble/function#.copy-primitive "$1" "$2" || return 1 + local prefix + for prefix in advice/{original,before,after,around} suppress-stderr; do + ble/function#.copy-primitive "ble/function#$prefix:$1" "ble/function#$prefix:$2" + done + local index=0 + while ble/function#.copy-primitive "ble/function#push/$index:$1" "ble/function#push/$index:$2"; do + ((++index)) + done + return 0 +} +function ble/function#remove { + ble/is-function "$1" || return 1 + builtin unset -f "$1" + local prefix + for prefix in advice/{original,before,after,around} suppress-stderr; do + builtin unset -f "ble/function#$prefix:$1" + done + local index=0 + while ble/is-function "ble/function#push/$index:$1"; do + builtin unset -f "ble/function#push/$((index++)):$1" + done + return 0 +} +function ble/function#rename { + ble/function#copy "$1" "$2" && ble/function#remove "$1" +} +if ((_ble_bash>=40100)); then + function ble/util/set { + builtin printf -v "$1" %s "$2" + } +else + function ble/util/set { + builtin eval -- "$1=\"\$2\"" + } +fi +if ((_ble_bash>=30100)); then + function ble/util/sprintf { + builtin printf -v "$@" + } +else + function ble/util/sprintf { + local -a args; args=("${@:2}") + ble/util/assign "$1" 'builtin printf "${args[@]}"' + } +fi +function ble/util/type { + ble/util/assign-array "$1" 'builtin type -a -t -- "$3" 2>/dev/null' "$2" +} +if ((_ble_bash>=40000)); then + function ble/is-alias { + [[ $1 && ${BASH_ALIASES[$1]+set} ]] + } + function ble/alias#active { + shopt -q expand_aliases && + [[ $1 && ${BASH_ALIASES[$1]+set} ]] + } + function ble/alias#expand { + ret=$1 + shopt -q expand_aliases && [[ $1 ]] && + ret=${BASH_ALIASES[$ret]-$ret} + } + function ble/alias/list { + ret=("${!BASH_ALIASES[@]}") + } +else + function ble/is-alias { + [[ $1 != *=* ]] && alias "$1" &>/dev/null + } + function ble/alias#active { + shopt -q expand_aliases && + [[ $1 != *=* ]] && alias "$1" &>/dev/null + } + function ble/alias#expand { + ret=$1 + local type; ble/util/type type "$ret" + [[ $type != alias ]] && return 1 + local data; ble/util/assign data 'LC_ALL=C alias "$ret"' &>/dev/null + [[ $data == 'alias '*=* ]] && builtin eval "ret=${data#alias *=}" + } + function ble/alias/list { + ret=() + local data iret=0 + ble/util/assign-array data 'alias -p' + for data in "${data[@]}"; do + [[ $data == 'alias '*=* ]] && + data=${data%%=*} && + builtin eval "ret[iret++]=${data#alias }" + done + } +fi +function ble/util/load-standard-builtin { + local ret; ble/util/readlink "$BASH" + local bash_prefix=${ret%/*/*} + local -a loadable_paths=() + ((_ble_bash>=40400)) && [[ ${BASH_LOADABLE_PATHS-} ]] && + ble/string#split loadable_paths : "$BASH_LOADABLES_PATH" + ble/array#push loadable_paths "$bash_prefix"/lib{,64}/bash + [[ ! $bash_prefix ]] && + ble/array#push loadable_paths /usr/lib{,64}/bash + local loadable_path + for loadable_path in "${loadable_paths[@]}"; do + if [[ -s $loadable_path/$1 ]] && ( + enable -f "$loadable_path/$1" "$1" && + help "$1" && + { [[ ! $2 ]] || builtin eval -- "$2"; } + ) &>/dev/null + then + enable -f "$loadable_path/$1" "$1" + return 0 + fi + done + return 1 +} +if ((_ble_bash>=40000)); then + function ble/util/is-stdin-ready { + local IFS= LC_ALL= LC_CTYPE=C stdin=${1:-${_ble_util_fd_tui_stdin:-0}} + if ((stdin==0)) || { ((stdin==_ble_util_fd_tui_stdin)) && [[ -t 0 && ! $_ble_edit_exec_inside_userspace ]]; }; then + builtin read -t 0 + else + builtin read -t 0 <&"$stdin" + fi + } + ble/function#suppress-stderr ble/util/is-stdin-ready +else + function ble/util/is-stdin-ready { return "${2:-1}"; } +fi +if ((_ble_bash>=40000)); then + function ble/util/getpid { return 0; } + function ble/util/is-running-in-subshell { [[ $$ != $BASHPID ]]; } +else + function ble/util/getpid { + local command='echo $PPID' + ble/util/assign BASHPID 'ble/bin/sh -c "$command"' + } + function ble/util/is-running-in-subshell { + ((BASH_SUBSHELL==0)) || return 0 + local BASHPID; ble/util/getpid + [[ $$ != $BASHPID ]] + } +fi +_ble_util_fd_is_open_stdout= +_ble_util_fd_is_open_stderr= +if ((_ble_bash>=40000)) && [[ -d /proc/$BASHPID/fd ]]; then + function ble/fd#is-open { [[ $1 && -e /proc/$BASHPID/fd/$1 ]]; } + function ble/fd#is-open/.upgrade { builtin unset -f "$FUNCNAME"; } +else + function ble/fd#is-open { builtin : 9>&"$1"; } 2>/dev/null + function ble/fd#is-open/.upgrade { + if ! { [[ $_ble_util_fd_null ]] && ((1)) >&"$_ble_util_fd_null"; } 2>/dev/null; then + ble/util/print "$FUNCNAME: [FATAL] call this function after \$_ble_util_fd_null is ready" >&2 + return 1 + fi + local fd1 fd2 + ble/fd#alloc/.nextfd fd1 + ble/fd#alloc/.nextfd fd2 + _ble_util_fd_is_open_stdout=$fd1 + _ble_util_fd_is_open_stderr=$fd2 + builtin eval -- " + ble/fd#alloc/.exec $fd1 '>/dev/null' # disable=#D1835 + ble/fd#alloc/.exec $fd2 '>&$fd1' # disable=#D1835 + function ble/fd#is-open { + ble/string#match \"\$1\" '^[0-9]+$' || return 1 + [[ \$1 == $fd1 || \$1 == $fd2 || \$1 == $_ble_util_fd_null ]] && return 0 + ble/fd#alloc/.exec $fd2 '>&2' # disable=#D1835 + exec 2>&$_ble_util_fd_null # disable=#D1835 + ble/fd#alloc/.exec $fd1 \">&\$1\" # disable=#D1835 + local ext=\$? + exec 2>&$fd2 # disable=#D1835 + ble/fd#alloc/.exec $fd1 '>&$_ble_util_fd_null' # disable=#D1835 + ble/fd#alloc/.exec $fd2 '>&$fd1' # disable=#D1835 + return \"\$ext\" + } + " + builtin unset -f "$FUNCNAME" + } +fi +function ble/fd#alloc/.close { builtin eval "exec $1<&-"; } # disable=#D2164 +if ((30100<=_ble_bash&&_ble_bash<30200)); then + function ble/fd#alloc/.close/.upgrade { + if ! { [[ $_ble_util_fd_null ]] && ((1)) >&"$_ble_util_fd_null"; } 2>/dev/null; then + ble/util/print "$FUNCNAME: [FATAL] call this function after \$_ble_util_fd_null is ready" >&2 + return 1 + fi + builtin eval -- " + function ble/fd#alloc/.close { + ((\$1==$_ble_util_fd_null||\$1==2)) && return 1 + exec $_ble_util_fd_null<&\"\$1\"- + } 2>/dev/null" + builtin unset -f "$FUNCNAME" + } +else + function ble/fd#alloc/.close/.upgrade { builtin unset -f "$FUNCNAME"; } +fi +function ble/fd/.validate-shared-fds { + local -a close_fd=() + if [[ ${_ble_util_fdvars_export-} ]]; then + local ret var fd + ble/string#split ret : "$_ble_util_fdvars_export" + for var in "${ret[@]}"; do + ble/string#match "$var" '^[a-zA-Z_][a-zA-Z_0-9]*$' || continue + fd=${!var} + ble/string#match "$fd" '^[0-9]+$' || continue + if ! ble/fd#is-open "$fd"; then + ble/array#push close_fd "$fd" + builtin unset -v "$var" + fi + done + for var in "${!_ble_util_fd_@}"; do + fd=${!var} + ble/string#match "$fd" '^[0-9]{2,}$' || continue + if ! ble/fd#is-open "$fd"; then + ble/array#push close_fd "$fd" + builtin unset -v "$var" + fi + done + _ble_util_fdvars_export= + fi + if [[ ${_ble_util_fdlist_cloexec-} ]]; then + local ret fd + ble/string#split ret : "$_ble_util_fdlist_cloexec" + for fd in "${ret[@]}"; do + ble/string#match "$fd" '^([0-9]+)(=(.*))?' || continue + local fd=${BASH_REMATCH[1]} type=${BASH_REMATCH[3]-} + case $type in + (L*) + [[ -h /proc/$$/fd/$1 ]] && + ble/util/readlink "/proc/$$/fd/$1" && + [[ ${ret//:} == "${type#L}" ]] || continue ;; + (t) [[ -t $fd ]] || continue ;; + (o) [[ ! -t $fd ]] || continue ;; + esac + ble/array#push close_fd "$fd" + done + _ble_util_fdlist_cloexec= + fi + if ((${#close_fd[@]})); then + "${_ble_util_set_declare[@]//NAME/mark}" # disable=#D1570 + local fd + for fd in "${close_fd[@]}"; do + ble/set#contains mark "$fd" && continue + ble/set#add mark "$fd" + ble/fd#alloc/.close "$fd" + done + fi +} +ble/fd/.validate-shared-fds +_ble_util_fdlist_cloexit= +export _ble_util_fdlist_cloexec= +export _ble_util_fdvars_export= +_ble_util_openat_nextfd= +function ble/fd#alloc/.nextfd { + [[ $_ble_util_openat_nextfd ]] || + _ble_util_openat_nextfd=${bleopt_openat_base:-30} + local _ble_local_init=${2:-$_ble_util_openat_nextfd} + local _ble_local_limit=$((_ble_local_init+1024)) + local _ble_local_nextfd=$_ble_local_init + while ((_ble_local_nextfd<_ble_local_limit)) && + ble/fd#is-open "$_ble_local_nextfd"; do + ((_ble_local_nextfd++)) + done + if ((_ble_local_nextfd>=_ble_local_limit)); then + _ble_local_nextfd=$_ble_local_init + ble/fd#alloc/.close "$_ble_local_nextfd" + fi + (($1=_ble_local_nextfd++)) + [[ ${2-} || :${3-}: == *:no-increment:* ]] || + _ble_util_openat_nextfd=$_ble_local_nextfd +} +if [[ :$bleopt_connect_tty: == *:inherit:* ]]; then + if [[ ! ${_ble_util_fd_null-} ]] || ! ble/fd#is-open "$_ble_util_fd_null"; then + builtin eval "exec $_ble_util_fd_null<>/dev/null" + ble/opts#append-unique _ble_util_fdvars_export _ble_util_fd_null + export _ble_util_fd_null + ble/fd#alloc/.nextfd _ble_util_fd_null + fi +else + ble/fd#alloc/.nextfd _ble_util_fd_null + builtin eval "exec $_ble_util_fd_null<>/dev/null" + ble/opts#append-unique _ble_util_fdlist_cloexit "$_ble_util_fd_null" +fi +ble/fd#alloc/.close/.upgrade +function ble/fd#alloc/.exec { + ble/fd#alloc/.close "$1" + builtin eval "exec $1$2" +} +ble/fd#is-open/.upgrade +if [[ -d /proc/$$/fd ]]; then + if ((_ble_bash>=50300)); then + function ble/fd#list/.impl { + local pid=$1 + builtin compgen -V ret -G "/proc/$pid/fd/[0-9]*" + ret=("${ret[@]##*/}") # disable=#D2352 (bash >= 5.3 are unaffected) + } + else + function ble/fd#list/.adjust-glob { + set=$- shopt= gignore=$GLOBIGNORE + ble/base/list-shopt failglob dotglob + shopt -u failglob + set +f + GLOBIGNORE= + } + function ble/fd#list/.restore-glob { + GLOBIGNORE=$gignore + if [[ :$shopt: == *:dotglob:* ]]; then shopt -s dotglob; else shopt -u dotglob; fi + [[ $set == *f* ]] && set -f + [[ :$shopt: == *:failglob:* ]] && shopt -s failglob + } + function ble/fd#list/.impl { + ret=() + local pid=$1 + local set shopt gignore + ble/fd#list/.adjust-glob + local fd + for fd in /proc/"$pid"/fd/[0-9]*; do + fd=${fd##*/} + [[ $fd && ! ${fd//[0-9]} ]] && + ble/array#push ret "$fd" + done + ble/fd#list/.restore-glob + } + fi + if ((_ble_bash>=40000)); then + function ble/fd#list { ble/fd#list/.impl "$BASHPID"; } + else + function ble/fd#list { + local BASHPID + ble/util/getpid + ble/fd#list/.impl "$BASHPID" + } + fi +else + function ble/fd#list { + ret=() + local fd + for fd in {0..255}; do + ble/fd#is-open "$fd" && ble/array#push ret "$fd" + done + } +fi +if ((_ble_bash>=40400)) && ble/util/load-standard-builtin fdflags 'builtin fdflags 0; (($?<=2))'; then + function ble/fd#cloexec/.add { builtin fdflags -s +cloexec "$1"; } + function ble/fd#cloexec/.remove { builtin fdflags -s -cloexec "$1"; } +elif ((_ble_bash>=40000)); then + if [[ -d /proc/$$/fd ]]; then + function ble/fd#cloexec/.listfd { + local ret fd + ble/fd#list/.impl "$$" + for fd in "${ret[@]}"; do + ble/util/set "$1[fd]" 1 + done + } + function ble/fd#cloexec/.probe { + local fdset2 + ble/fd#cloexec/.listfd fdset2 + local fd + for fd in "${!fdset1[@]}"; do builtin unset -v 'fdset2[fd]'; done + fd=("${!fdset2[@]}") + ((${#fd[@]}==1)) && + ble/fd#alloc/.nextfd ret '' no-increment && + builtin eval -- "exec $ret<&$fd" && + return 0 + ret= + return 1 + } + function ble/fd#cloexec/.dup-undo-redirection-fd { + local fd=$1 fdset1 + ble/fd#cloexec/.listfd fdset1 + builtin eval -- "ble/fd#cloexec/.probe $fd&- $fd>&$ret $ret>&-" # disable=#D2164 (here bash4+) + } 2>/dev/null + function ble/fd#cloexec/.remove { + local fd=$1 + if ((fd!=0)); then + builtin eval -- "exec 0<&$fd $fd<&- $fd<&0" &$fd $fd>&- $fd>&1" >/dev/null # disable=#D2164 (here bash4+) + fi + } +else + function ble/fd#cloexec/.add { return 1; } + function ble/fd#cloexec/.remove { return 1; } +fi +function ble/fd#add-cloexec { + ble/fd#cloexec/.add "$1" && return 0 + local type + if [[ -h /proc/$$/fd/$1 ]] && ble/util/readlink "/proc/$$/fd/$1"; then + type=L${ret//:} + elif [[ -t ${!1} ]]; then + type=t + else + type=o + fi + ble/opts#remove _ble_util_fdlist_cloexec "$1" + ble/opts#append _ble_util_fdlist_cloexec "$1=$type" +} +function ble/fd#remove-cloexec { + ble/fd#cloexec/.remove "$1" || return "$?" + ble/opts#remove _ble_util_fdlist_cloexec "$1" + return 0 +} +function ble/fd#alloc { + local _ble_local_opts=$3 + if [[ :$_ble_local_opts: == *:inherit:* ]]; then + [[ ${!1-} ]] && ble/fd#is-open "${!1}" && return 0 + _ble_local_opts=$_ble_local_opts:export + elif [[ :$_ble_local_opts: == *:inherit-tty:* ]]; then + [[ ${!1-} && -t ${!1-} ]] && return 0 + _ble_local_opts=$_ble_local_opts:export + fi + if [[ :$_ble_local_opts: == *:share:* ]]; then + if ble/string#match "$2" '[<>]&['"$_ble_term_IFS"']*([0-9]+)['"$_ble_term_IFS"']*$'; then + builtin eval -- "$1=${BASH_REMATCH[1]}" + return 0 + fi + fi + if [[ ${!1-} && :$_ble_local_opts: == *:overwrite:* ]]; then + _ble_local_opts=$_ble_local_opts:preserve + ble/fd#alloc/.exec "${!1}" "$2" + elif ((_ble_bash>=40100)) && [[ :$_ble_local_opts: != *:base:* ]]; then + builtin eval "exec {$1}$2" + else + ble/fd#alloc/.nextfd "$1" + ble/fd#alloc/.exec "${!1}" "$2" + fi; local _ble_local_ext=$? + if ((_ble_local_ext==0)); then + if [[ :$_ble_local_opts: == *:export:* ]]; then + export "$1" + ble/opts#append-unique _ble_util_fdvars_export "$1" + elif [[ :$_ble_local_opts: != *:preserve:* ]]; then + ble/opts#append-unique _ble_util_fdlist_cloexit "${!1}" + ble/fd#add-cloexec "${!1}" + fi + fi + return "$_ble_local_ext" +} +function ble/fd#finalize { + local fds fd + ble/string#split fds : "$_ble_util_fdlist_cloexit" + for fd in "${fds[@]}"; do + [[ $fd ]] || continue + ble/fd#alloc/.close "$fd" + done + _ble_util_fdlist_cloexit= + _ble_util_fdlist_cloexec= +} +function ble/fd#is-cloexit { + [[ :$_ble_util_fdlist_cloexit: == *:"$fd":* ]] +} +function ble/fd#close { + set -- "$(($1))" + (($1>=3)) || return 1 + ble/fd#alloc/.close "$1" + ble/opts#remove _ble_util_fdlist_cloexit "$1" + ble/opts#remove _ble_util_fdlist_cloexec "$1" + return 0 +} +bleopt/declare -v connect_tty 1 +export bleopt_connect_tty +ble/fd#add-cloexec "$_ble_util_fd_null" +_ble_util_fd_zero= +if [[ -c /dev/zero ]] && ! ble/base/is-msys1; then + if [[ :$bleopt_connect_tty: == *:inherit:* ]]; then + ble/fd#alloc _ble_util_fd_zero '< /dev/zero' base:inherit + else + ble/fd#alloc _ble_util_fd_zero '< /dev/zero' base + fi +fi +function ble/fd/.initialize-standard-stream { + local var_tty=_ble_util_fd_tty_$1 + local var_cmd=_ble_util_fd_cmd_$1 + local var_tui=_ble_util_fd_tui_$1 + local fd=${2::1} redir=${2:1} + ble/fd#alloc "$var_cmd" "$redir&$fd" base + if [[ -t $fd ]]; then + local alloc_opts=base + [[ $bleopt_connect_tty == inherit ]] && alloc_opts=$alloc_opts:overwrite:export + ble/fd#alloc "$var_tty" "$redir&$fd" "$alloc_opts" + ble/util/set "$var_tui" "${!var_tty}" + return 0 + fi + if [[ ! $_ble_init_command && $bleopt_connect_tty ]]; then + local alloc_opts=base + [[ $bleopt_connect_tty == inherit ]] && alloc_opts=$alloc_opts:inherit-tty + if ble/fd#alloc "$var_tty" "$redir /dev/tty" "$alloc_opts"; then + ble/util/set "$var_tui" "${!var_tty}" + builtin eval -- "exec $fd$redir&${!var_tui}" + return 0 + else + builtin unset -v "$var_tty" + fi + fi + ble/util/set "$var_tui" "${!var_cmd}" +} +ble/fd/.initialize-standard-stream stdin '0<' +ble/fd/.initialize-standard-stream stdout '1>' +ble/fd/.initialize-standard-stream stderr '2>' +function ble/fd/save-external-standard-streams { + ble/fd#alloc _ble_util_fd_cmd_stdin "<&${1:-0}" base:overwrite + ble/fd#alloc _ble_util_fd_cmd_stdout ">&${2:-1}" base:overwrite + ble/fd#alloc _ble_util_fd_cmd_stderr ">&${3:-2}" base:overwrite + ble/fd#add-cloexec "$_ble_util_fd_cmd_stdin" + ble/fd#add-cloexec "$_ble_util_fd_cmd_stdout" + ble/fd#add-cloexec "$_ble_util_fd_cmd_stderr" +} +function ble/fd#close-all-tty { + local ret + ble/fd#list + local fd + for fd in "${ret[@]}"; do + if ble/string#match "$fd" '^[0-9]+$' && [[ -t $fd ]]; then + ble/fd#alloc/.exec "$fd" ">&$_ble_util_fd_null" + ble/opts#remove _ble_util_fdlist_cloexit "$fd" + fi + done +} +function ble/util/nohup { + if ((!BASH_SUBSHELL)); then + (ble/util/nohup "$@") + return "$?" + fi + ble/fd#close-all-tty + shopt -u huponexit + builtin eval -- "$1" &>/dev/null =40000)); then + ble/util/assign __ble_decl "declare -p $__ble_name" 2>/dev/null + __ble_decl=${__ble_decl#declare -* } + else + ble/util/assign __ble_decl "ble/util/declare-print-definitions $__ble_name" 2>/dev/null + fi + if ble/is-array "$__ble_name"; then + __ble_decl="declare -a $__ble_decl" + else + __ble_decl="declare -A $__ble_decl" + fi + else + __ble_decl=${!__ble_name} + __ble_decl="declare $__ble_name='${__ble_decl//$__ble_q/$__ble_Q}'" + fi + ble/util/print "$__ble_decl" +} +function ble/util/print-global-definitions { + local __ble_opts= + [[ $1 == --hidden-only ]] && { __ble_opts=hidden-only; shift; } + ble/util/for-global-variables ble/util/print-global-definitions/.print-decl "$__ble_opts" "$@" +} +function ble/util/for-global-variables { + local __ble_proc=$1 __ble_opts=$2; shift 2 + local __ble_hidden_only= + [[ :$__ble_opts: == *:hidden-only:* ]] && __ble_hidden_only=1 + ( + ble/util/joblist/__suppress__ + ((_ble_bash>=50000)) && shopt -u localvar_unset + __ble_error= + __ble_q="'" __ble_Q="'\''" + __ble_MaxLoop=20 + builtin unset -v "${!_ble_processed_@}" + for __ble_name; do + [[ ${__ble_name//[_a-zA-Z0-9]} || $__ble_name == __ble_* ]] && continue + ((__ble_processed_$__ble_name)) && continue + ((__ble_processed_$__ble_name=1)) + __ble_found= + if ((_ble_bash>=40200)); then + declare -g -r "$__ble_name" + for ((__ble_i=0;__ble_i<__ble_MaxLoop;__ble_i++)); do + if ! builtin unset -v "$__ble_name"; then + if builtin readonly "$__ble_name"; ble/variable#is-global/.test "$__ble_name"; then + __ble_found=1 + [[ $__ble_hidden_only && $__ble_i == 0 ]] || + "$__ble_proc" "$__ble_name" + fi + break + fi + done + else + for ((__ble_i=0;__ble_i<__ble_MaxLoop;__ble_i++)); do + if ble/variable#is-global "$__ble_name"; then + __ble_found=1 + [[ $__ble_hidden_only && $__ble_i == 0 ]] || + "$__ble_proc" "$__ble_name" + break + fi + builtin unset -v "$__ble_name" || break + done + fi + if [[ ! $__ble_found ]]; then + __ble_error=1 + [[ $__ble_hidden_only && $__ble_i == 0 ]] || + "$__ble_proc" "$__ble_name" unset + fi + done + [[ ! $__ble_error ]] + ) 2>/dev/null +} +function ble/util/has-glob-pattern { + [[ $1 ]] || return 1 + local restore=: + if ! shopt -q nullglob 2>/dev/null; then + restore="$restore;shopt -u nullglob" + shopt -s nullglob + fi + if shopt -q failglob 2>/dev/null; then + restore="$restore;shopt -s failglob" + shopt -u failglob + fi + local dummy=$_ble_base_run/$$.dummy ret + builtin eval "ret=(\"\$dummy\"/${1#/})" 2>/dev/null + builtin eval -- "$restore" + [[ ! $ret ]] +} +function ble/util/is-cygwin-slow-glob { + [[ ( $OSTYPE == cygwin || $OSTYPE == msys ) && ${1#\'} == //* && ! -o noglob ]] && + ble/util/has-glob-pattern "$1" +} +function ble/util/eval-pathname-expansion { + ret=() + if ble/util/is-cygwin-slow-glob; then # Note: #D1168 + if shopt -q failglob &>/dev/null; then + return 1 + elif shopt -q nullglob &>/dev/null; then + return 0 + else + set -f + ble/util/eval-pathname-expansion "$1"; local ext=$1 + set +f + return "$ext" + fi + fi + local canon= + if [[ :$2: == *:canonical:* ]]; then + canon=1 + local set=$- shopt gignore=$GLOBIGNORE + ble/base/list-shopt failglob nullglob extglob dotglob + shopt -u failglob + shopt -s nullglob + shopt -s extglob + set +f + GLOBIGNORE= + fi + builtin eval "ret=($1)" 2>/dev/null; local ext=$? + if [[ $canon ]]; then + GLOBIGNORE=$gignore + if [[ :$shopt: == *:dotglob:* ]]; then shopt -s dotglob; else shopt -u dotglob; fi + [[ $set == *f* ]] && set -f + [[ :$shopt: != *:extglob:* ]] && shopt -u extglob + [[ :$shopt: != *:nullglob:* ]] && shopt -u nullglob + [[ :$shopt: == *:failglob:* ]] && shopt -s failglob + fi + return "$ext" +} +_ble_util_rex_isprint='^[ -~]+' # disable=#D1440 (LC_COLLATE is set) +function ble/util/isprint+ { + local LC_ALL= LC_COLLATE=C + [[ $1 =~ $_ble_util_rex_isprint ]] +} +ble/function#suppress-stderr ble/util/isprint+ +_ble_util_mktime_tzdelta= +function ble/util/mktime { + if (($#==6||$#==7)); then + local tz=${7-} + if [[ ! $tz ]]; then + if [[ ! ${_ble_util_mktime_tzdelta-} ]]; then + ble/util/assign _ble_util_mktime_tzdelta 'ble/bin/date +%z' + fi + tz=$_ble_util_mktime_tzdelta + fi + local tzdelta + if ble/string#match "$tz" '^[-+]([0-9]{1,2})([0-9]{2})$'; then + tzdelta=${tz::1}$(((10#0${BASH_REMATCH[1]}*60+10#0${BASH_REMATCH[2]})*60)) + else + tzdelta=0 + fi + local Y=$((10#0$1)) m=$((10#0$2)) d=$((10#0$3)) + local H=$((10#0$4)) M=$((10#0$5)) S=$((10#0$6)) + ((m<3)) && ((Y--,m+=12)) + local day_delta=$((365*(Y-1970)+(Y/4-Y/100+Y/400-477)+(m+1)*306/10-63+(d-1))) + ((ret=((day_delta*24+H)*60+M)*60+S-tzdelta)) + return 0 + elif ble/string#match "${1-}" '^([0-9]{4})-([01]?[0-9])-([0-3]?[0-9]) ([0-2]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])( ([-+][0-9]{3,4}))?$'; then + ble/util/mktime "${BASH_REMATCH[@]:1:6}" "${BASH_REMATCH[8]-}" + else + ble/util/print "$FUNCNAME: invalid argument '${1-}'" >&2 + return 2 + fi +} +if ((_ble_bash>=40200)); then + function ble/util/strftime { + if [[ $1 = -v ]]; then + builtin printf -v "$2" "%($3)T" "${4:--1}" + else + builtin printf "%($1)T" "${2:--1}" + fi + } +else + function ble/util/strftime { + if [[ $1 = -v ]]; then + local fmt=$3 time=$4 + ble/util/assign "$2" "ble/bin/date +\"\$fmt\" $time" + else + ble/bin/date +"$1" ${2+"$2"} + fi + } +fi +if ((_ble_bash>=50000)); then + function ble/util/time { ret=$EPOCHSECONDS; } + function ble/util/timeval { ret=${EPOCHREALTIME//[!0-9]}; } +else + function ble/util/time { + if ble/util/strftime -v ret '%s' 2>/dev/null && ble/string#match '^[0-9]{3,}$'; then + function ble/util/time { ble/util/strftime -v ret '%s'; } + else + function ble/util/time { + ble/util/strftime -v ret '%F %T %z' + ble/util/mktime "$ret" + } + ble/util/time + fi + if ((_ble_bash<40200)) && ble/string#match "${SECONDS-}" '^[0-9]+$'; then + builtin readonly SECONDS + _ble_util_time_base=$((ret-SECONDS)) + function ble/util/time { ((ret=_ble_util_time_base+SECONDS)); } + fi + } + function ble/util/timeval { ble/util/time; ((ret*=1000000)); } +fi +function blehook/.print { + (($#)) || return 0 + local out= q=\' Q="'\''" nl=$'\n' + local sgr0= sgr1= sgr2= sgr3= + if [[ $flags == *c* ]]; then + local ret + ble/color/face2sgr command_function; sgr1=$ret + ble/color/face2sgr syntax_varname; sgr2=$ret + ble/color/face2sgr syntax_quoted; sgr3=$ret + sgr0=$_ble_term_sgr0 + Q=$q$sgr0"\'"$sgr3$q + fi + local elem op_assign code=' + if ((${#_ble_hook_h_NAME[@]})); then + op_assign== + for elem in "${_ble_hook_h_NAME[@]}"; do + out="${out}${sgr1}blehook$sgr0 ${sgr2}NAME$sgr0$op_assign${sgr3}$q${elem//$q/$Q}$q$sgr0$nl" + op_assign=+= + done + else + out="${out}${sgr1}blehook$sgr0 ${sgr2}NAME$sgr0=$nl" + fi' + local hookname + for hookname; do + ble/is-array "$hookname" || continue + builtin eval -- "${code//NAME/${hookname#_ble_hook_h_}}" + done + ble/util/put "$out" +} +function blehook/.print-help { + ble/util/print-lines \ + 'usage: blehook [NAME[[=|+=|-=|-+=]COMMAND]]...' \ + ' Add or remove hooks. Without arguments, this prints all the existing hooks.' \ + '' \ + ' Options:' \ + ' --help Print this help.' \ + ' -a, --all Print all hooks including the internal ones.' \ + ' --color[=always|never|auto]' \ + ' Change color settings.' \ + '' \ + ' Arguments:' \ + ' NAME Print the corresponding hooks.' \ + ' NAME=COMMAND Set hook after removing the existing hooks.' \ + ' NAME+=COMMAND Add hook.' \ + ' NAME-=COMMAND Remove hook.' \ + ' NAME!=COMMAND Add hook if the command is not registered.' \ + ' NAME-+=COMMAND Append the hook and remove the duplicates.' \ + ' NAME+-=COMMAND Prepend the hook and remove the duplicates.' \ + '' \ + ' NAME:' \ + ' The hook name. The characters "@", "*", and "?" may be used as wildcards.' \ + '' +} +function blehook/.read-arguments { + flags= print=() process=() + local opt_color=auto + while (($#)); do + local arg=$1; shift + if [[ $arg == -* ]]; then + case $arg in + (--help) + flags=H$flags ;; + (--color) opt_color=always ;; + (--color=always|--color=auto|--color=never) + opt_color=${arg#*=} ;; + (--color=*) + ble/util/print "blehook: '${arg#*=}': unrecognized option argument for '--color'." >&2 + flags=E$flags ;; + (--all) flags=a$flags ;; + (--*) + ble/util/print "blehook: unrecognized long option '$arg'." >&2 + flags=E$flags ;; + (-) + ble/util/print "blehook: unrecognized argument '$arg'." >&2 + flags=E$flags ;; + (*) + local i c + for ((i=1;i<${#arg};i++)); do + c=${arg:i:1} + case $c in + (a) flags=a$flags ;; + (*) + ble/util/print "blehook: unrecognized option '-$c'." >&2 + flags=E$flags ;; + esac + done ;; + esac + elif [[ $arg =~ $rex1 ]]; then + if [[ $arg == *[@*?]* ]] || ble/is-array "_ble_hook_h_$arg"; then + ble/array#push print "$arg" + else + ble/util/print "blehook: undefined hook '$arg'." >&2 + fi + elif [[ $arg =~ $rex2 ]]; then + local name=${BASH_REMATCH[1]} + if [[ $name == *[@*?]* ]]; then + if [[ ${BASH_REMATCH[2]} == :* ]]; then + ble/util/print "blehook: hook pattern cannot be combined with '${BASH_REMATCH[2]}'." >&2 + flags=E$flags + continue + fi + else + local var_counter=_ble_hook_c_$name + if [[ ! ${!var_counter+set} ]]; then + if [[ ${BASH_REMATCH[2]} == :* ]]; then + (($var_counter=0)) + else + ble/util/print "blehook: hook \"$name\" is not defined." >&2 + flags=E$flags + continue + fi + fi + fi + ble/array#push process "$arg" + else + ble/util/print "blehook: invalid hook spec \"$arg\"" >&2 + flags=E$flags + fi + done + local pat ret out; out=() + for pat in "${print[@]}"; do + if [[ $pat == *[@*?]* ]]; then + bleopt/expand-variable-pattern "_ble_hook_h_$pat" + ble/array#filter ret ble/is-array + [[ $pat == *[a-z]* || $flags == *a* ]] || + ble/array#remove-by-glob ret '_ble_hook_h_*[a-z]*' + if ((!${#ret[@]})); then + ble/util/print "blehook: '$pat': matching hook not found." >&2 + flags=E$flags + continue + fi + else + ret=("_ble_hook_h_$pat") + fi + ble/array#push out "${ret[@]}" + done + print=("${out[@]}") + out=() + for pat in "${process[@]}"; do + [[ $pat =~ $rex2 ]] + local name=${BASH_REMATCH[1]} + if [[ $name == *[@*?]* ]]; then + local type=${BASH_REMATCH[3]} + local value=${BASH_REMATCH[4]} + bleopt/expand-variable-pattern "_ble_hook_h_$pat" + ble/array#filter ret ble/is-array + [[ $pat == *[a-z]* || $flags == *a* ]] || + ble/array#remove-by-glob ret '_ble_hook_h_*[a-z]*' + if ((!${#ret[@]})); then + ble/util/print "blehook: '$pat': matching hook not found." >&2 + flags=E$flags + continue + fi + ble/array#map-suffix ret "$type$value" + else + ret=("_ble_hook_h_$pat") + fi + ble/array#push out "${ret[@]}" + done + process=("${out[@]}") + [[ $opt_color == always || $opt_color == auto && -t 1 ]] && flags=c$flags +} +function blehook { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local set shopt + ble/base/adjust-BASH_REMATCH + ble/base/.adjust-bash-options set shopt + local LC_ALL= LC_COLLATE=C 2>/dev/null # suppress locale error #D1440 + local flags print process + local rex1='^([_a-zA-Z@*?][_a-zA-Z0-9@*?]*)$' + local rex2='^([_a-zA-Z@*?][_a-zA-Z0-9@*?]*)(:?([-+!]|-\+|\+-)?=)(.*)$' + blehook/.read-arguments "$@" + if [[ $flags == *[HE]* ]]; then + if [[ $flags == *H* ]]; then + [[ $flags == *E* ]] && + ble/util/print >&2 + blehook/.print-help + fi + [[ $flags != *E* ]]; local ext=$? + ble/util/unlocal LC_ALL LC_COLLATE 2>/dev/null # suppress locale error #D1440 + ble/base/.restore-bash-options set shopt + ble/base/restore-BASH_REMATCH + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" + fi + if ((${#print[@]}==0&&${#process[@]}==0)); then + print=("${!_ble_hook_h_@}") + [[ $flags == *a* ]] || ble/array#remove-by-glob print '_ble_hook_h_*[a-z]*' + fi + local proc ext=0 + for proc in "${process[@]}"; do + [[ $proc =~ $rex2 ]] + local name=${BASH_REMATCH[1]} + local type=${BASH_REMATCH[3]} + local value=${BASH_REMATCH[4]} + local append=$value + case $type in + (*-*) # -=, -+=, +-= + local ret + ble/array#last-index "$name" "$value" + if ((ret>=0)); then + ble/array#remove-at "$name" "$ret" + elif [[ ${type#:} == '-=' ]]; then + ext=1 + fi + if [[ $type != -+ ]]; then + append= + [[ $type == +- ]] && + ble/array#unshift "$name" "$value" + fi ;; + ('!') # != + local ret + ble/array#last-index "$name" "$value" + ((ret>=0)) && append= ;; + ('') builtin eval "$name=()" ;; # = + ('+'|*) ;; # += + esac + [[ $append ]] && ble/array#push "$name" "$append" + done + if ((${#print[@]})); then + blehook/.print "${print[@]}" + fi + ble/util/unlocal LC_ALL LC_COLLATE 2>/dev/null # suppress locale error #D1440 + ble/base/.restore-bash-options set shopt + ble/base/restore-BASH_REMATCH + ble/util/setexit "$ext" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +blehook/.compatibility-ble-0.3 +function blehook/has-hook { + builtin eval "local count=\${#_ble_hook_h_$1[@]}" + ((count)) +} +function blehook/invoke.sandbox { + if ble/bin#has "$_ble_local_hook"; then + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + "$_ble_local_hook" "$@" 2>&3 + else + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + builtin eval -- "$_ble_local_hook" 2>&3 + fi +} +function blehook/invoke { + local _ble_local_lastexit=$? _ble_local_lastarg=$_ FUNCNEST= + ((_ble_hook_c_$1++)) + local -a _ble_local_hooks + builtin eval "_ble_local_hooks=(\"\${_ble_hook_h_$1[@]}\")"; shift + local _ble_local_hook _ble_local_ext=0 + for _ble_local_hook in "${_ble_local_hooks[@]}"; do + blehook/invoke.sandbox "$@" || _ble_local_ext=$? + done + return "$_ble_local_ext" +} 3>&2 2>/dev/null # set -x 対策 #D0930 +function blehook/eval-after-load { + local hook_name=${1}_load value=$2 + if ((_ble_hook_c_$hook_name)); then + builtin eval -- "$value" + else + blehook "$hook_name+=$value" + fi +} +_ble_builtin_trap_inside= # ble/builtin/trap 処理中かどうか +function ble/builtin/trap/.read-arguments { + flags= command= sigspecs=() + while (($#)); do + local arg=$1; shift + if [[ $arg == -?* && flags != *A* ]]; then + if [[ $arg == -- ]]; then + flags=A$flags + continue + elif [[ $arg == --* ]]; then + case $arg in + (--help) + flags=h$flags + continue ;; + (*) + ble/util/print "ble/builtin/trap: unknown long option \"$arg\"." >&2 + flags=E$flags + continue ;; + esac + fi + local i + for ((i=1;i<${#arg};i++)); do + case ${arg:i:1} in + (l) flags=l$flags ;; + (p) flags=p$flags ;; + (P) flags=P$flags ;; + (*) + ble/util/print "ble/builtin/trap: unknown option \"-${arg:i:1}\"." >&2 + flags=E$flags ;; + esac + done + else + if [[ $flags != *[pc]* ]]; then + command=$arg + flags=c$flags + else + ble/array#push sigspecs "$arg" + fi + fi + done + if [[ $flags != *[hlpPE]* ]]; then + if [[ $flags != *c* ]]; then + flags=p$flags + elif ((${#sigspecs[@]}==0)); then + sigspecs=("$command") + command=- + fi + elif [[ $flags == *p* && $flags == *P* ]]; then + ble/util/print "ble/builtin/trap: cannot specify both -p and -P" >&2 + flags=E${flags//[pP]} + fi +} +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_builtin_trap_name2sig}" +_ble_builtin_trap_sig_name=() +_ble_builtin_trap_sig_opts=() +_ble_builtin_trap_sig_base=1000 +_ble_builtin_trap_EXIT= +_ble_builtin_trap_DEBUG= +_ble_builtin_trap_RETURN= +_ble_builtin_trap_ERR= +function ble/builtin/trap/sig#register { + local sig=$1 name=$2 + _ble_builtin_trap_sig_name[sig]=$name + ble/gdict#set _ble_builtin_trap_name2sig "$name" "$sig" +} +function ble/builtin/trap/sig#reserve { + local ret + ble/builtin/trap/sig#resolve "$1" || return 1 + _ble_builtin_trap_sig_opts[ret]=${2:-1} +} +function ble/builtin/trap/sig#resolve { + ble/builtin/trap/sig#init + if [[ $1 && ! ${1//[0-9]} ]]; then + ret=$1 + return 0 + else + ble/gdict#get _ble_builtin_trap_name2sig "$1" + [[ $ret ]] && return 0 + ble/string#toupper "$1"; local upper=$ret + ble/gdict#get _ble_builtin_trap_name2sig "$upper" || + ble/gdict#get _ble_builtin_trap_name2sig "SIG$upper" || + return 1 + ble/gdict#set _ble_builtin_trap_name2sig "$1" "$ret" + return 0 + fi +} +function ble/builtin/trap/sig#new { + local name=$1 opts=$2 + local sig=$((_ble_builtin_trap_$name=_ble_builtin_trap_sig_base++)) + ble/builtin/trap/sig#register "$sig" "$name" + if [[ :$opts: != *:builtin:* ]]; then + ble/builtin/trap/sig#reserve "$sig" "$opts" + fi +} +function ble/builtin/trap/sig#init { + function ble/builtin/trap/sig#init { return 0; } + local ret i + ble/util/assign-words ret 'builtin trap -l' 2>/dev/null + for ((i=0;i<${#ret[@]};i+=2)); do + local index=${ret[i]%')'} + local name=${ret[i+1]} + ble/builtin/trap/sig#register "$index" "$name" + done + _ble_builtin_trap_EXIT=0 + ble/builtin/trap/sig#register "$_ble_builtin_trap_EXIT" EXIT + ble/builtin/trap/sig#new DEBUG builtin + ble/builtin/trap/sig#new RETURN builtin + ble/builtin/trap/sig#new ERR builtin +} +_ble_builtin_trap_handlers=() +_ble_builtin_trap_handlers_RETURN=() +function ble/builtin/trap/user-handler#load { + local sig=$1 name=${_ble_builtin_trap_sig_name[$1]} + if [[ $name == RETURN ]]; then + ble/builtin/trap/user-handler#load:RETURN + else + _ble_trap_handler=${_ble_builtin_trap_handlers[sig]-} + [[ ${_ble_builtin_trap_handlers[sig]+set} ]] + fi +} +function ble/builtin/trap/user-handler#save { + local sig=$1 name=${_ble_builtin_trap_sig_name[$1]} handler=$2 + if [[ $name == RETURN ]]; then + ble/builtin/trap/user-handler#save:RETURN "$handler" + else + if [[ $handler == - ]]; then + builtin unset -v '_ble_builtin_trap_handlers[sig]' + else + _ble_builtin_trap_handlers[sig]=$handler + fi + fi + return 0 +} +function ble/builtin/trap/user-handler#save:RETURN { + local handler=$1 + local offset= + for ((offset=1;offset<${#FUNCNAME[@]};offset++)); do + case ${FUNCNAME[offset]} in + (trap | ble/builtin/trap) ;; + (ble/builtin/trap/user-handler#save) ;; + (*) break ;; + esac + done + local current_level=$((${#FUNCNAME[@]}-offset)) + local level + for level in "${!_ble_builtin_trap_handlers_RETURN[@]}"; do + if ((level>current_level)); then + builtin unset -v '_ble_builtin_trap_handlers_RETURN[level]' + fi + done + if [[ $handler == - ]]; then + if [[ $- == *T* ]] || shopt -q extdebug; then + for ((level=current_level;level>=0;level--)); do + builtin unset -v '_ble_builtin_trap_handlers_RETURN[level]' + done + else + for ((level=current_level;level>=0;level--,offset++)); do + builtin unset -v '_ble_builtin_trap_handlers_RETURN[level]' + ((level)) && ble/function#has-attr "${FUNCNAME[offset]}" t || break + done + fi + else + _ble_builtin_trap_handlers_RETURN[current_level]=$handler + fi + return 0 +} +function ble/builtin/trap/user-handler#load:RETURN { + local offset= in_trap= + for ((offset=1;offset<${#FUNCNAME[@]};offset++)); do + case ${FUNCNAME[offset]} in + (trap | ble/builtin/trap) ;; + (ble/builtin/trap/.handler) ;; + (ble/builtin/trap/user-handler#load) ;; + (ble/builtin/trap/user-handler#has) ;; + (ble/builtin/trap/finalize) ;; + (ble/builtin/trap/install-hook) ;; + (ble/builtin/trap/invoke) ;; + (*) break ;; + esac + done + local search_level= + if [[ $- == *T* ]] || shopt -q extdebug; then + search_level=0 + else + for ((;offset<${#FUNCNAME[@]};offset++)); do + ble/function#has-attr "${FUNCNAME[offset]}" t || break + done + search_level=$((${#FUNCNAME[@]}-offset)) + fi + local level found= handler= + for level in "${!_ble_builtin_trap_handlers_RETURN[@]}"; do + ((level>=search_level)) || continue + found=1 handler=${_ble_builtin_trap_handlers_RETURN[level]} + done + _ble_trap_handler=$handler + [[ $found ]] +} +function ble/builtin/trap/user-handler#update:RETURN { + local offset=2 # ... ble/builtin/trap/.handler から直接呼び出されると仮定 + local current_level=$((${#FUNCNAME[@]}-offset)) + ((current_level>0)) || return 0 + local level found= handler= + for level in "${!_ble_builtin_trap_handlers_RETURN[@]}"; do + ((level>=current_level)) || continue + found=1 handler=${_ble_builtin_trap_handlers_RETURN[level]} + if ((level>=current_level)); then + builtin unset -v '_ble_builtin_trap_handlers_RETURN[level]' + fi + done + if [[ $found ]]; then + _ble_builtin_trap_handlers_RETURN[current_level-1]=$handler + fi +} +function ble/builtin/trap/user-handler#has { + local _ble_trap_handler + ble/builtin/trap/user-handler#load "$1" +} +function ble/builtin/trap/user-handler#init { + local script _ble_builtin_trap_user_handler_init=1 + ble/util/assign script 'builtin trap -p' + builtin eval -- "$script" +} +function ble/builtin/trap/user-handler/is-internal { + case $1 in + ('ble/builtin/trap/'*) return 0 ;; # ble-0.4 + ('ble/base/unload'*|'ble-edit/'*) return 0 ;; # bash-0.3 以前 + (*) return 1 ;; + esac +} +function ble/builtin/trap/finalize { + _ble_builtin_trap_handlers_reload=() + local sig unload_opts=$1 + for sig in "${!_ble_builtin_trap_sig_opts[@]}"; do + local name=${_ble_builtin_trap_sig_name[sig]} + local opts=${_ble_builtin_trap_sig_opts[sig]} + [[ $name && :$opts: == *:override-builtin-signal:* ]] || continue + if [[ :$opts: == *:readline:* && :$unload_opts: == *:reload:* ]]; then + if local _ble_trap_handler; ble/builtin/trap/user-handler#load "$sig"; then + local q=\' Q="'\''" + _ble_builtin_trap_handlers_reload[sig]="trap -- '${_ble_trap_handler//$q/$Q}' $name" + else + _ble_builtin_trap_handlers_reload[sig]= + fi + continue + fi + if local _ble_trap_handler; ble/builtin/trap/user-handler#load "$sig"; then + builtin trap -- "$_ble_trap_handler" "$name" + else + builtin trap -- - "$name" + fi + done +} +function ble/builtin/trap { + local set shopt; ble/base/.adjust-bash-options set shopt + local flags command sigspecs + ble/builtin/trap/.read-arguments "$@" + if [[ $flags == *h* ]]; then + builtin trap --help + ble/base/.restore-bash-options set shopt + return 2 + elif [[ $flags == *E* ]]; then + builtin trap --usage 2>&1 1>/dev/null | ble/bin/grep ^trap >&2 + ble/base/.restore-bash-options set shopt + return 2 + elif [[ $flags == *l* ]]; then + builtin trap -l + fi + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/adjust-BASH_REMATCH + if [[ $flags == *[pP]* ]]; then + local -a indices=() + if ((${#sigspecs[@]})); then + local spec ret + for spec in "${sigspecs[@]}"; do + if ! ble/builtin/trap/sig#resolve "$spec"; then + ble/util/print "ble/builtin/trap: invalid signal specification \"$spec\"." >&2 + continue + fi + ble/array#push indices "$ret" + done + else + indices=("${!_ble_builtin_trap_handlers[@]}" "$_ble_builtin_trap_RETURN") + fi + local q=\' Q="'\''" index _ble_trap_handler + for index in "${indices[@]}"; do + if ble/builtin/trap/user-handler#load "$index"; then + if [[ $flags == *p* ]]; then + local n=${_ble_builtin_trap_sig_name[index]} + _ble_trap_handler="trap -- '${_ble_trap_handler//$q/$Q}' $n" + fi + ble/util/print "$_ble_trap_handler" + fi + done + else + [[ $_ble_builtin_trap_user_handler_init ]] && + ble/builtin/trap/user-handler/is-internal "$command" && + return 0 + local _ble_builtin_trap_inside=1 + local spec ret + for spec in "${sigspecs[@]}"; do + if ! ble/builtin/trap/sig#resolve "$spec"; then + ble/util/print "ble/builtin/trap: invalid signal specification \"$spec\"." >&2 + continue + fi + local sig=$ret + local name=${_ble_builtin_trap_sig_name[sig]} + ble/builtin/trap/user-handler#save "$sig" "$command" + [[ $_ble_builtin_trap_user_handler_init ]] && continue + local trap_command='builtin trap -- "$command" "$spec"' + local install_opts=${_ble_builtin_trap_sig_opts[sig]} + if [[ $install_opts ]]; then + local custom_trap=ble/builtin/trap:$name + if ble/is-function "$custom_trap"; then + trap_command='"$custom_trap" "$command" "$spec"' + elif [[ :$install_opts: == *:readline:* ]] && ! ble/util/is-running-in-subshell; then + trap_command= + elif [[ $command == - ]]; then + if [[ :$install_opts: == *:inactive:* ]]; then + trap_command='builtin trap - "$spec"' + else + trap_command= + fi + elif [[ :$install_opts: == *:override-builtin-signal:* ]]; then + ble/builtin/trap/install-hook/.compose-trap_command "$sig" + trap_command="builtin $trap_command" + else + trap_command= + fi + fi + if [[ $trap_command ]]; then + if [[ $name == ERR && $command == - && $- != *E* ]]; then + command= + fi + builtin eval -- "$trap_command" + fi + done + fi + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/restore-BASH_REMATCH + ble/base/.restore-bash-options set shopt + return 0 +} +function trap { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/trap "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +ble/builtin/trap/user-handler#init +function ble/builtin/trap/.TRAPRETURN { + local IFS=$_ble_term_IFS + local backtrace=" ${BLE_TRAP_FUNCNAME[*]-} " + case $backtrace in + (' trap '* | ' ble/builtin/trap '*) return 126 ;; + (*' ble/builtin/trap/.handler '*) + case ${backtrace%%' ble/builtin/trap/.handler '*}' ' in + (' '*' blehook/invoke.sandbox '* | ' '*' ble/builtin/trap/invoke.sandbox '*) ;; + (*) return 126 ;; + esac ;; + (*' _ble_edit_exec_gexec__save_lastarg ' | ' _ble_edit_exec_gexec__TRAPDEBUG_adjust ') return 126 ;; + esac + return 0 +} +blehook internal_RETURN!=ble/builtin/trap/.TRAPRETURN +_ble_builtin_trap_user_lastcmd= +_ble_builtin_trap_user_lastarg= +_ble_builtin_trap_user_lastexit= +function ble/builtin/trap/invoke.sandbox { + local _ble_trap_count + for ((_ble_trap_count=0;_ble_trap_count<1;_ble_trap_count++)); do + local BASH_TRAPSIG=$_ble_trap_sig + _ble_trap_done=return + ble/util/setexit "$_ble_trap_lastexit" "$_ble_trap_lastarg" + builtin eval -- "$_ble_trap_handler"$'\n_ble_trap_lastexit=$? _ble_trap_lastarg=$_' 2>&3 + _ble_trap_done=done + return 0 + done + _ble_trap_lastexit=$? _ble_trap_lastarg=$_ + if ((_ble_trap_count==0)); then + _ble_trap_done=break + else + _ble_trap_done=continue + fi + return 0 +} +function ble/builtin/trap/invoke { + local _ble_trap_lastexit=$? _ble_trap_lastarg=$_ _ble_trap_sig=$1; shift + if [[ ${_ble_trap_sig//[0-9]} ]]; then + local ret + ble/builtin/trap/sig#resolve "$_ble_trap_sig" || return 1 + _ble_trap_sig=$ret + ble/util/unlocal ret + fi + local _ble_trap_handler + ble/builtin/trap/user-handler#load "$_ble_trap_sig" + [[ $_ble_trap_handler ]] || return 0 + if [[ $_ble_attached && ! $_ble_edit_exec_inside_userspace ]]; then + if [[ $_ble_builtin_trap_user_lastcmd != $_ble_edit_CMD ]]; then + _ble_builtin_trap_user_lastcmd=$_ble_edit_CMD + _ble_builtin_trap_user_lastexit=$_ble_edit_exec_lastexit + _ble_builtin_trap_user_lastarg=$_ble_edit_exec_lastarg + fi + _ble_trap_lastexit=$_ble_builtin_trap_user_lastexit + _ble_trap_lastarg=$_ble_builtin_trap_user_lastarg + fi + local _ble_trap_done= + ble/builtin/trap/invoke.sandbox "$@"; local ext=$? + case $_ble_trap_done in + (done) + _ble_builtin_trap_lastarg[_ble_trap_sig]=$_ble_trap_lastarg + _ble_builtin_trap_postproc[_ble_trap_sig]="ble/util/setexit $_ble_trap_lastexit" ;; + (break | continue) + _ble_builtin_trap_lastarg[_ble_trap_sig]=$_ble_trap_lastarg + if ble/string#match "$_ble_trap_lastarg" '^-?[0-9]+$'; then + _ble_builtin_trap_postproc[_ble_trap_sig]="$_ble_trap_done $_ble_trap_lastarg" + else + _ble_builtin_trap_postproc[_ble_trap_sig]=$_ble_trap_done + fi ;; + (return) + _ble_builtin_trap_lastarg[_ble_trap_sig]=$ext + _ble_builtin_trap_postproc[_ble_trap_sig]="return $ext" ;; + (exit) + _ble_builtin_trap_lastarg[_ble_trap_sig]=$_ble_trap_lastarg + _ble_builtin_trap_postproc[_ble_trap_sig]="ble/builtin/exit $_ble_trap_lastarg" ;; + esac + if [[ $_ble_attached && ! $_ble_edit_exec_inside_userspace ]]; then + _ble_builtin_trap_user_lastexit=$_ble_trap_lastexit + _ble_builtin_trap_user_lastarg=$_ble_trap_lastarg + fi + return 0 +} 3>&2 2>/dev/null # set -x 対策 #D0930 +_ble_builtin_trap_processing= +_ble_builtin_trap_postproc=() +_ble_builtin_trap_lastarg=() +function ble/builtin/trap/install-hook/.compose-trap_command { + local sig=$1 name=${_ble_builtin_trap_sig_name[$1]} + local handler='ble/builtin/trap/.handler SIGNUM "$BASH_COMMAND" "$@"; builtin eval -- "${_ble_builtin_trap_postproc[SIGNUM]}" \# "${_ble_builtin_trap_lastarg[SIGNUM]}"' + trap_command="trap -- '${handler//SIGNUM/$sig}' $name" # WA #D1738 checked (sig is integer) +} +_ble_trap_builtin_handler_DEBUG_filter= +function ble/builtin/trap/.handler { + local _ble_trap_lastexit=$? _ble_trap_lastarg=$_ FUNCNEST= IFS=$_ble_term_IFS + local _ble_trap_sig=$1 _ble_trap_bash_command=$2 + shift 2 + if [[ $_ble_bash_read_winch && ${_ble_builtin_trap_sig_name[_ble_trap_sig]} == SIGWINCH ]]; then + local ret + ble/string#quote-command "$FUNCNAME" "$_ble_trap_sig" "$_ble_trap_bash_command" "$@" + _ble_bash_read_winch=$ret$'\n''builtin eval -- "${_ble_builtin_trap_postproc['$_ble_trap_sig']}"' + return 0 + fi + if ((_ble_trap_sig==_ble_builtin_trap_DEBUG)) && + ! builtin eval -- "$_ble_trap_builtin_handler_DEBUG_filter"; then + _ble_builtin_trap_lastarg[_ble_trap_sig]=${_ble_trap_lastarg//*$_ble_term_nl*} + _ble_builtin_trap_postproc[_ble_trap_sig]="ble/util/setexit $_ble_trap_lastexit" + return 0 + fi + local _ble_trap_set _ble_trap_shopt; ble/base/.adjust-bash-options _ble_trap_set _ble_trap_shopt + local _ble_trap_name=${_ble_builtin_trap_sig_name[_ble_trap_sig]#SIG} + local -a _ble_trap_args; _ble_trap_args=("$@") + if [[ ! $_ble_trap_bash_command ]] || ((_ble_bash<30200)); then + if [[ $_ble_attached ]]; then + _ble_trap_bash_command=$_ble_edit_exec_BASH_COMMAND + else + ble/util/assign _ble_trap_bash_command 'HISTTIMEFORMAT=__ble_ext__ builtin history 1' + _ble_trap_bash_command=${_ble_trap_bash_command#*__ble_ext__} + fi + fi + local _ble_builtin_trap_processing=${BASH_SUBSHELL:-0}/$_ble_trap_sig + _ble_builtin_trap_lastarg[_ble_trap_sig]=$_ble_trap_lastarg + _ble_builtin_trap_postproc[_ble_trap_sig]="ble/util/setexit $_ble_trap_lastexit" + if [[ $_ble_builtin_exit_processing ]]; then + exec 1>&- 1>&"$_ble_builtin_exit_stdout" + exec 2>&- 2>&"$_ble_builtin_exit_stderr" + fi + local BLE_TRAP_FUNCNAME BLE_TRAP_SOURCE BLE_TRAP_LINENO + BLE_TRAP_FUNCNAME=("${FUNCNAME[@]:1}") + BLE_TRAP_SOURCE=("${BASH_SOURCE[@]:1}") + BLE_TRAP_LINENO=("${BASH_LINENO[@]}") + [[ $_ble_attached ]] && + BLE_TRAP_LINENO[${#BASH_LINENO[@]}-1]=$_ble_edit_LINENO + ble/util/joblist.check + ble/util/setexit "$_ble_trap_lastexit" "$_ble_trap_lastarg" + blehook/invoke "internal_$_ble_trap_name"; local internal_ext=$? + ble/util/joblist.check ignore-volatile-jobs + if ((internal_ext!=126)); then + if ! ble/util/is-running-in-subshell; then + ble/util/setexit "$_ble_trap_lastexit" "$_ble_trap_lastarg" + BASH_COMMAND=$_ble_trap_bash_command \ + blehook/invoke "$_ble_trap_name" + ble/util/joblist.check ignore-volatile-jobs + fi + local install_opts=${_ble_builtin_trap_sig_opts[_ble_trap_sig]} + if [[ :$install_opts: == *:user-trap-in-postproc:* ]]; then + local q=\' Q="'\''" _ble_trap_handler postproc= + ble/builtin/trap/user-handler#load "$_ble_trap_sig" + if [[ $_ble_trap_handler == *[!$_ble_term_IFS]* ]]; then + postproc="ble/util/setexit $_ble_trap_lastexit '${_ble_trap_lastarg//$q/$Q}'" + postproc=$postproc";LINENO=$BLE_TRAP_LINENO builtin eval -- '${_ble_trap_handler//$q/$Q}'" + else + postproc="ble/util/setexit $_ble_trap_lastexit" + fi + _ble_builtin_trap_postproc[_ble_trap_sig]=$postproc + else + ble/util/setexit "$_ble_trap_lastexit" "$_ble_trap_lastarg" + BASH_COMMAND=$_ble_trap_bash_command LINENO=$BLE_TRAP_LINENO \ + ble/builtin/trap/invoke "$_ble_trap_sig" "${_ble_trap_args[@]}" + fi + fi + if [[ $_ble_builtin_trap_processing == */exit:* && ${_ble_builtin_trap_postproc[_ble_trap_sig]} != 'ble/builtin/exit '* ]]; then + _ble_builtin_trap_postproc[_ble_trap_sig]="ble/builtin/exit ${_ble_builtin_trap_processing#*/exit:}" + fi + [[ ${_ble_builtin_trap_lastarg[_ble_trap_sig]} == *$'\n'* ]] && + _ble_builtin_trap_lastarg[_ble_trap_sig]= + if ((_ble_trap_sig==_ble_builtin_trap_EXIT)); then + ble/base/unload EXIT + elif ((_ble_trap_sig==_ble_builtin_trap_RETURN)); then + ble/builtin/trap/user-handler#update:RETURN + fi + ble/base/.restore-bash-options _ble_trap_set _ble_trap_shopt +} +function ble/builtin/trap/install-hook { + local ret opts=${2-} + ble/builtin/trap/sig#resolve "$1" + local sig=$ret name=${_ble_builtin_trap_sig_name[ret]} + ble/builtin/trap/sig#reserve "$sig" "override-builtin-signal:$opts" + local trap_command; ble/builtin/trap/install-hook/.compose-trap_command "$sig" + local trap_string; ble/util/assign trap_string "builtin trap -p $name" + if [[ :$opts: == *:readline:* ]] && ! ble/util/is-running-in-subshell; then + [[ $trap_command == "$trap_string" ]] && trap_command= trap_string= + [[ $trap_string ]] || trap_string=${_ble_builtin_trap_handlers_reload[sig]-} + fi + [[ ! $trap_command || :$opts: == *:inactive:* && ! $trap_string ]] || + builtin eval "builtin $trap_command"; local ext=$? + local q=\' + if [[ $trap_string == "trap -- '"* ]] && ! ble/builtin/trap/user-handler/is-internal "${trap_string#*$q}"; then + ((sig<1000)) && + ! ble/builtin/trap/user-handler#has "$sig" && + builtin eval -- ble/builtin/"$trap_string" + fi + return "$ext" +} +if ! builtin type ble/util/print &>/dev/null; then + function ble/util/unlocal { builtin unset -v "$@"; } + function ble/util/print { builtin printf '%s\n' "$1"; } + function ble/util/print-lines { builtin printf '%s\n' "$@"; } +fi +function ble-measure/.loop { + builtin eval "function _target { ${2:+"$2; "}return 0; }" + local __ble_i __ble_n=$1 + for ((__ble_i=0;__ble_i<__ble_n;__ble_i++)); do + _target + done +} +if ((BASH_VERSINFO[0]>=5)) || + { [[ ${ZSH_VERSION-} ]] && zmodload zsh/datetime &>/dev/null && [[ ${EPOCHREALTIME-} ]]; } || + [[ ${SECONDS-} == *.??? ]] +then + if [[ ${EPOCHREALTIME-} ]]; then + _ble_measure_resolution=1 # [usec] + function ble-measure/.get-realtime { + local LC_ALL= LC_NUMERIC=C + ret=$EPOCHREALTIME + } + else + _ble_measure_resolution=1000 # [usec] + function ble-measure/.get-realtime { + ret=$SECONDS + } + fi + function ble-measure/.time { + ble-measure/.get-realtime 2>/dev/null; local __ble_time1=$ret + ble-measure/.loop "$1" "$2" &>/dev/null + ble-measure/.get-realtime 2>/dev/null; local __ble_time2=$ret + local __ble_frac + [[ $__ble_time1 == *.* ]] || __ble_time1=${__ble_time1}. + __ble_frac=${__ble_time1##*.}000000 __ble_time1=${__ble_time1%%.*}${__ble_frac:0:6} + [[ $__ble_time2 == *.* ]] || __ble_time2=${__ble_time2}. + __ble_frac=${__ble_time2##*.}000000 __ble_time2=${__ble_time2%%.*}${__ble_frac:0:6} + ((ret=__ble_time2-__ble_time1)) + ((ret==0&&(ret=_ble_measure_resolution))) + ((ret>0)) + } +elif [[ ${ZSH_VERSION-} ]]; then + _ble_measure_resolution=1000 # [usec] + function ble-measure/.time { + local result= + result=$({ time ( ble-measure/.loop "$1" "$2" ; ) } 2>&1 ) + result=${result##*cpu } + local rex='(([0-9]+):)?([0-9]+)\.([0-9]+) total$' + if [[ $result =~ $rex ]]; then + if [[ -o KSH_ARRAYS ]]; then + local m=${match[1]} s=${match[2]} ms=${match[3]} + else + local m=${match[2]} s=${match[3]} ms=${match[4]} + fi + m=${m:-0} ms=${ms}000; ms=${ms:0:3} + ((ret=((10#0$m*60+10#0$s)*1000+10#0$ms)*1000)) + return 0 + else + builtin echo "ble-measure: failed to read the result of \`time': $result." >&2 + ret=0 + return 1 + fi + } +else + _ble_measure_resolution=1000 # [usec] + function ble-measure/.time { + ret=0 + local result TIMEFORMAT='[%R]' __ble_n=$1 __ble_command=$2 + if declare -f ble/util/assign &>/dev/null; then + ble/util/assign result '{ time ble-measure/.loop "$__ble_n" "$__ble_command" &>/dev/null;} 2>&1' + else + result=$({ time ble-measure/.loop "$1" "$2" &>/dev/null;} 2>&1) + fi + local rex='\[([0-9]+)(\.([0-9]+))?\]' + [[ $result =~ $rex ]] || return 1 + local s=${BASH_REMATCH[1]} + local ms=${BASH_REMATCH[3]}000; ms=${ms::3} + ((ret=(10#0$s*1000+10#0$ms)*1000)) + return 0 + } +fi +_ble_measure_base= # [nsec] +_ble_measure_base_nestcost=0 # [nsec/10] +_ble_measure_base_real=() +_ble_measure_base_guess=() +_ble_measure_count=1 # 同じ倍率で _ble_measure_count 回計測して最小を取る。 +_ble_measure_threshold=100000 # 一回の計測が threshold [usec] 以上になるようにする +function ble-measure/calibrate.0 { ble-measure -qc"$calibrate_count" ''; } +function ble-measure/calibrate.1 { ble-measure/calibrate.0; } +function ble-measure/calibrate.2 { ble-measure/calibrate.1; } +function ble-measure/calibrate.3 { ble-measure/calibrate.2; } +function ble-measure/calibrate.4 { ble-measure/calibrate.3; } +function ble-measure/calibrate.5 { ble-measure/calibrate.4; } +function ble-measure/calibrate.6 { ble-measure/calibrate.5; } +function ble-measure/calibrate.7 { ble-measure/calibrate.6; } +function ble-measure/calibrate.8 { ble-measure/calibrate.7; } +function ble-measure/calibrate.9 { ble-measure/calibrate.8; } +function ble-measure/calibrate.A { ble-measure/calibrate.9; } +function ble-measure/calibrate { + local ret= nsec= + local calibrate_count=1 + _ble_measure_base=0 + _ble_measure_base_nestcost=0 + local nest0=$((${#FUNCNAME[@]}+2)) + [[ ${ZSH_VERSION-} ]] && nest0=$((${#funcstack[@]}+2)) + ble-measure/calibrate.0; local x0=$nsec + ble-measure/calibrate.A; local xA=$nsec + local nest_cost=$((xA-x0)) + _ble_measure_base=$((x0-nest_cost*nest0/10)) + _ble_measure_base_nestcost=$nest_cost +} +function ble-measure/fit { + local ret nsec + _ble_measure_base=0 + _ble_measure_base_nestcost=0 + local calibrate_count=10 + local c= nest_level=${#FUNCNAME[@]} + for c in {0..9} A; do + "ble-measure/calibrate.$c" + ble/util/print "$((nest_level++)) $nsec" + done > ble-measure-fit.txt + gnuplot - <&2 + if ! ble-measure/.time "$n" "$command"; then + builtin eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}" + return 1 + fi + [[ $flags != *V* ]] && printf '\r\e[2K' >&2 + ((utot=ret,utot>=measure_threshold||n==__ble_max_n)) || continue + prev_n=$n prev_utot=$utot + local min_utot=$utot + if [[ $count ]]; then + local sum_utot=$utot sum_count=1 i + for ((i=2;i<=count;i++)); do + [[ $flags != *V* ]] && printf '%s' "$command (x$n $i/$count)..." >&2 + if ble-measure/.time "$n" "$command"; then + ((utot=ret,utot&2 + done + if [[ $flags == *a* ]]; then + ((utot=sum_utot/sum_count)) + else + utot=$min_utot + fi + fi + if ((min_utot<0x7FFFFFFFFFFFFFFF/1000)); then + local __ble_real=$((min_utot*1000/n)) + [[ ${_ble_measure_base_real[__ble_level]} ]] && + ((__ble_real<_ble_measure_base_real[__ble_level])) && + _ble_measure_base_real[__ble_level]=$__ble_real + [[ ${_ble_measure_base_guess[__ble_level]} ]] && + ((__ble_real<_ble_measure_base_guess[__ble_level])) && + _ble_measure_base_guess[__ble_level]=$__ble_real + ((__ble_real<__ble_base)) && + __ble_base=$__ble_real + fi + local nsec0=$__ble_base + if [[ $flags != *q* ]]; then + local reso=$_ble_measure_resolution + local awk=ble/bin/awk + builtin type -- "$awk" &>/dev/null || awk=awk + local -x title="$command (x$n)" + "$awk" -v utot="$utot" -v nsec0="$nsec0" -v n="$n" -v reso="$reso" ' + function genround(x, mod) { return int(x / mod + 0.5) * mod; } + BEGIN { title = ENVIRON["title"]; printf("%12.3f usec/eval: %s\n", genround(utot / n - nsec0 / 1000, reso / 10.0 / n), title); exit }' + fi + local out + ((out=utot/n)) + if ((n>=1000)); then + ((nsec=utot/(n/1000))) + else + ((nsec=utot*1000/n)) + fi + ((out-=nsec0/1000,nsec-=nsec0)) + ret=$out + builtin eval -- "${_ble_bash_POSIXLY_CORRECT_local_leave-}" + return 0 + done + builtin eval -- "${_ble_bash_POSIXLY_CORRECT_local_return-}" +} +function ble/util/msleep/.check-sleep-decimal-support { + local version; ble/util/assign version 'LC_ALL=C ble/bin/sleep --version 2>&1' 2>/dev/null # suppress locale error #D1440 + [[ $version == *'GNU coreutils'* || $OSTYPE == darwin* && $version == 'usage: sleep seconds' ]] +} +_ble_util_msleep_delay=2000 # [usec] +function ble/util/msleep/.core { + local sec=${1%%.*} + ((10#0${1##*.}&&sec++)) # 小数部分は切り上げ + ble/bin/sleep "$sec" +} +function ble/util/msleep { + local v=$((1000*$1-_ble_util_msleep_delay)) + ((v<=0)) && v=0 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + ble/util/msleep/.core "$v" +} +_ble_util_msleep_calibrate_count=0 +function ble/util/msleep/.calibrate-loop { + local _ble_measure_threshold=10000 + local ret nsec _ble_measure_count=1 v=0 + _ble_util_msleep_delay=0 ble-measure -q 'ble/util/msleep 1' + local delay=$((nsec/1000-1000)) count=$_ble_util_msleep_calibrate_count + ((count<=0||delay<_ble_util_msleep_delay)) && _ble_util_msleep_delay=$delay # 最小値 +} +function ble/util/msleep/calibrate { + ble/util/msleep/.calibrate-loop &>/dev/null + ((++_ble_util_msleep_calibrate_count<5)) && + ble/util/idle.continue +} +function ble/util/msleep/.use-read-timeout { + local msleep_type=$1 opts=${2-} + _ble_util_msleep_fd= + case $msleep_type in + (socket) + _ble_util_msleep_delay1=10000 # short msleep にかかる時間 [usec] + _ble_util_msleep_delay2=50000 # /bin/sleep 0 にかかる時間 [usec] + function ble/util/msleep/.core2 { + ((v-=_ble_util_msleep_delay2)) + ble/bin/sleep "$((v/1000000))" + ((v%=1000000)) + } + function ble/util/msleep { + local v=$((1000*$1-_ble_util_msleep_delay1)) + ((v<=0)) && v=100 + ((v>1000000+_ble_util_msleep_delay2)) && + ble/util/msleep/.core2 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + ! ble/bash/read-timeout "$v" v < /dev/udp/0.0.0.0/80 + } + function ble/util/msleep/.calibrate-loop { + local _ble_measure_threshold=10000 + local ret nsec _ble_measure_count=1 v=0 + _ble_util_msleep_delay1=0 ble-measure 'ble/util/msleep 1' + local delay=$((nsec/1000-1000)) count=$_ble_util_msleep_calibrate_count + ((count<=0||delay<_ble_util_msleep_delay1)) && _ble_util_msleep_delay1=$delay # 最小値 + _ble_util_msleep_delay2=0 ble-measure 'ble/util/msleep/.core2' + local delay=$((nsec/1000)) + ((count<=0||delay<_ble_util_msleep_delay2)) && _ble_util_msleep_delay2=$delay # 最小値 + } ;; + (procsub) + _ble_util_msleep_delay=300 + ble/fd#alloc _ble_util_msleep_fd '< <( + [[ $- == *i* ]] && builtin trap -- '' INT QUIT + while kill -0 $$; do command sleep 300; done &>/dev/null + )' + function ble/util/msleep { + local v=$((1000*$1-_ble_util_msleep_delay)) + ((v<=0)) && v=100 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + ! ble/bash/read-timeout "$v" -u "$_ble_util_msleep_fd" v + } ;; + (*.*) + if local rex='^(fifo|zero|ptmx)\.(open|exec)([12])(-[_a-zA-Z0-9]+)?$'; [[ $msleep_type =~ $rex ]]; then + local file=${BASH_REMATCH[1]} + local open=${BASH_REMATCH[2]} + local direction=${BASH_REMATCH[3]} + local fall=${BASH_REMATCH[4]} + case $file in + (fifo) + _ble_util_msleep_tmp=$_ble_base_run/$$.util.msleep.pipe + if [[ ! -p $_ble_util_msleep_tmp ]]; then + [[ -e $_ble_util_msleep_tmp ]] && ble/bin/rm -rf "$_ble_util_msleep_tmp" + ble/bin/mkfifo "$_ble_util_msleep_tmp" + fi ;; + (zero) + open=dup + _ble_util_msleep_tmp=$_ble_util_fd_zero ;; + (ptmx) + _ble_util_msleep_tmp=/dev/ptmx ;; + esac + local redir='<' + ((direction==2)) && redir='<>' + if [[ $open == dup ]]; then + _ble_util_msleep_fd=$_ble_util_msleep_tmp + _ble_util_msleep_read='! ble/bash/read-timeout "$v" -u "$_ble_util_msleep_fd" v' + elif [[ $open == exec ]]; then + ble/fd#alloc _ble_util_msleep_fd "$redir \"\$_ble_util_msleep_tmp\"" base + _ble_util_msleep_read='! ble/bash/read-timeout "$v" -u "$_ble_util_msleep_fd" v' + else + _ble_util_msleep_read='! ble/bash/read-timeout "$v" v '$redir' "$_ble_util_msleep_tmp"' + fi + if [[ $fall == '-coreutil' ]]; then + _ble_util_msleep_switch=200 # [msec] + _ble_util_msleep_delay1=2000 # short msleep にかかる時間 [usec] + _ble_util_msleep_delay2=50000 # /bin/sleep 0 にかかる時間 [usec] + function ble/util/msleep { + if (($1<_ble_util_msleep_switch)); then + local v=$((1000*$1-_ble_util_msleep_delay1)) + ((v<=0)) && v=100 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + builtin eval -- "$_ble_util_msleep_read" + else + local v=$((1000*$1-_ble_util_msleep_delay2)) + ((v<=0)) && v=100 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + ble/bin/sleep "$v" + fi + } + function ble/util/msleep/.calibrate-loop { + local _ble_measure_threshold=10000 + local ret nsec _ble_measure_count=1 + _ble_util_msleep_switch=200 + _ble_util_msleep_delay1=0 ble-measure 'ble/util/msleep 1' + local delay=$((nsec/1000-1000)) count=$_ble_util_msleep_calibrate_count + ((count<=0||delay<_ble_util_msleep_delay1)) && _ble_util_msleep_delay1=$delay # 最小値を選択 + _ble_util_msleep_delay2=0 ble-measure 'ble/bin/sleep 0' + local delay=$((nsec/1000)) + ((count<=0||delay<_ble_util_msleep_delay2)) && _ble_util_msleep_delay2=$delay # 最小値を選択 + ((_ble_util_msleep_switch=_ble_util_msleep_delay2/1000+10)) + } + else + function ble/util/msleep { + local v=$((1000*$1-_ble_util_msleep_delay)) + ((v<=0)) && v=100 + ble/util/sprintf v '%d.%06d' "$((v/1000000))" "$((v%1000000))" + builtin eval -- "$_ble_util_msleep_read" + } + fi + fi ;; + esac + if [[ :$opts: == *:check:* && $_ble_util_msleep_fd ]]; then + if ble/bash/read-timeout 0.000001 -u "$_ble_util_msleep_fd" _ble_util_msleep_dummy 2>/dev/null; (($?<=128)); then + ble/fd#close _ble_util_msleep_fd + _ble_util_msleep_fd= + return 1 + fi + fi + return 0 +} +_ble_util_msleep_builtin_available= +if ((_ble_bash>=40400)) && ble/util/load-standard-builtin sleep; then + _ble_util_msleep_builtin_available=1 + _ble_util_msleep_delay=300 + function ble/util/msleep/.core { builtin sleep "$1"; } + function ble/builtin/sleep/.read-time { + a1=0 b1=0 + local unit= exp= + if local rex='^\+?([0-9]*)\.([0-9]*)([eE][-+]?[0-9]+)?([smhd]?)$'; [[ $1 =~ $rex ]]; then + a1=${BASH_REMATCH[1]} + b1=${BASH_REMATCH[2]}00000000000000 + b1=$((10#0${b1::14})) + exp=${BASH_REMATCH[3]} + unit=${BASH_REMATCH[4]} + elif rex='^\+?([0-9]+)([eE][-+]?[0-9]+)?([smhd]?)$'; [[ $1 =~ $rex ]]; then + a1=${BASH_REMATCH[1]} + exp=${BASH_REMATCH[2]} + unit=${BASH_REMATCH[3]} + else + ble/util/print "ble/builtin/sleep: invalid time spec '$1'" >&2 + flags=E$flags + return 2 + fi + if [[ $exp ]]; then + case $exp in + ([eE]-*) + ((exp=10#0${exp:2})) + while ((exp--)); do + ((b1=a1%10*frac_scale/10+b1/10,a1/=10)) + done ;; + ([eE]*) + exp=${exp:1} + ((exp=${exp#+})) + while ((exp--)); do + ((b1*=10,a1=a1*10+b1/frac_scale,b1%=frac_scale)) + done ;; + esac + fi + local scale= + case $unit in + (d) ((scale=24*3600)) ;; + (h) ((scale=3600)) ;; + (m) ((scale=60)) ;; + esac + if [[ $scale ]]; then + ((b1*=scale)) + ((a1=a1*scale+b1/frac_scale)) + ((b1%=frac_scale)) + fi + return 0 + } + function ble/builtin/sleep { + local set shopt; ble/base/.adjust-bash-options set shopt + local frac_scale=100000000000000 + local a=0 b=0 flags= + if (($#==0)); then + ble/util/print "ble/builtin/sleep: no argument" >&2 + flags=E$flags + fi + while (($#)); do + case $1 in + (--version) flags=v$flags ;; + (--help) flags=h$flags ;; + (-*) + flags=E$flags + ble/util/print "ble/builtin/sleep: unknown option '$1'" >&2 ;; + (*) + if local a1 b1; ble/builtin/sleep/.read-time "$1"; then + ((b+=b1)) + ((a=a+a1+b/frac_scale)) + ((b%=frac_scale)) + fi ;; + esac + shift + done + if [[ $flags == *h* ]]; then + ble/util/print-lines \ + 'usage: sleep NUMBER[SUFFIX]...' \ + 'Pause for the time specified by the sum of the arguments. SUFFIX is one of "s"' \ + '(seconds), "m" (minutes), "h" (hours) or "d" (days).' \ + '' \ + 'OPTIONS' \ + ' --help Show this help.' \ + ' --version Show version.' + fi + if [[ $flags == *v* ]]; then + ble/util/print "sleep (ble) $BLE_VERSION" + fi + if [[ $flags == *E* ]]; then + ble/util/setexit 2 + elif [[ $flags == *[vh]* ]]; then + ble/util/setexit 0 + else + b=00000000000000$b + b=${b:${#b}-14} + builtin sleep "$a.$b" + fi + local ext=$? + ble/base/.restore-bash-options set shopt 1 + return "$ext" + } + function sleep { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/sleep "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" + } +elif [[ -f $_ble_base/lib/init-msleep.sh ]] && + source -- "$_ble_base/lib/init-msleep.sh" && + ble/util/msleep/.load-compiled-builtin +then + function ble/util/msleep { ble/builtin/msleep "$1"; } +elif ((40000<=_ble_bash&&!(40300<=_ble_bash&&_ble_bash<50200))) && + [[ $OSTYPE != cygwin* && $OSTYPE != mingw* && $OSTYPE != haiku* && $OSTYPE != minix* ]] +then + ble/util/msleep/.use-read-timeout fifo.exec2 +elif ((_ble_bash>=40000)) && ble/fd#is-open "$_ble_util_fd_zero"; then + ble/util/msleep/.use-read-timeout zero.exec1-coreutil +elif ble/bin#freeze-utility-path sleepenh; then + function ble/util/msleep/.core { ble/bin/sleepenh "$1" &>/dev/null; } +elif ble/bin#freeze-utility-path usleep; then + function ble/util/msleep { + local v=$((1000*$1-_ble_util_msleep_delay)) + ((v<=0)) && v=0 + ble/bin/usleep "$v" &>/dev/null + } +elif ble/util/msleep/.check-sleep-decimal-support; then + function ble/util/msleep/.core { ble/bin/sleep "$1"; } +fi +function ble/util/sleep { + local msec=$((${1%%.*}*1000)) + if [[ $1 == *.* ]]; then + frac=${1##*.}000 + ((msec+=10#0${frac::3})) + fi + ble/util/msleep "$msec" +} +function ble/util/conditional-sync/.collect-descendant-pids { + local pid=$1 awk_script=' + $1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ { + child[$2,child[$2]++]=$1; + } + function print_recursive(pid, _, n, i) { + if (child[pid]) { + n = child[pid]; + child[pid] = 0; # avoid infinite loop + for (i = 0; i < n; i++) { + print_recursive(child[pid, i]); + } + } + print pid; + } + END { print_recursive(pid); } + ' + ble/util/assign ret 'ble/bin/ps -A -o pid,ppid' + ble/util/assign-array ret 'ble/bin/awk -v pid="$pid" "$awk_script" <<< "$ret"' +} +function ble/util/conditional-sync/.kill { + [[ $__ble_pid ]] || return 0 + local kill_pids + if [[ :$__ble_opts: == *:killall:* ]]; then + ble/util/conditional-sync/.collect-descendant-pids "$__ble_pid" + kill_pids=("${ret[@]}") + else + kill_pids=("$__ble_pid") + fi + if [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then + (ble/util/setexit 0) + fi + if [[ :$__ble_opts: == *:SIGKILL:* ]]; then + builtin kill -9 "${kill_pids[@]}" &>/dev/null + else + builtin kill -- "${kill_pids[@]}" &>/dev/null + fi +} &>/dev/null +function ble/util/conditional-sync { + local __ble_command=$1 + local __ble_continue=${2:-'! ble/decode/has-input'} + local __ble_weight=$3; ((__ble_weight<=0&&(__ble_weight=100))) + local __ble_opts=$4 + local __ble_timeout= ret + ble/opts#extract-last-optarg "$__ble_opts" timeout && ((__ble_timeout=ret)) + [[ :$__ble_opts: == *:progressive-weight:* ]] && + local __ble_weight_max=$__ble_weight __ble_weight=1 + ble/opts#extract-last-optarg "$__ble_opts" pid + local __ble_pid=$ret + ble/util/unlocal ret + local sync_elapsed=0 + if [[ $__ble_timeout ]] && ((__ble_timeout<=0)); then + ble/util/conditional-sync/.kill + return 142 + fi + builtin eval -- "$__ble_continue" || return 148 + ( + ble/util/joblist/__suppress__ + [[ $__ble_pid ]] || { builtin eval -- "$__ble_command" & __ble_pid=$!; } + while + if [[ $__ble_timeout ]]; then + if ((__ble_timeout<=0)); then + ble/util/conditional-sync/.kill + return 142 + fi + ((__ble_weight>__ble_timeout)) && __ble_weight=$__ble_timeout + ((__ble_timeout-=__ble_weight)) + fi + ble/util/msleep "$__ble_weight" + ((sync_elapsed+=__ble_weight)) + [[ :$__ble_opts: == *:progressive-weight:* ]] && + ((__ble_weight<<=1,__ble_weight>__ble_weight_max&&(__ble_weight=__ble_weight_max))) + [[ ! $__ble_pid ]] || builtin kill -0 "$__ble_pid" &>/dev/null + do + if ! builtin eval -- "$__ble_continue"; then + ble/util/conditional-sync/.kill + return 148 + fi + done + [[ ! $__ble_pid || :$__ble_opts: == *:no-wait-pid:* ]] || wait "$__ble_pid" + ) +} +function ble/util/cat/.impl { + local content= IFS= + while ble/bash/read -d '' content; do + printf '%s\0' "$content" + done + [[ $content ]] && printf '%s' "$content" +} +function ble/util/cat { + if (($#)); then + local file + for file; do ble/util/cat/.impl < "$1"; done + else + ble/util/cat/.impl + fi +} +_ble_util_less_fallback= +function ble/util/get-pager { + if [[ ! $_ble_util_less_fallback ]]; then + if ble/bin#has less; then + _ble_util_less_fallback=less + elif ble/bin#has pager; then + _ble_util_less_fallback=pager + elif ble/bin#has more; then + _ble_util_less_fallback=more + else + _ble_util_less_fallback=cat + fi + fi + builtin eval "$1=\${bleopt_pager:-\${PAGER:-\$_ble_util_less_fallback}}" +} +function ble/util/pager { + local pager; ble/util/get-pager pager + builtin eval -- "$pager \"\$@\"" +} +_ble_util_file_stat= +function ble/file/has-stat { + if [[ ! $_ble_util_file_stat ]]; then + _ble_util_file_stat=- + if ble/bin#freeze-utility-path -n stat; then + if ble/bin/stat -c %Y / &>/dev/null; then + _ble_util_file_stat=c + elif ble/bin/stat -f %m / &>/dev/null; then + _ble_util_file_stat=f + fi + fi + fi + function ble/file/has-stat { [[ $_ble_util_file_stat != - ]]; } || return 1 + ble/file/has-stat +} +function ble/file#mtime { + function ble/file#mtime { ble/util/time; ret=("$ret"); } || return 1 + if ble/bin/date -r / +%s &>/dev/null; then + function ble/file#mtime { local file=$1; ble/util/assign-words ret 'ble/bin/date -r "$file" +"%s %N"' 2>/dev/null; } + elif ble/file/has-stat; then + case $_ble_util_file_stat in + (c) function ble/file#mtime { local file=$1; ble/util/assign ret 'ble/bin/stat -c %Y "$file"' 2>/dev/null; } ;; + (f) function ble/file#mtime { local file=$1; ble/util/assign ret 'ble/bin/stat -f %m "$file"' 2>/dev/null; } ;; + esac + fi + ble/file#mtime "$@" +} +function ble/file#inode { + function ble/file#inode { ret=; ((0)); } || return 1 + if ble/bin#freeze-utility-path -n ls && + ble/util/assign-words ret 'ble/bin/ls -di /' 2>/dev/null && + ((${#ret[@]}==2)) && ble/string#match "$ret" '^[0-9]+$' + then + function ble/file#inode { local file=$1; ble/util/assign-words ret 'ble/bin/ls -di "$file"' 2>/dev/null; } + elif ble/file/has-stat; then + case $_ble_util_file_stat in + (c) function ble/file#inode { local file=$1; ble/util/assign-words ret 'ble/bin/stat -c %i "$file"' 2>/dev/null; } ;; + (f) function ble/file#inode { local file=$1; ble/util/assign-words ret 'ble/bin/stat -f %i "$file"' 2>/dev/null; } ;; + esac + fi + ble/file#inode "$@" +} +function ble/file#hash { + local file=$1 size + if ! ble/util/assign size 'ble/bin/wc -c "$file" 2>/dev/null'; then + ret=error:$RANDOM + return 1 + fi + ble/string#split-words size "$size" + ble/file#hash/.impl +} +if ble/bin#freeze-utility-path -n git; then + function ble/file#hash/.impl { + ble/util/assign ret 'ble/bin/git hash-object "$file"' + ret="size:$size;hash:$ret" + } +elif ble/bin#freeze-utility-path -n openssl; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/openssl sha1 -r "$file"' + ret="size:$size;sha1:$ret" + } +elif ble/bin#freeze-utility-path -n sha1sum; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/sha1sum "$file"' + ret="size:$size;sha1:$ret" + } +elif ble/bin#freeze-utility-path -n sha1; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/sha1 -r "$file"' + ret="size:$size;sha1:$ret" + } +elif ble/bin#freeze-utility-path -n md5sum; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/md5sum "$file"' + ret="size:$size;md5:$ret" + } +elif ble/bin#freeze-utility-path -n md5; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/md5 -r "$file"' + ret="size:$size;md5:$ret" + } +elif ble/bin#freeze-utility-path -n cksum; then + function ble/file#hash/.impl { + ble/util/assign-words ret 'ble/bin/cksum "$file"' + ret="size:$size;cksum:$ret" + } +else + function ble/file#hash/.impl { + ret="size:$size" + } +fi +_ble_util_buffer=() +function ble/util/buffer { + _ble_util_buffer[${#_ble_util_buffer[@]}]=$1 +} +function ble/util/buffer.print { + ble/util/buffer "$1"$'\n' +} +function ble/util/buffer.print-lines { + local line + for line; do + ble/util/buffer "$line"$'\n' + done +} +function ble/util/buffer.flush { + IFS= builtin eval 'local text="${_ble_util_buffer[*]-}"' + _ble_util_buffer=() + [[ $text ]] || return 0 + if [[ $_ble_term_state == internal ]]; then + if [[ $_ble_term_cursor_hidden_current == hidden ]]; then + text=$_ble_term_civis$text + else + text=$_ble_term_civis$text$_ble_term_rmcivis + fi + [[ $bleopt_term_synchronized_update_mode == on ]] && + text=$'\e[?2026h'$text$'\e[?2026l' + fi + ble/util/put "$text" >&"$_ble_util_fd_tui_stderr" +} +function ble/util/buffer.clear { + _ble_util_buffer=() +} +function ble/dirty-range#load { + local prefix= + if [[ $1 == --prefix=* ]]; then + prefix=${1#--prefix=} + ((beg=${prefix}beg, + end=${prefix}end, + end0=${prefix}end0)) + fi +} +function ble/dirty-range#clear { + local prefix= + if [[ $1 == --prefix=* ]]; then + prefix=${1#--prefix=} + shift + fi + ((${prefix}beg=-1, + ${prefix}end=-1, + ${prefix}end0=-1)) +} +function ble/dirty-range#update { + local prefix= + if [[ $1 == --prefix=* ]]; then + prefix=${1#--prefix=} + shift + [[ $prefix ]] && local beg end end0 + fi + local begB=$1 endB=$2 endB0=$3 + ((begB<0)) && return 1 + local begA endA endA0 + ((begA=${prefix}beg,endA=${prefix}end,endA0=${prefix}end0)) + local delta + if ((begA<0)); then + ((beg=begB, + end=endB, + end0=endB0)) + else + ((beg=begA0?(end+=delta):(end0-=delta))) + fi + fi + if [[ $prefix ]]; then + ((${prefix}beg=beg, + ${prefix}end=end, + ${prefix}end0=end0)) + fi +} +function ble/urange#clear { + local prefix= + if [[ $1 == --prefix=* ]]; then + prefix=${1#*=}; shift + fi + ((${prefix}umin=-1,${prefix}umax=-1)) +} +function ble/urange#update { + local prefix= + if [[ $1 == --prefix=* ]]; then + prefix=${1#*=}; shift + fi + local min=$1 max=$2 + ((0<=min&&min=0)) || return 1 + [[ $shift ]] || ((shift=dend-dend0)) + ((${prefix}umin>=0&&( + dbeg<=${prefix}umin&&(${prefix}umin<=dend0?(${prefix}umin=dend):(${prefix}umin+=shift)), + dbeg<=${prefix}umax&&(${prefix}umax<=dend0?(${prefix}umax=dbeg):(${prefix}umax+=shift))), + ${prefix}umin<${prefix}umax||( + ${prefix}umin=-1, + ${prefix}umax=-1))) +} +_ble_util_joblist_jobs= +_ble_util_joblist_list=() +_ble_util_joblist_events=() +function ble/util/joblist { + local opts=$1 jobs0 + ble/util/assign jobs0 'jobs' + ((_ble_bash>=50300)) && jobs >/dev/null + if [[ $jobs0 == "$_ble_util_joblist_jobs" ]]; then + joblist=("${_ble_util_joblist_list[@]}") + return 0 + elif [[ ! $jobs0 ]]; then + _ble_util_joblist_jobs= + _ble_util_joblist_list=() + joblist=() + return 0 + fi + local lines list ijob + ble/string#split lines $'\n' "$jobs0" + if ((${#lines[@]})); then + ble/util/joblist.split list "${lines[@]}" + else + list=() + fi + if [[ $jobs0 != "$_ble_util_joblist_jobs" ]]; then + for ijob in "${!list[@]}"; do + if [[ ${_ble_util_joblist_list[ijob]} && ${list[ijob]#'['*']'[-+ ]} != "${_ble_util_joblist_list[ijob]#'['*']'[-+ ]}" ]]; then + ble/array#push _ble_util_joblist_events "${list[ijob]}" + list[ijob]= + fi + done + fi + ble/util/assign _ble_util_joblist_jobs 'jobs' + _ble_util_joblist_list=() + if [[ $_ble_util_joblist_jobs != "$jobs0" ]]; then + ble/string#split lines $'\n' "$_ble_util_joblist_jobs" + ble/util/joblist.split _ble_util_joblist_list "${lines[@]}" + if [[ :$opts: != *:ignore-volatile-jobs:* ]]; then + for ijob in "${!list[@]}"; do + local job0=${list[ijob]} + if [[ $job0 && ! ${_ble_util_joblist_list[ijob]} ]]; then + ble/array#push _ble_util_joblist_events "$job0" + fi + done + fi + else + for ijob in "${!list[@]}"; do + [[ ${list[ijob]} ]] && + _ble_util_joblist_list[ijob]=${list[ijob]} + done + fi + joblist=("${_ble_util_joblist_list[@]}") +} 2>/dev/null +function ble/util/joblist/__suppress__ { return 0; } +function ble/util/joblist.split { + local arr=$1; shift + local line ijob= rex_ijob='^\[([0-9]+)\]' + local -a out=() + for line; do + [[ $line =~ $rex_ijob ]] && ijob=${BASH_REMATCH[1]} + [[ $ijob ]] && out[ijob]=${out[ijob]:+${out[ijob]}$_ble_term_nl}$line + done + for ijob in "${!out[@]}"; do + [[ ${out[ijob]} != *'ble/util/joblist/__suppress__'* ]] && + builtin eval -- "$arr[ijob]=\${out[ijob]}" + done +} +function ble/util/joblist.check { + local joblist + ble/util/joblist "$@" +} +function ble/util/joblist.has-events { + local joblist + ble/util/joblist + ((${#_ble_util_joblist_events[@]})) +} +function ble/util/joblist.flush { + local joblist + ble/util/joblist + ((${#_ble_util_joblist_events[@]})) || return 1 + printf '%s\n' "${_ble_util_joblist_events[@]}" + _ble_util_joblist_events=() +} +function ble/util/joblist.bflush { + local joblist out + ble/util/joblist + ((${#_ble_util_joblist_events[@]})) || return 1 + ble/util/sprintf out '%s\n' "${_ble_util_joblist_events[@]}" + ble/util/buffer "$out" + _ble_util_joblist_events=() +} +function ble/util/joblist.clear { + _ble_util_joblist_jobs= + _ble_util_joblist_list=() +} +function ble/util/save-editing-mode { + if [[ -o emacs ]]; then + builtin eval "$1=emacs" + elif [[ -o vi ]]; then + builtin eval "$1=vi" + else + builtin eval "$1=none" + fi +} +function ble/util/restore-editing-mode { + case ${!1} in + (emacs) set -o emacs ;; + (vi) set -o vi ;; + (none) set +o emacs ;; + esac +} +function ble/util/reset-keymap-of-editing-mode { + if [[ -o emacs ]]; then + set -o emacs + elif [[ -o vi ]]; then + set -o vi + fi +} +function ble/util/rlvar#load { + ble/util/assign _ble_local_rlvars 'builtin bind -v 2>/dev/null' + _ble_local_rlvars=$'\n'$_ble_local_rlvars +} +function ble/util/rlvar#has { + if [[ ! ${_ble_local_rlvars:-} ]]; then + local _ble_local_rlvars + ble/util/rlvar#load + fi + [[ $_ble_local_rlvars == *$'\n'"set $1 "* ]] +} +function ble/util/rlvar#test { + if [[ ! ${_ble_local_rlvars:-} ]]; then + local _ble_local_rlvars + ble/util/rlvar#load + fi + if [[ $_ble_local_rlvars == *$'\n'"set $1 on"* ]]; then + return 0 + elif [[ $_ble_local_rlvars == *$'\n'"set $1 off"* ]]; then + return 1 + elif (($#>=2)); then + (($2)) + return "$?" + else + return 2 + fi +} +function ble/util/rlvar#read { + [[ ${2+set} ]] && ret=$2 + if [[ ! ${_ble_local_rlvars:-} ]]; then + local _ble_local_rlvars + ble/util/rlvar#load + fi + local rhs=${_ble_local_rlvars#*$'\n'"set $1 "} + [[ $rhs != "$_ble_local_rlvars" ]] && ret=${rhs%%$'\n'*} +} +function ble/util/rlvar#bind-bleopt { + local name=$1 bleopt=$2 opts=$3 + if [[ ! ${_ble_local_rlvars:-} ]]; then + local _ble_local_rlvars + ble/util/rlvar#load + fi + if ble/util/rlvar#has "$name"; then + if [[ :$_ble_base_arguments_opts: == *:keep-rlvars:* ]]; then + local ret; ble/util/rlvar#read "$name" + [[ :$opts: == *:bool:* && $ret == off ]] && ret= + bleopt "$bleopt=$ret" + else + local var=bleopt_$bleopt val=off + [[ ${!var:-} ]] && val=on + builtin bind "set $name $val" 2>/dev/null + fi + local proc_original= + if ble/is-function "bleopt/check:$bleopt"; then + ble/function#push "bleopt/check:$bleopt" + proc_original='ble/function#push/call-top "$@" || return "$?"' + fi + local proc_set='builtin bind "set '$name' $value" 2>/dev/null' + if [[ :$opts: == *:bool:* ]]; then + proc_set=' + if [[ $value ]]; then + builtin bind "set '$name' on" 2>/dev/null + else + builtin bind "set '$name' off" 2>/dev/null + fi' + fi + builtin eval -- " + function bleopt/check:$bleopt { + $proc_original + $proc_set + return 0 + }" + fi + local proc_bleopt='bleopt '$bleopt'="$1"' + if [[ :$opts: == *:bool:* ]]; then + proc_bleopt=' + local value; ble/string#split-words value "$1" + if [[ ${value-} == 1 || ${value-} == [Oo][Nn] ]]; then + bleopt '$bleopt'="$value" + else + bleopt '$bleopt'= + fi' + fi + builtin eval -- " + function ble/builtin/bind/set:$name { + $proc_bleopt + return 0 + }" +} +function ble/util/invoke-hook { + local -a hooks; builtin eval "hooks=(\"\${$1[@]}\")" + local hook ext=0 + for hook in "${hooks[@]}"; do builtin eval -- "$hook" || ext=$?; done + return "$ext" +} +function ble/util/.read-arguments-for-no-option-command { + local commandname=$1; shift + flags= args=() + local flag_literal= + while (($#)); do + local arg=$1; shift + if [[ ! $flag_literal ]]; then + case $arg in + (--) flag_literal=1 ;; + (--help) flags=h$flags ;; + (-*) + ble/util/print "$commandname: unrecognized option '$arg'" >&2 + flags=e$flags ;; + (*) + ble/array#push args "$arg" ;; + esac + else + ble/array#push args "$arg" + fi + done +} +function ble/util/autoload { + local file=$1; shift + ble/util/import/is-loaded "$file" && return 0 + local q=\' Q="'\''" funcname + for funcname; do + builtin eval "function $funcname { + builtin unset -f $funcname + ble-import '${file//$q/$Q}' && + $funcname \"\$@\" + }" + done +} +function ble/util/autoload/.print-usage { + ble/util/print 'usage: ble-autoload SCRIPTFILE FUNCTION...' + ble/util/print ' Setup delayed loading of functions defined in the specified script file.' +} >&2 +function ble/util/autoload/.read-arguments { + file= flags= functions=() + local args + ble/util/.read-arguments-for-no-option-command ble-autoload "$@" + local arg index=0 + for arg in "${args[@]}"; do + if [[ ! $arg ]]; then + if ((index==0)); then + ble/util/print 'ble-autoload: the script filename should not be empty.' >&2 + else + ble/util/print 'ble-autoload: function names should not be empty.' >&2 + fi + flags=e$flags + fi + ((index++)) + done + [[ $flags == *h* ]] && return 0 + if ((${#args[*]}==0)); then + ble/util/print 'ble-autoload: script filename is not specified.' >&2 + flags=e$flags + elif ((${#args[*]}==1)); then + ble/util/print 'ble-autoload: function names are not specified.' >&2 + flags=e$flags + fi + file=${args[0]} functions=("${args[@]:1}") +} +function ble-autoload { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local file flags + local -a functions=() + ble/util/autoload/.read-arguments "$@" + if [[ $flags == *[eh]* ]]; then + [[ $flags == *e* ]] && builtin printf '\n' + ble/util/autoload/.print-usage + local ext=0 + [[ $flags == *e* ]] && ext=2 + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" + fi + ble/util/autoload "$file" "${functions[@]}" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_util_import_files=() +bleopt/declare -n import_path "${XDG_DATA_HOME:-$HOME/.local/share}/blesh/local" +function ble/util/import/search/.check-directory { + local name=$1 dir=${2%/} + [[ -d ${dir:=/} ]] || return 1 + if [[ $name == lib/* ]]; then + [[ $dir == */lib ]] || return 1 + dir=${dir%/lib} + elif [[ $name == contrib/* ]]; then + [[ $dir == */contrib ]] || return 1 + dir=${dir%/contrib} + fi + if [[ -f $dir/$name ]]; then + ret=$dir/$name + return 0 + elif [[ $name != *.bash && -f $dir/$name.bash ]]; then + ret=$dir/$name.bash + return 0 + elif [[ $name != *.sh && -f $dir/$name.sh ]]; then + ret=$dir/$name.sh + return 0 + fi + return 1 +} +function ble/util/import/search { + ret=$1 + if [[ $ret != /* && $ret != ./* && $ret != ../* ]]; then + local -a dirs=() + if [[ $bleopt_import_path ]]; then + local tmp; ble/string#split tmp : "$bleopt_import_path" + ble/array#push dirs "${tmp[@]}" + fi + ble/array#push dirs "$_ble_base"{,/contrib,/lib} + "${_ble_util_set_declare[@]//NAME/checked}" # WA #D1570 checked + local path + for path in "${dirs[@]}"; do + ble/set#contains checked "$path" && continue + ble/set#add checked "$path" + ble/util/import/search/.check-directory "$ret" "$path" && break + done + fi + [[ -e $ret && ! -d $ret ]] +} +function ble/util/import/encode-filename { + ret=$1 + local chars=%$'\t\n !"$&\'();<>\\^`|' # + if [[ $ret == *["$chars"]* ]]; then + local i n=${#chars} reps a b + reps=(%{25,08,0A,2{0..2},24,2{6..9},3B,3C,3E,5C,5E,60,7C}) + for ((i=0;i&2 + flags=E$flags + fi ;; + (*) + ble/util/print "ble-import: unrecognized option '$arg'" >&2 + flags=E$flags ;; + esac + continue ;; + (-?*) + local i c + for ((i=1;i<${#arg};i++)); do + c=${arg:i:1} + case $c in + ([dfq]) flags=$c$flags ;; + (C) + if ((i+1<${#arg})); then + ble/array#push callbacks "${arg:i+1}" + elif (($#)); then + ble/array#push callbacks "$1" + shift + else + ble/util/print "ble-import: missing optarg for '-C'" >&2 + flags=E$flags + fi + break ;; + (*) + ble/util/print "ble-import: unrecognized option '-$c'" >&2 + flags=E$flags ;; + esac + done + continue ;; + esac + fi + local ret + if ! ble/util/import/search "$arg"; then + ble/array#push not_found "$arg" + continue + fi; local file=$ret + ble/array#push files "$file" + done + if ((${#not_found[@]})); then + flags=N$flags + if [[ $flags != *[fq]* ]]; then + local file + for file in "${not_found[@]}"; do + ble/util/print "ble-import: file '$file' not found" >&2 + done + flags=E$flags + fi + fi + return 0 +} +function ble/util/import { + local files file ext=0 ret enc + files=("$@") + set -- # Note #D1859: source によって引数が継承されるのを防ぐ + for file in "${files[@]}"; do + ble/util/import/encode-filename "$file"; enc=$ret + local guard=ble/util/import/guard:$enc + ble/is-function "$guard" && return 0 + [[ -e $file ]] || return 1 + source -- "$file" || { ext=$?; continue; } + builtin eval "function $guard { return 0; }" + ble/array#push _ble_util_import_files "$file" + local onload=ble/util/import/onload:$enc + ble/function#try "$onload" ble/util/invoke-hook + done + return "$ext" +} +function ble/util/import/option:query { + if [[ $flags == *N* ]]; then + return 127 + elif ((${#files[@]})); then + local file + for file in "${files[@]}"; do + ble/util/import/is-loaded "$file" || return 1 + done + return 0 + else + ble/util/print-lines "${_ble_util_import_files[@]}" + return "$?" + fi +} +function ble/util/import/.dispatch { + local files flags callbacks + ble/util/import/.read-arguments "$@" + if [[ $flags == *[Eh]* ]]; then + [[ $flags == *E* ]] && ble/util/print + ble/util/print-lines \ + 'usage: ble-import [-dfq|--delay|--force|--query]' \ + ' [-C CALLBACK|--callback=CALLBACK]+ [--] [SCRIPTFILE...]' \ + 'usage: ble-import --help' \ + '' \ + ' Search and source script files that have not yet been loaded. When none of' \ + ' -q, --query, -d, --delay, -C, --callback is specified, SCRIPTFILEs are' \ + ' sourced.' \ + '' \ + ' OPTIONS' \ + ' --help Show this help.' \ + ' -d, --delay Register SCRIPTFILEs for later loading in idle time.' \ + ' -f, --force Ignore non-existent files without errors.' \ + ' -q, --query When SCRIPTFILEs are specified, test if all of these files' \ + ' are already loaded. Without SCRIPTFILEs, print the list of' \ + ' already imported files.' \ + ' -C, --callback=CALLBACK' \ + ' Specify a command that will be evaluated when all of' \ + ' SCRIPTFILEs are loaded. If all of SCRIPTFILEs are already' \ + ' loaded, the callback is immediately evaluated.' \ + '' \ + >&2 + [[ $flags == *E* ]] && return 2 + return 0 + fi + if [[ $flags == *q* ]]; then + ble/util/import/option:query + return "$?" + fi + if ((!${#files[@]})); then + [[ $flags == *f* ]] && return 0 + ble/util/print 'ble-import: files are not specified.' >&2 + return 2 + fi + if ((${#callbacks[@]})); then + local file i q=\' Q="'\''" + for file in "${files[@]}"; do + ble/util/import/is-loaded "$file" && continue + for i in "${!callbacks[@]}"; do + callbacks[i]="ble/util/import/eval-after-load '${file//$q/$Q}' '${callbacks[i]//$q/$Q}'" + done + done + local cb + for cb in "${callbacks[@]}"; do + builtin eval -- "$cb" + done + fi + if [[ $flags == *d* ]] && ble/is-function ble/util/idle.push; then + local ret + ble/string#quote-command ble/util/import "${files[@]}" + ble/util/idle.push "$ret" + return 0 + fi + ((${#callbacks[@]})) || ble/util/import "${files[@]}" +} +function ble-import { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/util/import/.dispatch "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_util_import_onload_count=0 +function ble/util/import/eval-after-load { + local ret file + if ! ble/util/import/search "$1"; then + ble/util/print "ble-import: file '$1' not found." >&2 + return 2 + fi; file=$ret + ble/util/import/encode-filename "$file"; local enc=$ret + local guard=ble/util/import/guard:$enc + if ble/is-function "$guard"; then + builtin eval -- "$2" + else + local onload=ble/util/import/onload:$enc + if ! ble/is-function "$onload"; then + local q=\' Q="'\''" list=_ble_util_import_onload_$((_ble_util_import_onload_count++)) + builtin eval -- "$list=(); function $onload { \"\$1\" $list \"\${@:2}\"; }" + fi + "$onload" ble/array#push "$2" + fi +} +_ble_util_stackdump_title=stackdump +_ble_util_stackdump_start= +function ble/util/stackdump { + ((bleopt_internal_stackdump_enabled)) || return 1 + local message=$1 nl=$'\n' IFS=$_ble_term_IFS + message="$_ble_term_sgr0$_ble_util_stackdump_title: $message$nl" + local extdebug= iarg=$BASH_ARGC args= + shopt -q extdebug 2>/dev/null && extdebug=1 + local i i0=${_ble_util_stackdump_start:-1} iN=${#FUNCNAME[*]} + for ((i=i0;i&2 + [[ $flags == *e* ]] && ext=2 + return 1 + fi + return 0 +} +function ble-stackdump { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local args ext + if ble/util/stackdump/.read-arguments "$@"; then + local _ble_util_stackdump_start=2 + local IFS=$_ble_term_IFS + ble/util/stackdump "${args[*]}" + ext=$? + fi + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" +} +function ble/util/assert { + local expr=$1 message=$2 + if ! builtin eval -- "$expr"; then + local _ble_util_stackdump_title='assertion failure' + local _ble_util_stackdump_start=3 + ble/util/stackdump "$expr$_ble_term_nl$message" >&2 + return 1 + else + return 0 + fi +} +function ble/util/assert-fail { + local message=$1 + local _ble_util_stackdump_title='assertion failure' + local _ble_util_stackdump_start=3 + ble/util/stackdump "$message" >&2 + return 1 +} +function ble/util/assert/.read-arguments { + ext=0 + local flags + ble/util/.read-arguments-for-no-option-command ble-assert "$@" + if [[ $flags != *h* ]]; then + if ((${#args[@]}==0)); then + ble/util/print 'ble-assert: command is not specified.' >&2 + flags=e$flags + fi + fi + if [[ $flags == *[eh]* ]]; then + [[ $flags == *e* ]] && ble/util/print + { + ble/util/print 'usage: ble-assert command [message]' + ble/util/print ' Evaluate command and print stackdump on fail.' + } >&2 + [[ $flags == *e* ]] && ext=2 + return 1 + fi + return 0 +} +function ble-assert { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local args ext + if ble/util/assert/.read-arguments "$@"; then + local IFS=$_ble_term_IFS + ble/util/assert "${args[0]}" "${args[*]:1}" + ext=$? + fi + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" +} +bleopt/declare -v debug_idle '' +_ble_util_clock_base= +_ble_util_clock_reso= +_ble_util_clock_type= +function ble/util/clock/.initialize { + local LC_ALL= LC_NUMERIC=C + if ((_ble_bash>=50000)) && { + local now=$EPOCHREALTIME + [[ $now == *.???* && $now != $EPOCHREALTIME ]]; }; then + builtin readonly EPOCHREALTIME + _ble_util_clock_base=$((10#0${now%.*})) + _ble_util_clock_reso=1 + _ble_util_clock_type=EPOCHREALTIME + function ble/util/clock { + local LC_ALL= LC_NUMERIC=C + local now=$EPOCHREALTIME + local integral=$((10#0${now%%.*}-_ble_util_clock_base)) + local mantissa=${now#*.}000; mantissa=${mantissa::3} + ((ret=integral*1000+10#0$mantissa)) + } + ble/function#suppress-stderr ble/util/clock # locale + elif [[ -r /proc/uptime ]] && { + local uptime + ble/util/readfile uptime /proc/uptime + ble/string#split-words uptime "$uptime" + [[ $uptime == *.* ]]; }; then + _ble_util_clock_base=$((10#0${uptime%.*})) + _ble_util_clock_reso=10 + _ble_util_clock_type=uptime + function ble/util/clock { + local now + ble/util/readfile now /proc/uptime + ble/string#split-words now "$now" + local integral=$((10#0${now%%.*}-_ble_util_clock_base)) + local fraction=${now#*.}000; fraction=${fraction::3} + ((ret=integral*1000+10#0$fraction)) + } + elif ((_ble_bash>=40200)); then + local ret + ble/util/time + _ble_util_clock_base=$ret + _ble_util_clock_reso=1000 + _ble_util_clock_type=printf + function ble/util/clock { + ble/util/time + ((ret=(ret-_ble_util_clock_base)*1000)) + } + elif [[ $SECONDS && ! ${SECONDS//[0-9]} ]]; then + builtin readonly SECONDS + _ble_util_clock_base=$SECONDS + _ble_util_clock_reso=1000 + _ble_util_clock_type=SECONDS + function ble/util/clock { + local now=$SECONDS + ((ret=(now-_ble_util_clock_base)*1000)) + } + else + local ret + ble/util/time + _ble_util_clock_base=$ret + _ble_util_clock_reso=1000 + _ble_util_clock_type=date + function ble/util/clock { + ble/util/time + ((ret=(ret-_ble_util_clock_base)*1000)) + } + fi +} +ble/util/clock/.initialize 2>/dev/null +if ((_ble_bash>=40000)); then + function ble/util/idle/IS_IDLE { ! ble/util/is-stdin-ready; } + _ble_util_idle_sclock=0 + function ble/util/idle/.sleep { + local msec=$1 + ((msec<=0)) && return 0 + ble/util/msleep "$msec" + ((_ble_util_idle_sclock+=msec)) + } + function ble/util/idle.clock/.initialize { + function ble/util/idle.clock/.initialize { return 0; } + function ble/util/idle.clock/.restart { return 0; } + if [[ ! $_ble_util_clock_type || $_ble_util_clock_type == date ]]; then + function ble/util/idle.clock { + ret=$_ble_util_idle_sclock + } + elif ((_ble_util_clock_reso<=100)); then + function ble/util/idle.clock { + ble/util/clock + } + else + _ble_util_idle_aclock_shift= + _ble_util_idle_aclock_tick_rclock= + _ble_util_idle_aclock_tick_sclock= + function ble/util/idle.clock/.restart { + _ble_util_idle_aclock_shift= + _ble_util_idle_aclock_tick_rclock= + _ble_util_idle_aclock_tick_sclock= + } + function ble/util/idle/.adjusted-clock { + local resolution=$_ble_util_clock_reso + local sclock=$_ble_util_idle_sclock + local ret; ble/util/clock; local rclock=$((ret/resolution*resolution)) + if [[ $_ble_util_idle_aclock_tick_rclock != "$rclock" ]]; then + if [[ $_ble_util_idle_aclock_tick_rclock && ! $_ble_util_idle_aclock_shift ]]; then + local delta=$((sclock-_ble_util_idle_aclock_tick_sclock)) + ((_ble_util_idle_aclock_shift=delta50000)) && [[ $_ble_util_msleep_builtin_available ]] && interval=20 + bleopt/declare -v idle_interval "$interval" + } + ble/util/idle/.initialize-options + _ble_util_idle_task=() + _ble_util_idle_lasttask= + _ble_util_idle_SEP=$_ble_term_FS + function ble/util/idle.do { + local IFS=$_ble_term_IFS + ble/util/idle/IS_IDLE || return 1 + ((${#_ble_util_idle_task[@]}==0)) && return 1 + ble/util/buffer.flush + local ret + ble/util/idle.clock/.initialize + ble/util/idle.clock/.restart + ble/util/idle.clock + local _ble_idle_clock_start=$ret + local _ble_idle_sclock_start=$_ble_util_idle_sclock + local _ble_idle_is_first=1 + local _ble_idle_processed= + local _ble_idle_info_shown= + local _ble_idle_after_task=0 + while ((1)); do + local _ble_idle_key + local _ble_idle_next_time= _ble_idle_next_itime= _ble_idle_running= _ble_idle_waiting= + for _ble_idle_key in "${!_ble_util_idle_task[@]}"; do + ble/util/idle/IS_IDLE || break 2 + local _ble_idle_to_process= + local _ble_idle_status=${_ble_util_idle_task[_ble_idle_key]%%"$_ble_util_idle_SEP"*} + case ${_ble_idle_status::1} in + (R) _ble_idle_to_process=1 ;; + (I) [[ $_ble_idle_is_first ]] && _ble_idle_to_process=1 ;; + (S) ble/util/idle.do/.check-clock "$_ble_idle_status" && _ble_idle_to_process=1 ;; + (W) ble/util/idle.do/.check-clock "$_ble_idle_status" && _ble_idle_to_process=1 ;; + (F) [[ -s ${_ble_idle_status:1} ]] && _ble_idle_to_process=1 ;; + (E) [[ -e ${_ble_idle_status:1} ]] && _ble_idle_to_process=1 ;; + (P) ! builtin kill -0 ${_ble_idle_status:1} &>/dev/null && _ble_idle_to_process=1 ;; + (C) builtin eval -- "${_ble_idle_status:1}" && _ble_idle_to_process=1 ;; + (Z) ;; + (*) builtin unset -v '_ble_util_idle_task[_ble_idle_key]' + esac + if [[ $_ble_idle_to_process ]]; then + local _ble_idle_command=${_ble_util_idle_task[_ble_idle_key]#*"$_ble_util_idle_SEP"} + _ble_idle_processed=1 + ble/util/idle.do/.call-task "$_ble_idle_command" + ((_ble_idle_after_task++)) + elif [[ $_ble_idle_status == [FEPC]* ]]; then + _ble_idle_waiting=1 + fi + done + _ble_idle_is_first= + ble/util/idle.do/.sleep-until-next; local ext=$? + ((ext==148)) && break + [[ $_ble_idle_next_itime$_ble_idle_next_time$_ble_idle_running$_ble_idle_waiting ]] || break + done + [[ $_ble_idle_info_shown ]] && + ble/edit/info/immediate-default + ble/util/idle.do/.do-after-task + [[ $_ble_idle_processed ]] + } + function ble/util/idle.do/.do-after-task { + if ((_ble_idle_after_task)); then + blehook/invoke idle_after_task + _ble_idle_after_task=0 + fi + } + function ble/util/idle.do/.call-task { + local _ble_local_command=$1 + local ble_util_idle_status= + local ble_util_idle_elapsed=$((_ble_util_idle_sclock-_ble_idle_sclock_start)) + if [[ $bleopt_debug_idle && ( $_ble_edit_info_scene == default || $_ble_idle_info_shown ) ]]; then + _ble_idle_info_shown=1 + ble/edit/info/immediate-show text "${EPOCHREALTIME:+[$EPOCHREALTIME] }idle: $_ble_local_command" + fi + builtin eval -- "$_ble_local_command"; local ext=$? + if ((ext==148)); then + _ble_util_idle_task[_ble_idle_key]=R$_ble_util_idle_SEP$_ble_local_command + elif [[ $ble_util_idle_status ]]; then + _ble_util_idle_task[_ble_idle_key]=$ble_util_idle_status$_ble_util_idle_SEP$_ble_local_command + if [[ $ble_util_idle_status == [WS]* ]]; then + local scheduled_time=${ble_util_idle_status:1} + if [[ $ble_util_idle_status == W* ]]; then + local next=_ble_idle_next_itime + else + local next=_ble_idle_next_time + fi + if [[ ! ${!next} ]] || ((scheduled_time0)) + do + local ble_util_idle_elapsed=$((_ble_util_idle_sclock-_ble_idle_sclock_start)) + ((sleep_amount>50)) && ble/util/idle.do/.do-after-task + local interval=$((bleopt_idle_interval)) + if [[ ! $sleep_amount ]] || ((intervalret)) || return 1 + fi + ble_util_idle_status=S$1 + } + function ble/util/idle.isleep-until { + [[ ${ble_util_idle_status+set} ]] || return 2 + if [[ :$2: == *:checked:* ]]; then + (($1>_ble_util_idle_sclock)) || return 1 + fi + ble_util_idle_status=W$1 + } + function ble/util/idle.wait-user-input { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=I + } + function ble/util/idle.wait-process { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=P$1 + } + function ble/util/idle.wait-file-content { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=F$1 + } + function ble/util/idle.wait-filename { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=E$1 + } + function ble/util/idle.wait-condition { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=C$1 + } + function ble/util/idle.continue { + [[ ${ble_util_idle_status+set} ]] || return 2 + ble_util_idle_status=R + } + function ble/util/idle/.declare-external-modifier { + local name=$1 + builtin eval -- 'function ble/util/idle#'"$name"' { + local index=$1 + [[ ${_ble_util_idle_task[index]+set} ]] || return 2 + local ble_util_idle_status=${_ble_util_idle_task[index]%%"$_ble_util_idle_SEP"*} + local ble_util_idle_command=${_ble_util_idle_task[index]#*"$_ble_util_idle_SEP"} + ble/util/idle.clock/.initialize + ble/util/idle.'"$name"' "${@:2}" + _ble_util_idle_task[index]=$ble_util_idle_status$_ble_util_idle_SEP$ble_util_idle_command + }' + } + ble/util/idle/.declare-external-modifier suspend + ble/util/idle/.declare-external-modifier sleep + ble/util/idle/.declare-external-modifier isleep + ble/util/idle.push-background 'ble/util/msleep/calibrate' +else + function ble/util/idle.do { return 1; } +fi +_ble_util_fiberchain=() +_ble_util_fiberchain_prefix= +function ble/util/fiberchain#initialize { + _ble_util_fiberchain=() + _ble_util_fiberchain_prefix=$1 +} +function ble/util/fiberchain#resume/.core { + _ble_util_fiberchain=() + local fib_clock=0 + local fib_ntask=$# + while (($#)); do + ((fib_ntask--)) + local fiber=${1%%:*} fib_suspend= fib_kill= + local argv; ble/string#split-words argv "$fiber" + [[ $1 == *:* ]] && fib_suspend=${1#*:} + "$_ble_util_fiberchain_prefix/$argv.fib" "${argv[@]:1}" + if [[ $fib_kill ]]; then + break + elif [[ $fib_suspend ]]; then + _ble_util_fiberchain=("$fiber:$fib_suspend" "${@:2}") + return 148 + fi + shift + done +} +function ble/util/fiberchain#resume { + ble/util/fiberchain#resume/.core "${_ble_util_fiberchain[@]}" +} +function ble/util/fiberchain#push { + ble/array#push _ble_util_fiberchain "$@" +} +function ble/util/fiberchain#clear { + _ble_util_fiberchain=() +} +bleopt/declare -v vbell_default_message ' Wuff, -- Wuff!! ' +bleopt/declare -v vbell_duration 2000 +bleopt/declare -n vbell_align right +function ble/term:cygwin/initialize.hook { + printf '\eM\e[B' >&"$_ble_util_fd_tui_stderr" + _ble_term_ri=$'\e[A' + function ble/canvas/put-dl.draw { + local value=${1-1} i + ((value)) || return 1 + DRAW_BUFF[${#DRAW_BUFF[*]}]=$'\e[2K' + if ((value>1)); then + local ret + ble/string#repeat $'\e[B\e[2K' "$((value-1))"; local a=$ret + DRAW_BUFF[${#DRAW_BUFF[*]}]=$ret$'\e['$((value-1))'A' + fi + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_dl//'%d'/$value} + } +} +function ble/term/DA2R.hook { + blehook term_DA2R-=ble/term/DA2R.hook + case $_ble_term_TERM in + (contra:*) + _ble_term_cuu=$'\e[%dk' + _ble_term_cud=$'\e[%de' + _ble_term_cuf=$'\e[%da' + _ble_term_cub=$'\e[%dj' + _ble_term_cup=$'\e[%l;%cf' ;; + (cygwin:*) + ble/term:cygwin/initialize.hook ;; + esac +} +function ble/term/.initialize { + if [[ -s $_ble_base_cache/term.$TERM && $_ble_base_cache/term.$TERM -nt $_ble_base/lib/init-term.sh ]]; then + source -- "$_ble_base_cache/term.$TERM" + else + source -- "$_ble_base/lib/init-term.sh" + fi + ble/string#reserve-prototype "$_ble_term_it" + blehook term_DA2R!=ble/term/DA2R.hook +} +ble/term/.initialize +function ble/term/put { + BUFF[${#BUFF[@]}]=$1 +} +function ble/term/cup { + local x=$1 y=$2 esc=$_ble_term_cup + esc=${esc//'%x'/$x} + esc=${esc//'%y'/$y} + esc=${esc//'%c'/$((x+1))} + esc=${esc//'%l'/$((y+1))} + BUFF[${#BUFF[@]}]=$esc +} +function ble/term/flush { + IFS= builtin eval 'ble/util/put "${BUFF[*]}"' + BUFF=() +} +function ble/term/audible-bell { + ble/util/put '' >&2 +} +_ble_term_visible_bell_prev=() +_ble_term_visible_bell_ftime=$_ble_base_run/$$.visible-bell.time +_ble_term_visible_bell_show='%message%' +_ble_term_visible_bell_clear= +function ble/term/visible-bell:term/init { + if [[ ! $_ble_term_visible_bell_clear ]]; then + local -a BUFF=() + ble/term/put "$_ble_term_ri_or_cuu1$_ble_term_sc$_ble_term_sgr0" + ble/term/cup 0 0 + ble/term/put "$_ble_term_el%message%$_ble_term_sgr0$_ble_term_rc${_ble_term_cud//'%d'/1}" + IFS= builtin eval '_ble_term_visible_bell_show="${BUFF[*]}"' + BUFF=() + ble/term/put "$_ble_term_sc$_ble_term_sgr0" + ble/term/cup 0 0 + ble/term/put "$_ble_term_el2$_ble_term_rc" + IFS= builtin eval '_ble_term_visible_bell_clear="${BUFF[*]}"' + fi + local cols=${COLUMNS:-80} + ((_ble_term_xenl||cols--)) + local message=${1::cols} + _ble_term_visible_bell_prev=(term "$message") +} +function ble/term/visible-bell:term/show { + local sgr=$1 message=${_ble_term_visible_bell_prev[1]} + message=${_ble_term_visible_bell_show//'%message%'/"$sgr$message"} + ble/util/put "$message" >&2 +} +function ble/term/visible-bell:term/update { + ble/term/visible-bell:term/show "$@" +} +function ble/term/visible-bell:term/clear { + local sgr=$1 + ble/util/put "$_ble_term_visible_bell_clear" >&2 +} +function ble/term/visible-bell:canvas/init { + local message=$1 + local lines=1 cols=${COLUMNS:-80} + ((_ble_term_xenl||cols--)) + local x= y= + local ret sgr0= sgr1= + ble/canvas/trace-text "$message" nonewline:external-sgr + message=$ret + local x0=$((COLUMNS-1-x)) y0=0 + ((x0<0)) && x0=0 + case :$bleopt_vbell_align: in + (*:left:*) x0=0 ;; + (*:center:*) ((x0/=2)) ;; + esac + _ble_term_visible_bell_prev=(canvas "$message" "$x0" "$y0" "$x" "$y") +} +function ble/term/visible-bell:canvas/show { + local sgr=$1 opts=$2 + local message=${_ble_term_visible_bell_prev[1]} + local x0=${_ble_term_visible_bell_prev[2]} + local y0=${_ble_term_visible_bell_prev[3]} + local x=${_ble_term_visible_bell_prev[4]} + local y=${_ble_term_visible_bell_prev[5]} + local -a DRAW_BUFF=() + [[ :$opts: != *:update:* && $_ble_attached ]] && # WA #D1495 + [[ $_ble_term_ri || :$opts: != *:erased:* && :$opts: != *:update:* ]] && + ble/canvas/panel/ensure-tmargin.draw + if [[ $_ble_term_rc ]]; then + local ret= + [[ :$opts: != *:update:* && $_ble_attached ]] && ble/canvas/panel/save-position goto-top-dock # WA #D1495 + ble/canvas/put.draw "$_ble_term_ri_or_cuu1$_ble_term_sc$_ble_term_sgr0" + ble/canvas/put-cup.draw "$((y0+1))" "$((x0+1))" + ble/canvas/put.draw "$sgr$message$_ble_term_sgr0" + ble/canvas/put.draw "$_ble_term_rc" + ble/canvas/put-cud.draw 1 + [[ :$opts: != *:update:* && $_ble_attached ]] && ble/canvas/panel/load-position.draw "$ret" # WA #D1495 + else + ble/canvas/put.draw "$_ble_term_ri_or_cuu1$_ble_term_sgr0" + ble/canvas/put-hpa.draw "$((1+x0))" + ble/canvas/put.draw "$sgr$message$_ble_term_sgr0" + ble/canvas/put-cud.draw 1 + ble/canvas/put-hpa.draw "$((1+_ble_canvas_x))" + fi + ble/canvas/bflush.draw + ble/util/buffer.flush +} +function ble/term/visible-bell:canvas/update { + ble/term/visible-bell:canvas/show "$@" +} +function ble/term/visible-bell:canvas/clear { + local sgr=$1 + local x0=${_ble_term_visible_bell_prev[2]} + local y0=${_ble_term_visible_bell_prev[3]} + local x=${_ble_term_visible_bell_prev[4]} + local y=${_ble_term_visible_bell_prev[5]} + local -a DRAW_BUFF=() + if [[ $_ble_term_rc ]]; then + local ret= + ble/canvas/put.draw "$_ble_term_sc$_ble_term_sgr0" + ble/canvas/put-cup.draw "$((y0+1))" "$((x0+1))" + ble/canvas/put.draw "$sgr" + ble/canvas/put-spaces.draw "$x" + ble/canvas/put.draw "$_ble_term_sgr0$_ble_term_rc" + else + : # 親プロセスの _ble_canvas_x が分からないので座標がずれる + fi + ble/canvas/flush.draw >&2 +} +function ble/term/visible-bell/defface.hook { + ble/color/defface vbell reverse + ble/color/defface vbell_flash reverse,fg=green + ble/color/defface vbell_erase bg=252 +} +blehook color_defface_load+=ble/term/visible-bell/defface.hook +function ble/term/visible-bell/.show { + local bell_type=${_ble_term_visible_bell_prev[0]} + ble/term/visible-bell:"$bell_type"/show "$@" +} +function ble/term/visible-bell/.update { + local bell_type=${_ble_term_visible_bell_prev[0]} + ble/term/visible-bell:"$bell_type"/update "$1" "$2:update" +} +function ble/term/visible-bell/.clear { + local bell_type=${_ble_term_visible_bell_prev[0]} + ble/term/visible-bell:"$bell_type"/clear "$@" + >| "$_ble_term_visible_bell_ftime" +} +function ble/term/visible-bell/.erase-previous-visible-bell { + local ret workers + ble/util/eval-pathname-expansion '"$_ble_base_run/$$.visible-bell."*' canonical + workers=("${ret[@]}") + local workerfile + for workerfile in "${workers[@]}"; do + if [[ -s $workerfile && ! ( $workerfile -ot $_ble_term_visible_bell_ftime ) ]]; then + ble/term/visible-bell/.clear "$sgr0" + return 0 + fi + done + return 1 +} +function ble/term/visible-bell/.create-workerfile { + local i=0 + while + workerfile=$_ble_base_run/$$.visible-bell.$i + [[ -s $workerfile ]] + do ((i++)); done + ble/util/print 1 >| "$workerfile" +} +function ble/term/visible-bell/.worker { + ble/util/msleep 50 + [[ $workerfile -ot $_ble_term_visible_bell_ftime ]] && return 0 >| "$workerfile" + ble/term/visible-bell/.update "$sgr2" + if [[ :$opts: == *:persistent:* ]]; then + local dead_workerfile=$_ble_base_run/$$.visible-bell.Z + ble/util/print 1 >| "$dead_workerfile" + return 0 >| "$workerfile" + fi + local msec=$((bleopt_vbell_duration)) + ble/util/msleep "$msec" + [[ $workerfile -ot $_ble_term_visible_bell_ftime ]] && return 0 >| "$workerfile" + ble/term/visible-bell/.clear "$sgr0" + >| "$workerfile" +} +function ble/term/visible-bell { + local message=$1 opts=$2 + message=${message:-$bleopt_vbell_default_message} + ((LINES==1)) && return 0 + [[ :$bleopt_vbell_align: == *:panel:* ]] && + ble/function#try ble/edit/visible-bell "$message" "$opts" && + return 0 + local sgr0=$_ble_term_sgr0 + local sgr1=${_ble_term_setaf[2]}$_ble_term_rev + local sgr2=$_ble_term_rev + if ble/is-function ble/color/face2sgr; then + local ret + ble/color/face2sgr vbell_flash; sgr1=$ret + ble/color/face2sgr vbell; sgr2=$ret + ble/color/face2sgr vbell_erase; sgr0=$ret + fi + local show_opts= + ble/term/visible-bell/.erase-previous-visible-bell && show_opts=erased + if ble/is-function ble/canvas/trace-text; then + ble/term/visible-bell:canvas/init "$message" + else + ble/term/visible-bell:term/init "$message" + fi + ble/term/visible-bell/.show "$sgr1" "$show_opts" + local workerfile; ble/term/visible-bell/.create-workerfile + ( ble/util/joblist/__suppress__; ble/term/visible-bell/.worker 1>/dev/null & ) +} +function ble/term/visible-bell/cancel-erasure { + >| "$_ble_term_visible_bell_ftime" +} +function ble/term/visible-bell/erase { + local sgr0=$_ble_term_sgr0 + if ble/is-function ble/color/face2sgr; then + local ret + ble/color/face2sgr vbell_erase; sgr0=$ret + fi + ble/term/visible-bell/.erase-previous-visible-bell +} +[[ ${_ble_term_stty_save+set} ]] || _ble_term_stty_save= +bleopt/declare -v term_stty_restore '' +function bleopt/check:term_stty_restore { + if [[ $value && ! $_ble_term_stty_save ]]; then + ble/util/assign _ble_term_stty_save 'ble/bin/stty -g' + fi + return 0 +} +_ble_term_stty_state= +_ble_term_stty_flags_enter=() +_ble_term_stty_flags_leave=() +ble/array#push _ble_term_stty_flags_enter intr undef quit undef susp undef +ble/array#push _ble_term_stty_flags_leave intr '' quit '' susp '' +function ble/term/stty/.initialize-flags { + if [[ $TERM == minix ]]; then + local stty; ble/util/assign stty 'stty -a' + if [[ $stty == *' rprnt '* ]]; then + ble/array#push _ble_term_stty_flags_enter rprnt undef + ble/array#push _ble_term_stty_flags_leave rprnt '' + elif [[ $stty == *' reprint '* ]]; then + ble/array#push _ble_term_stty_flags_enter reprint undef + ble/array#push _ble_term_stty_flags_leave reprint '' + fi + fi +} +ble/term/stty/.initialize-flags +function ble/term/stty/initialize { + if [[ $bleopt_term_stty_restore ]]; then + [[ $_ble_term_stty_save ]] || + ble/util/assign _ble_term_stty_save 'ble/bin/stty -g' + fi + ble/bin/stty -ixon -echo -nl -icrnl -icanon \ + "${_ble_term_stty_flags_enter[@]}" + _ble_term_stty_state=1 +} +function ble/term/stty/leave { + ((_ble_term_stty_state)) || return 0 + _ble_term_stty_state=0 + if [[ $bleopt_term_stty_restore && $_ble_term_stty_save ]]; then + ble/bin/stty "$_ble_term_stty_save" + else + ble/bin/stty echo -nl icanon "${_ble_term_stty_flags_leave[@]}" + fi +} +function ble/term/stty/enter { + ((_ble_term_stty_state)) && return 0 + if [[ $bleopt_term_stty_restore ]]; then + ble/term/stty/initialize + else + ble/bin/stty -echo -nl -icrnl -icanon "${_ble_term_stty_flags_enter[@]}" + _ble_term_stty_state=1 + fi +} +function ble/term/stty/finalize { + ble/term/stty/leave + _ble_term_stty_save= +} +function ble/term/stty/TRAPEXIT { + if [[ ! $_ble_term_stty_state ]]; then + return 0 + fi + if [[ $bleopt_term_stty_restore && $_ble_term_stty_save ]]; then + ble/bin/stty "$_ble_term_stty_save" + else + ble/bin/stty echo -nl "${_ble_term_stty_flags_leave[@]}" + fi + _ble_term_stty_state=0 +} +function ble/term/update-winsize { + if ((_ble_bash<50200||50300<=_ble_bash)); then + function ble/term/update-winsize { + if shopt -q checkwinsize; then + (:) + else + shopt -s checkwinsize + (:) + shopt -u checkwinsize + fi 2>&"$_ble_util_fd_tui_stderr" + } + ble/term/update-winsize + return 0 + fi + local ret + if ble/bin#freeze-utility-path tput; then + if ble/util/assign-words ret 'ble/bin/tput lines cols' 2>/dev/null && + [[ ${#ret[@]} -eq 2 && ${ret[0]} =~ ^[0-9]+$ && ${ret[1]} =~ ^[0-9]+$ ]] + then + LINES=${ret[0]} COLUMNS=${ret[1]} + function ble/term/update-winsize { + local -x ret LINES= COLUMNS= + ble/util/assign-words ret 'ble/bin/tput lines cols' 2>/dev/null + ble/util/unlocal LINES COLUMNS + [[ ${ret[0]} ]] && LINES=${ret[0]} + [[ ${ret[1]} ]] && COLUMNS=${ret[1]} + } + return 0 + elif ble/util/assign-words ret 'ble/bin/tput li co' 2>/dev/null && + [[ ${#ret[@]} -eq 2 && ${ret[0]} =~ ^[0-9]+$ && ${ret[1]} =~ ^[0-9]+$ ]] + then + LINES=${ret[0]} COLUMNS=${ret[1]} + function ble/term/update-winsize { + local -x ret LINES= COLUMNS= + ble/util/assign-words ret 'ble/bin/tput li co' 2>/dev/null + ble/util/unlocal LINES COLUMNS + [[ ${ret[0]} ]] && LINES=${ret[0]} + [[ ${ret[1]} ]] && COLUMNS=${ret[1]} + } + return 0 + fi + fi + if ble/util/assign-words ret 'ble/bin/stty size' 2>/dev/null && + [[ ${#ret[@]} -eq 2 && ${ret[0]} =~ ^[0-9]+$ && ${ret[1]} =~ ^[0-9]+$ ]] + then + LINES=${ret[0]} COLUMNS=${ret[1]} + function ble/term/update-winsize { + local ret + ble/util/assign-words ret 'ble/bin/stty size' 2>/dev/null + [[ ${ret[0]} ]] && LINES=${ret[0]} + [[ ${ret[1]} ]] && COLUMNS=${ret[1]} + } + return 0 + fi + if ble/bin#freeze-utility-path resize && + ble/util/assign ret 'ble/bin/resize' && + ble/string#match "$ret" 'COLUMNS=([0-9]+).*LINES=([0-9]+)' + then + LINES=${BASH_REMATCH[2]} COLUMNS=${BASH_REMATCH[1]} + function ble/term/update-winsize { + local ret + ble/util/assign ret 'ble/bin/resize' 2>/dev/null + ble/string#match ret 'COLUMNS=([0-9]+).*LINES=([0-9]+)' + [[ ${BASH_REMATCH[2]} ]] && LINES=${BASH_REMATCH[2]} + [[ ${BASH_REMATCH[1]} ]] && COLUMNS=${BASH_REMATCH[1]} + } + return 0 + fi + function ble/term/update-winsize { + local ret script='LINES= COLUMNS=; (:); [[ $COLUMNS && $LINES ]] && builtin echo "$LINES $COLUMNS"' + ble/util/assign-words ret '"$BASH" -O checkwinsize -c "$script"' 2>&"$_ble_util_fd_tui_stderr" + [[ ${ret[0]} ]] && LINES=${ret[0]} + [[ ${ret[1]} ]] && COLUMNS=${ret[1]} + } + ble/term/update-winsize + return 0 +} +if ((50200<=_ble_bash&&_ble_bash<50300)); then + function ble/term/update-winsize/.stty-enter.advice { + local ret stderr test_command='ble/bin/stty -echo -nl -icrnl -icanon "${_ble_term_stty_flags_enter[@]}" size' + if ble/util/assign stderr 'ble/util/assign-words ret "$test_command" 2>&1' && + [[ ! $stderr ]] && + ((${#ret[@]}==2)) && + [[ ${ret[0]} =~ ^[0-9]+$ && ${ret[1]} =~ ^[0-9]+$ ]] + then + LINES=${ret[0]} COLUMNS=${ret[1]} + function ble/term/stty/enter { + ((_ble_term_stty_state)) && return 0 + local ret + if [[ $bleopt_term_stty_restore ]]; then + ble/term/stty/initialize + ble/util/assign-words ret 'ble/bin/stty size' + else + ble/util/assign-words ret 'ble/bin/stty -echo -nl -icrnl -icanon "${_ble_term_stty_flags_enter[@]}" size' + _ble_term_stty_state=1 + fi + [[ ${ret[0]} =~ ^[0-9]+$ ]] && LINES=${ret[0]} + [[ ${ret[1]} =~ ^[0-9]+$ ]] && COLUMNS=${ret[1]} + } + else + ble/term/update-winsize + ble/function#advice before ble/term/stty/enter ble/term/update-winsize + fi + builtin unset -f "$FUNCNAME" + } + ble/function#advice before ble/term/stty/enter ble/term/update-winsize/.stty-enter.advice +fi +bleopt/declare -v term_cursor_external 0 +_ble_term_cursor_current=unknown +_ble_term_cursor_internal=0 +_ble_term_cursor_hidden_current=unknown +_ble_term_cursor_hidden_internal=reveal +_ble_term_cursor_current=default +function ble/term/cursor-state/.update { + local state=$(($1)) + [[ ${_ble_term_cursor_current/default/0} == "$state" ]] && return 0 + if [[ ! $_ble_term_Ss ]]; then + case $_ble_term_TERM in + (mintty:*|xterm:*|RLogin:*|kitty:*|screen:*|tmux:*|contra:*|cygwin:*|wezterm:*|wt:*) + local _ble_term_Ss=$'\e[@1 q' ;; + esac + fi + local ret=${_ble_term_Ss//@1/"$state"} + if [[ $ret ]]; then + [[ $ret != $'\eP'*$'\e\\' ]] && + ble/term/quote-passthrough "$ret" '' all + ble/util/buffer "$ret" + fi + _ble_term_cursor_current=$state +} +function ble/term/cursor-state/set-internal { + _ble_term_cursor_internal=$1 + [[ $_ble_term_state == internal ]] && + ble/term/cursor-state/.update "$1" +} +function ble/term/cursor-state/.update-hidden { + local state=$1 + [[ $state != hidden ]] && state=reveal + _ble_term_cursor_hidden_current=$state +} +function ble/term/cursor-state/hide { + _ble_term_cursor_hidden_internal=hidden + [[ $_ble_term_state == internal ]] && + ble/term/cursor-state/.update-hidden hidden +} +function ble/term/cursor-state/reveal { + _ble_term_cursor_hidden_internal=reveal + [[ $_ble_term_state == internal ]] && + ble/term/cursor-state/.update-hidden reveal +} +function ble/term/bracketed-paste-mode/.init { + local _ble_local_rlvars; ble/util/rlvar#load + bleopt/declare -v term_bracketed_paste_mode on + if ((_ble_bash>=50100)) && ! ble/util/rlvar#test enable-bracketed-paste; then + bleopt term_bracketed_paste_mode= + elif [[ ${TERM%%-*} == eterm ]]; then + bleopt term_bracketed_paste_mode= + fi + function bleopt/check:term_bracketed_paste_mode { + if [[ $_ble_term_bracketedPasteMode_internal ]]; then + if [[ $value ]]; then + [[ $bleopt_term_bracketed_paste_mode ]] || ble/util/buffer $'\e[?2004h' + else + [[ ! $bleopt_term_bracketed_paste_mode ]] || ble/util/buffer $'\e[?2004l' + fi + fi + } + ble/util/rlvar#bind-bleopt enable-bracketed-paste term_bracketed_paste_mode bool + builtin unset -f "$FUNCNAME" +} +ble/term/bracketed-paste-mode/.init +_ble_term_bracketedPasteMode_internal= +function ble/term/bracketed-paste-mode/enter { + _ble_term_bracketedPasteMode_internal=1 + [[ ${bleopt_term_bracketed_paste_mode-} ]] && + ble/util/buffer $'\e[?2004h' +} +function ble/term/bracketed-paste-mode/leave { + _ble_term_bracketedPasteMode_internal= + [[ ${bleopt_term_bracketed_paste_mode-} ]] && + ble/util/buffer $'\e[?2004l' +} +if [[ $TERM == minix ]]; then + function ble/term/bracketed-paste-mode/enter { return 0; } + function ble/term/bracketed-paste-mode/leave { return 0; } +fi +bleopt/declare -v term_synchronized_update_mode auto +function ble/term/synchronized-update-mode/resolve-auto { + [[ $bleopt_term_synchronized_update_mode == auto ]] || return 0 + case $_ble_term_TERM in + (mintty:*|foot:*|wezterm:*|iTerm2:*|kitty:*|alacritty:*|zellij:*) + bleopt_term_synchronized_update_mode=on ;; + (*) + bleopt_term_synchronized_update_mode= ;; + esac +} +_ble_term_TERM=() +_ble_term_DA1R=() +_ble_term_DA2R=() +_ble_term_TERM_done= +function ble/term/DA2/request { + case $TERM in + (linux) + _ble_term_TERM=linux:- ;; + (st|st-*) + _ble_term_TERM=st:- ;; + (*) + ble/util/buffer $'\e[>c' # DA2 要求 (ble/decode/csi/.decode で受信) + esac +} +function ble/term/DA2/initialize-term { + local depth=$1 + local da2r=${_ble_term_DA2R[depth]} + local rex='^[0-9]*(;[0-9]*)*$'; [[ $da2r =~ $rex ]] || return 1 + local da2r_vec + ble/string#split da2r_vec ';' "$da2r" + da2r_vec=("${da2r_vec[@]/#/10#0}") # 0で始まっていても10進数で解釈; WA #D1570 checked (is-array) + case $da2r in + ('0;271;0') _ble_term_TERM[depth]=terminology:200 ;; # 2012-10-05 https://github.com/borisfaure/terminology/commit/500e7be8b2b876462ed567ef6c90527f37482adb + ('41;285;0') _ble_term_TERM[depth]=terminology:300 ;; # 2013-01-22 https://github.com/borisfaure/terminology/commit/526cc2aeacc0ae54825cbc3a3e2ab64f612f83c9 + ('61;337;0') _ble_term_TERM[depth]=terminology:10400 ;; # 2019-01-20 https://github.com/borisfaure/terminology/commit/96bbfd054b271f7ad7f31e699b13c12cb8fbb2e2 + ('0;0;0') _ble_term_TERM[depth]=wezterm:0 ;; + ('1;277;0') _ble_term_TERM[depth]=wezterm:20220408 ;; # 2022-04-07 https://github.com/wez/wezterm/commit/ad91e3776808507cbef9e6d758b89d7ca92a4c7e + ('0;115;0') _ble_term_TERM[depth]=konsole:30000 ;; # 2001-09-16 https://github.com/KDE/konsole/commit/2d93fed82aa27e89c9d7301d09d2e24e4fa4416d + ('1;115;0') _ble_term_TERM[depth]=konsole:220380 ;; # 2022-02-24 https://github.com/KDE/konsole/commit/0cc64dcf7b90075bd17e46653df3069208d6a590 + ('1;96;0') _ble_term_TERM[depth]=mlterm:30102 ;; + ('1;277;0') _ble_term_TERM[depth]=mlterm:30402 ;; # Note: wezterm:20220408 と同じ。wezterm の方を優先 + ('24;279;0') _ble_term_TERM[depth]=mlterm:30702 ;; + ('0;95;0') _ble_term_TERM[depth]=iTerm2:${LC_TERMINAL_VERSION-2.9+} ;; + ('41;2500;0') _ble_term_TERM[depth]=iTerm2:${LC_TERMINAL_VERSION-3.5.0+} ;; + ('64;2500;0') _ble_term_TERM[depth]=iTerm2:${LC_TERMINAL_VERSION-3.5.6+} ;; + ('0;10;1') # Windows Terminal + _ble_term_TERM[depth]=wt:0 ;; + ('0;'*';1') + if ((da2r_vec[1]>=3000)); then + _ble_term_TERM[depth]=zellij:$((da2r_vec[1])) + elif ((da2r_vec[1]>=1001)); then + _ble_term_TERM[depth]=alacritty:$((da2r_vec[1])) + fi ;; + ('1;0'?????';0') + _ble_term_TERM[depth]=foot:${da2r:3:5} ;; + ('1;'*) + if ((4000<=da2r_vec[1]&&da2r_vec[1]<=4009&&3<=da2r_vec[2])); then + _ble_term_TERM[depth]=kitty:$((da2r_vec[1]-4000)) + elif ((803<=da2r_vec[1]&&da2r_vec[1]<5400&&da2r_vec[2]==0)); then + local version=$((da2r_vec[1])) + _ble_term_TERM[depth]=vte:$version + if ((version<4000)); then + _ble_term_Ss= + fi + fi ;; + ('61;'*) + if ((7501<=da2r_vec[1]&&da2r_vec[2]==1)); then + _ble_term_TERM[depth]=vte:$((da2r_vec[1])) + fi ;; + ('65;'*) + if ((5300<=da2r_vec[1]&&da2r_vec[1]<=7501&&da2r_vec[2]==1)); then + _ble_term_TERM[depth]=vte:$((da2r_vec[1])) + elif ((da2r_vec[1]>=100)); then + _ble_term_TERM[depth]=RLogin:$((da2r_vec[1])) + fi ;; + ('67;'*) + local rex='^67;[0-9]{3,};0$' + if [[ $TERM == cygwin && $da2r =~ $rex ]]; then + _ble_term_TERM[depth]=cygwin:$((da2r_vec[1])) + fi ;; + ('77;'*';0') + _ble_term_TERM[depth]=mintty:$((da2r_vec[1])) ;; + ('83;'*) + local rex='^83;[0-9]+;0$' + [[ $da2r =~ $rex ]] && _ble_term_TERM[depth]=screen:$((da2r_vec[1])) ;; + ('84;0;0') + _ble_term_TERM[depth]=tmux:0 ;; + ('99;'*) + _ble_term_TERM[depth]=contra:$((da2r_vec[1])) ;; + esac + [[ ${_ble_term_TERM[depth]} ]] && return 0 + if rex='^xterm(-|$)'; [[ $TERM =~ $rex ]]; then + local version=$((da2r_vec[1])) + if rex='^1;[0-9]+;0$'; [[ $da2r =~ $rex ]]; then + builtin true + elif rex='^0;[0-9]+;0$'; [[ $da2r =~ $rex ]]; then + ((95<=version)) + elif rex='^(2|24|1[89]|41|6[145]);[0-9]+;0$'; [[ $da2r =~ $rex ]]; then + ((280<=version)) + elif rex='^32;[0-9]+;0$'; [[ $da2r =~ $rex ]]; then + ((354<=version&&version<2000)) + else + builtin false + fi && { _ble_term_TERM[depth]=xterm:$version; return 0; } + fi + _ble_term_TERM[depth]=unknown:- + return 0 +} +function ble/term/DA1/notify { _ble_term_DA1R=$1; blehook/invoke term_DA1R; } +function ble/term/DA2/notify { + local depth=${#_ble_term_DA2R[@]} + if ((depth==0)) || ble/string#match "${_ble_term_TERM[depth-1]}" '^(screen|tmux):'; then + _ble_term_DA2R[depth]=$1 + ble/term/DA2/initialize-term "$depth" + local is_outermost=1 + case ${_ble_term_TERM[depth]} in + (screen:*|tmux:*) + local ret is_outermost= + ble/term/quote-passthrough $'\e[>c' "$((depth+1))" + ble/util/buffer "$ret" ;; + (contra:*) + if [[ ! ${_ble_term_Ss-} ]]; then + _ble_term_Ss=$'\e[@1 q' + fi ;; + (terminology:*) + _ble_term_sc=$'\e7' _ble_term_rc=$'\r\e8' ;; + esac + if ((depth==0)); then + ble/term/synchronized-update-mode/resolve-auto + fi + if [[ $is_outermost ]]; then + _ble_term_TERM_done=1 + ble/term/modifyOtherKeys/reset + fi + ((depth)) && return 0 + fi + blehook/invoke term_DA2R +} +function ble/term/quote-passthrough { + local seq=$1 level=${2:-$((${#_ble_term_DA2R[@]}-1))} opts=$3 + local all=; [[ :$opts: == *:all:* ]] && all=1 + ret=$seq + [[ $seq ]] || return 0 + local i + for ((i=level;--i>=0;)); do + if [[ ${_ble_term_TERM[i]} == tmux:* ]]; then + ret=$'\ePtmux;'${ret//$'\e'/$'\e\e'}$'\e\\'${all:+$seq} + else + ret=$'\eP'${ret//$'\e\\'/$'\e\e\\\eP\\'}$'\e\\'${all:+$seq} + fi + done +} +_ble_term_DECSTBM= +_ble_term_DECSTBM_reset= +function ble/term/test-DECSTBM.hook1 { + (($1==2)) && _ble_term_DECSTBM=$'\e[%s;%sr' +} +function ble/term/test-DECSTBM.hook2 { + if [[ $_ble_term_DECSTBM ]]; then + if (($1==2)); then + _ble_term_DECSTBM_reset=$'\e[r' + else + _ble_term_DECSTBM_reset=$'\e[;r' + fi + fi +} +function ble/term/test-DECSTBM { + local -a DRAW_BUFF=() + ble/canvas/panel/goto-top-dock.draw + ble/canvas/put.draw "$_ble_term_sc"$'\e[1;2r' + ble/canvas/put-cup.draw 2 1 + ble/canvas/put-cud.draw 1 + ble/term/CPR/request.draw ble/term/test-DECSTBM.hook1 + ble/canvas/put.draw $'\e[;r' + ble/canvas/put-cup.draw 2 1 + ble/canvas/put-cud.draw 1 + ble/term/CPR/request.draw ble/term/test-DECSTBM.hook2 + ble/canvas/put.draw $'\e[r'"$_ble_term_rc" + ble/canvas/bflush.draw +} +_ble_term_CPR_timeout=60 +_ble_term_CPR_last_seconds=$SECONDS +_ble_term_CPR_hook=() +function ble/term/CPR/request.buff { + ((SECONDS>_ble_term_CPR_last_seconds+_ble_term_CPR_timeout)) && + _ble_term_CPR_hook=() + _ble_term_CPR_last_seconds=$SECONDS + ble/array#push _ble_term_CPR_hook "$1" + ble/util/buffer $'\e[6n' + return 147 +} +function ble/term/CPR/request.draw { + ((SECONDS>_ble_term_CPR_last_seconds+_ble_term_CPR_timeout)) && + _ble_term_CPR_hook=() + _ble_term_CPR_last_seconds=$SECONDS + ble/array#push _ble_term_CPR_hook "$1" + ble/canvas/put.draw $'\e[6n' + return 147 +} +function ble/term/CPR/notify { + local hook=${_ble_term_CPR_hook[0]} + ble/array#shift _ble_term_CPR_hook + [[ ! $hook ]] || builtin eval -- "$hook $1 $2" +} +bleopt/declare -v term_modifyOtherKeys_external auto +bleopt/declare -v term_modifyOtherKeys_internal auto +bleopt/declare -v term_modifyOtherKeys_passthrough_kitty_protocol '' +_ble_term_modifyOtherKeys_current= +_ble_term_modifyOtherKeys_current_method= +_ble_term_modifyOtherKeys_current_TERM= +function ble/term/modifyOtherKeys/.update { + local IFS=$_ble_term_IFS state=${1%%:*} + [[ $1 == "$_ble_term_modifyOtherKeys_current" ]] && + [[ $state != 2 || "${_ble_term_TERM[*]}" == "$_ble_term_modifyOtherKeys_current_TERM" ]] && + return 0 + local previous=${_ble_term_modifyOtherKeys_current%%:*} method + if [[ $state == 2 ]]; then + case $_ble_term_TERM in + (RLogin:*) method=RLogin_modifyStringKeys ;; + (kitty:*) + local da2r_vec + ble/string#split da2r_vec ';' "$_ble_term_DA2R" + if ((da2r_vec[2]>=23)); then + method=kitty_keyboard_protocol + else + method=kitty_modifyOtherKeys + fi ;; + (screen:*|tmux:*) + method=modifyOtherKeys + if [[ $bleopt_term_modifyOtherKeys_passthrough_kitty_protocol ]]; then + local index=$((${#_ble_term_TERM[*]}-1)) + if [[ ${_ble_term_TERM[index]} == kitty:* ]]; then + local da2r_vec + ble/string#split da2r_vec ';' "${_ble_term_DA2R[index]}" + ((da2r_vec[2]>=23)) && method=kitty_keyboard_protocol + fi + fi ;; + (*) + method=modifyOtherKeys + if [[ $1 == *:auto ]]; then + ble/term/modifyOtherKeys/.supported || method=disabled + fi ;; + esac + [[ $MC_SID ]] && method=disabled + if ((previous>=2)) && + [[ $method != "$_ble_term_modifyOtherKeys_current_method" ]] + then + ble/term/modifyOtherKeys/.update 1 + previous=1 + fi + else + method=$_ble_term_modifyOtherKeys_current_method + fi + _ble_term_modifyOtherKeys_current=$1 + _ble_term_modifyOtherKeys_current_method=$method + _ble_term_modifyOtherKeys_current_TERM="${_ble_term_TERM[*]}" + case $method in + (RLogin_modifyStringKeys) + case $state in + (0) ble/util/buffer $'\e[>5;0m' ;; + (1) ble/util/buffer $'\e[>5;1m' ;; + (2) ble/util/buffer $'\e[>5;1m\e[>5;2m' ;; + esac + ;; # fallback to modifyOtherKeys + (kitty_modifyOtherKeys) + case $state in + (0|1) ble/util/buffer $'\e[>4;0m\e[>4m' ;; + (2) ble/util/buffer $'\e[>4;1m\e[>4;2m\e[m' ;; + esac + return 0 ;; + (kitty_keyboard_protocol) + local seq= + case $state in + (0|1) # pop keyboard mode + [[ $previous ]] || return 0 + ((previous>=2)) && seq=$'\e[=2)) || seq=$'\e[>1u' ;; + esac + if [[ $seq ]]; then + local ret + ble/term/quote-passthrough "$seq" + ble/util/buffer "$ret" + local level + for ((level=1;level<${#_ble_term_TERM[@]}-1;level++)); do + [[ ${_ble_term_TERM[level]} == tmux:* ]] || continue + case $state in + (0) seq=$'\e[>4;0m\e[m' ;; + (1) seq=$'\e[>4;1m\e[m' ;; + (2) seq=$'\e[>4;1m\e[>4;2m\e[m' ;; + esac + ble/term/quote-passthrough "$seq" "$level" + ble/util/buffer "$ret" + break + done + fi + return 0 ;; + (disabled) + return 0 ;; + esac + case $state in + (0) ble/util/buffer $'\e[>4;0m\e[m' ;; + (1) ble/util/buffer $'\e[>4;1m\e[m' ;; + (2) ble/util/buffer $'\e[>4;1m\e[>4;2m\e[m' ;; + esac +} +function ble/term/modifyOtherKeys/.supported { + [[ $_ble_term_TERM_done ]] || return 1 + [[ $_ble_term_TERM == vte:* ]] && return 1 + [[ $MWG_LOGINTERM == rosaterm ]] && return 1 + case $TERM in + (linux) + return 1 ;; + (minix|sun*) + return 1 ;; + (st|st-*) + return 1 ;; + esac + return 0 +} +function ble/term/modifyOtherKeys/enter { + local value=$bleopt_term_modifyOtherKeys_internal + if [[ $value == auto ]]; then + value=2:auto + fi + ble/term/modifyOtherKeys/.update "$value" +} +function ble/term/modifyOtherKeys/leave { + local value=$bleopt_term_modifyOtherKeys_external + if [[ $value == auto ]]; then + value=1:auto + fi + ble/term/modifyOtherKeys/.update "$value" +} +function ble/term/modifyOtherKeys/reset { + ble/term/modifyOtherKeys/.update "$_ble_term_modifyOtherKeys_current" +} +_ble_term_altscr_state= +function ble/term/enter-altscr { + [[ $_ble_term_altscr_state ]] && return 0 + _ble_term_altscr_state=("$_ble_canvas_x" "$_ble_canvas_y") + if [[ $_ble_term_rmcup ]]; then + ble/util/buffer "$_ble_term_smcup" + else + local -a DRAW_BUFF=() + ble/canvas/put.draw $'\e[?1049h' + ble/canvas/put-cup.draw "$LINES" 0 + ble/canvas/put-ind.draw "$LINES" + ble/canvas/bflush.draw + fi +} +function ble/term/leave-altscr { + [[ $_ble_term_altscr_state ]] || return 0 + if [[ $_ble_term_rmcup ]]; then + ble/util/buffer "$_ble_term_rmcup" + else + local -a DRAW_BUFF=() + ble/canvas/put-cup.draw "$LINES" 0 + ble/canvas/put-ind.draw + ble/canvas/put.draw $'\e[?1049l' + ble/canvas/bflush.draw + fi + _ble_canvas_x=${_ble_term_altscr_state[0]} + _ble_canvas_y=${_ble_term_altscr_state[1]} + _ble_term_altscr_state=() +} +_ble_term_rl_convert_meta_adjusted= +_ble_term_rl_convert_meta_external= +function ble/term/rl-convert-meta/enter { + [[ $_ble_term_rl_convert_meta_adjusted ]] && return 0 + _ble_term_rl_convert_meta_adjusted=1 + if ble/util/rlvar#test convert-meta; then + _ble_term_rl_convert_meta_external=on + builtin bind 'set convert-meta off' + else + _ble_term_rl_convert_meta_external=off + fi +} +function ble/term/rl-convert-meta/leave { + [[ $_ble_term_rl_convert_meta_adjusted ]] || return 1 + _ble_term_rl_convert_meta_adjusted= + [[ $_ble_term_rl_convert_meta_external == on ]] && + builtin bind 'set convert-meta on' +} +_ble_term_attached= +_ble_term_state=external +function ble/term/enter-for-widget { + ble/term/bracketed-paste-mode/enter + ble/term/modifyOtherKeys/enter + ble/term/cursor-state/.update "$_ble_term_cursor_internal" + ble/term/cursor-state/.update-hidden "$_ble_term_cursor_hidden_internal" + [[ :$1: == *:noflush:* ]] || ble/util/buffer.flush +} +function ble/term/leave-for-widget { + ble/term/visible-bell/erase + ble/term/bracketed-paste-mode/leave + ble/term/modifyOtherKeys/leave + ble/term/cursor-state/.update "$bleopt_term_cursor_external" + ble/term/cursor-state/.update-hidden reveal + ble/util/buffer.flush +} +function ble/term/enter { + [[ $_ble_term_state == internal ]] && return 0 + _ble_term_state=internal + ble/term/stty/enter + ble/term/rl-convert-meta/enter + ble/term/enter-for-widget "$1" +} +function ble/term/leave { + [[ $_ble_term_state == external ]] && return 0 + ble/term/stty/leave + ble/term/rl-convert-meta/leave + ble/term/leave-for-widget + [[ $_ble_term_cursor_current == default ]] || + _ble_term_cursor_current=unknown # vim は復元してくれない + _ble_term_cursor_hidden_current=unknown + _ble_term_state=external +} +function ble/term/initialize { + ble/term/DA2/request + ble/term/test-DECSTBM +} +function ble/term/attach { + [[ $_ble_term_attached ]] && return 0 + _ble_term_attached=1 + ble/term/stty/initialize + ble/term/enter "$1" +} +function ble/term/detach { + [[ $_ble_term_attached ]] || return 0 + _ble_term_attached= + ble/term/stty/finalize + ble/term/leave + ble/util/buffer.flush +} +_ble_util_s2c_table_enabled= +if ((_ble_bash>=50300)); then + function ble/util/s2c { + builtin printf -v ret %d "'$1" + } +elif ((_ble_bash>=40100)); then + function ble/util/s2c { + if ble/util/is-unicode-output; then + builtin printf -v ret %d "'μ" + else + builtin printf -v ret %d "'x" + fi + builtin printf -v ret %d "'$1" + } +elif ((_ble_bash>=40000&&!_ble_bash_loaded_in_function)); then + declare -A _ble_util_s2c_table + _ble_util_s2c_table_enabled=1 + function ble/util/s2c { + [[ $_ble_util_locale_triple != "$LC_ALL:$LC_CTYPE:$LANG" ]] && + ble/util/.update-locale-cache + local s=${1::1} + ret=${_ble_util_s2c_table[x$s]} + [[ $ret ]] && return 0 + ble/util/sprintf ret %d "'$s" + _ble_util_s2c_table[x$s]=$ret + } +elif ((_ble_bash>=40000)); then + function ble/util/s2c { + ble/util/sprintf ret %d "'${1::1}" + } +else + function ble/util/s2c { + local s=${1::1} + if [[ $s == [$'\x01'-$'\x7F'] ]]; then + if [[ $s == $'\x7F' ]]; then + ret=127 + else + ble/util/sprintf ret %d "'$s" + fi + return 0 + fi + local bytes byte + ble/util/assign-words bytes ' + local IFS= + while ble/bash/read -n 1 byte; do + builtin printf "%d " "'\''$byte" + done <<< "$s" + IFS=$_ble_term_IFS + ' + ble/encoding:"$bleopt_input_encoding"/b2c "${bytes[@]}" + } +fi +if ((_ble_bash>=40200)); then + function ble/util/.has-bashbug-printf-uffff { + ((40200<=_ble_bash&&_ble_bash<50000)) || return 1 + local LC_ALL=C.UTF-8 2>/dev/null + local ret + builtin printf -v ret '\uFFFF' + ((${#ret}==2)) + } + ble/function#suppress-stderr ble/util/.has-bashbug-printf-uffff + if ble/util/.has-bashbug-printf-uffff; then + function ble/util/c2s.impl { + if ((0xE000<=$1&&$1<=0xFFFF)) && [[ $_ble_util_locale_encoding == UTF-8 ]]; then + builtin printf -v ret '\\x%02x' "$((0xE0|$1>>12&0x0F))" "$((0x80|$1>>6&0x3F))" "$((0x80|$1&0x3F))" + else + builtin printf -v ret '\\U%08x' "$1" + fi + builtin eval "ret=\$'$ret'" + } + function ble/util/chars2s.impl { + if [[ $_ble_util_locale_encoding == UTF-8 ]]; then + local -a buff=() + local c i=0 + for c; do + ble/util/c2s.cached "$c" + buff[i++]=$ret + done + IFS= builtin eval 'ret="${buff[*]}"' + else + builtin printf -v ret '\\U%08x' "$@" + builtin eval "ret=\$'$ret'" + fi + } + else + function ble/util/c2s.impl { + builtin printf -v ret '\\U%08x' "$1" + builtin eval "ret=\$'$ret'" + } + function ble/util/chars2s.impl { + builtin printf -v ret '\\U%08x' "$@" + builtin eval "ret=\$'$ret'" + } + fi +else + _ble_text_xdigit=(0 1 2 3 4 5 6 7 8 9 A B C D E F) + _ble_text_hexmap=() + for ((i=0;i<256;i++)); do + _ble_text_hexmap[i]=${_ble_text_xdigit[i>>4&0xF]}${_ble_text_xdigit[i&0xF]} + done + function ble/util/c2s.impl { + if (($1<0x80)); then + builtin eval "ret=\$'\\x${_ble_text_hexmap[$1]}'" + return 0 + fi + local bytes i iN seq= + ble/encoding:"$_ble_util_locale_encoding"/c2b "$1" + for ((i=0,iN=${#bytes[@]};i/dev/null # suppress locale error #D1440 +function ble/util/.test-utf8-locale { + local LC_ALL= LC_CTYPE= LANG=C + local s='あ' + LANG=$ctype + ((${#s}==1)); local ext=$? + ble/util/unlocal LC_ALL LC_CTYPE LANG + return "$ext" +} 2>/dev/null # suppress locale error #D1440 +function ble/util/.update-locale-cache { + _ble_util_locale_triple=$LC_ALL:$LC_CTYPE:$LANG + local ctype=${LC_ALL:-${LC_CTYPE:-$LANG}} + local ret; ble/string#tolower "$ctype" + if [[ $_ble_util_locale_ctype != "$ret" ]]; then + _ble_util_locale_ctype=$ret + _ble_util_c2s_table=() + [[ $_ble_util_s2c_table_enabled ]] && + _ble_util_s2c_table=() + _ble_util_locale_encoding=C + _ble_util_locale_broken= + ble/util/.test-C-locale || _ble_util_locale_broken=C + if local rex='\.([^@]+)'; [[ $_ble_util_locale_ctype =~ $rex ]]; then + local enc=${BASH_REMATCH[1]} + if [[ $enc == utf-8 || $enc == utf8 ]]; then + enc=UTF-8 + fi + if [[ $enc == UTF-8 ]] && ! ble/util/.test-utf8-locale "$ctype"; then + _ble_util_locale_broken=${_ble_util_locale_broken:+$_ble_util_locale_broken$_ble_term_FS}$ctype + if ble/base/is-wsl; then + ble/function#advice around ble/util/c2s.impl ' + local char=${ADVICE_WORDS[1]} + if [[ $_ble_util_locale_broken ]] && ((char>=0x80)); then + if ((char<0x10000)); then + ble/util/sprintf ret '\''\\u%04X'\'' "$char" + else + ble/util/sprintf ret '\''\\U%08X'\'' "$char" + fi + else + ble/function#advice/do + fi + ' + ble/function#advice around ble/util/chars2s.impl ' + local char=${ADVICE_WORDS[1]} + if [[ $_ble_util_locale_broken ]]; then + local out= char + for char in "${ADVICE_WORDS[@]:1}"; do + ble/util/c2s "$char" + out=$out$ret + done + ret=$out + else + ble/function#advice/do + fi + ' + fi + elif ble/is-function ble/encoding:"$enc"/b2c; then + _ble_util_locale_encoding=$enc + fi + fi + fi +} +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_util_locale_broken_notified}" +function ble/util/notify-broken-locale { + [[ $_ble_util_locale_triple != "$LC_ALL:$LC_CTYPE:$LANG" ]] && + ble/util/.update-locale-cache + [[ $_ble_util_locale_broken ]] || return 0 + local broken broken_locales + ble/string#split broken_locales "$_ble_term_FS" "$_ble_util_locale_broken" + for broken in "${broken_locales[@]}"; do + [[ $broken ]] || continue + ble/gdict#has _ble_util_locale_broken_notified "$broken" && continue + ble/gdict#set _ble_util_locale_broken_notified "$broken" 1 + ble/util/print "ble.sh: The locale '$broken' (LC_CTYPE) seems broken. Please check that the locale exists in the system." >&2 + if [[ $broken == C && $OSTYPE == linux-android && $HOME == */com.termux/* ]]; then + ble/util/print 'ble.sh: Termux has an issue with its locale "C", and the fix is discussed at https://github.com/termux/termux-packages/discussions/23010' >&2 + fi + done +} +function ble/util/is-unicode-output { + [[ $_ble_util_locale_triple != "$LC_ALL:$LC_CTYPE:$LANG" ]] && + ble/util/.update-locale-cache + [[ $_ble_util_locale_encoding == UTF-8 ]] +} +function ble/util/s2chars { + local text=$1 n=${#1} i chars + chars=() + for ((i=0;i/dev/null +function ble/util/c2keyseq { + local char=$(($1)) + case $char in + (7) ret='\a' ;; + (8) ret='\b' ;; + (9) ret='\t' ;; + (10) ret='\n' ;; + (11) ret='\v' ;; + (12) ret='\f' ;; + (13) ret='\r' ;; + (27) ret='\e' ;; + (92) ret='\\' ;; + (127) ret='\d' ;; + (28) ret='\x1c' ;; # workaround \C-\, \C-\\ + (156) ret='\x9c' ;; # workaround \M-\C-\, \M-\C-\\ + (*) + if ((char<32||128<=char&&char<160)); then + local char7=$((char&0x7F)) + if ((1<=char7&&char7<=26)); then + ble/util/c2s "$((char7+96))" + else + ble/util/c2s "$((char7+64))" + fi + ret='\C-'$ret + ((char&0x80)) && ret='\M-'$ret + else + ble/util/c2s "$char" + fi ;; + esac +} +function ble/util/chars2keyseq { + local char str= + for char; do + ble/util/c2keyseq "$char" + str=$str$ret + done + ret=$str +} +function ble/util/keyseq2chars { + local keyseq=$1 + local -a chars=() + local mods= + local rex='^([^\]+)|^\\([CM]-|[0-7]{1,3}|x[0-9a-fA-F]{1,2}|.)?' + while [[ $keyseq ]]; do + local text=${keyseq::1} esc + [[ $keyseq =~ $rex ]] && + text=${BASH_REMATCH[1]} esc=${BASH_REMATCH[2]} + if [[ $text ]]; then + keyseq=${keyseq:${#text}} + ble/util/s2chars "$text" + else + keyseq=${keyseq:1+${#esc}} + ret=() + case $esc in + ([CM]-) mods=$mods${esc::1}; continue ;; + (x?*) ret=$((16#${esc#x})) ;; + ([0-7]*) ret=$((8#$esc)) ;; + (a) ret=7 ;; + (b) ret=8 ;; + (t) ret=9 ;; + (n) ret=10 ;; + (v) ret=11 ;; + (f) ret=12 ;; + (r) ret=13 ;; + (e) ret=27 ;; + (d) ret=127 ;; + (*) ble/util/s2c "$esc" ;; + esac + fi + [[ $mods == *C* ]] && ((ret=ret==63?127:(ret&0x1F))) + [[ $mods == *M* ]] && ble/array#push chars 27 + mods= + ble/array#push chars "${ret[@]}" + done + if [[ $mods ]]; then + [[ $mods == *M* ]] && ble/array#push chars 27 + ble/array#push chars 0 + fi + ret=("${chars[@]}") +} +function ble/encoding:UTF-8/b2c { + local bytes b0 n i + bytes=("$@") + ret=0 + ((b0=bytes[0]&0xFF)) + ((n=b0>=0xF0 + ?(b0>=0xFC?5:(b0>=0xF8?4:3)) + :(b0>=0xE0?2:(b0>=0xC0?1:0)), + ret=n?b0&0x7F>>n:b0)) + for ((i=1;i<=n;i++)); do + ((ret=ret<<6|0x3F&bytes[i])) + done +} +function ble/encoding:UTF-8/c2b { + local code=$1 n i + ((code=code&0x7FFFFFFF, + n=code<0x80?0:( + code<0x800?1:( + code<0x10000?2:( + code<0x200000?3:( + code<0x4000000?4:5)))))) + if ((n==0)); then + bytes=("$code") + else + bytes=() + for ((i=n;i;i--)); do + ((bytes[i]=0x80|code&0x3F, + code>>=6)) + done + ((bytes[0]=code&0x3F>>n|0xFF80>>n&0xFF)) + fi +} +function ble/encoding:C/b2c { + local byte=$1 + ((ret=byte&0xFF)) +} +function ble/encoding:C/c2b { + local code=$1 + bytes=("$((code&0xFF))") +} +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_builtin_readonly_blacklist}" +function ble/builtin/readonly/.initialize-blacklist { + function ble/builtin/readonly/.initialize-blacklist { return 0; } + local -a list=() + ble/array#push list FUNCNEST IFS IGNOREEOF POSIXLY_CORRECT TMOUT # adjust + ble/array#push list PWD OLDPWD CDPATH # readlink + ble/array#push list BASHPID GLOBIGNORE MAPFILE REPLY # util + ble/array#push list INPUTRC # decode + ble/array#push list LINES COLUMNS # canvas + ble/array#push list HIST{CONTROL,IGNORE,SIZE,TIMEFORMAT} # history + ble/array#push list PROMPT_COMMAND PS1 # prompt + ble/array#push list BASH_COMMAND BASH_REMATCH HISTCMD LINENO PIPESTATUS TIMEFORMAT # exec + ble/array#push list BASH_XTRACEFD PS4 # debug + ble/array#push list CC LESS MANOPT MANPAGER PAGER PATH MANPATH + ble/array#push list BUFF # util + ble/array#push list KEYS KEYMAP WIDGET LASTWIDGET # decode + ble/array#push list DRAW_BUFF # canvas + ble/array#push list D{MIN,MAX,MAX0} {HIGHLIGHT,PREV}_{BUFF,UMAX,UMIN} LEVEL LAYER_{UMAX,UMIN} # color + ble/array#push list HISTINDEX_NEXT FILE LINE INDEX INDEX_FILE # history + ble/array#push list ARG FLAG REG # vi + ble/array#push list COMP{1,2,S,V} ACTION CAND DATA INSERT PREFIX_LEN # core-complete + ble/array#push list PRETTY_NAME NAME VERSION # edit (/etc/os-release) + local v + for v in "${list[@]}"; do ble/gdict#set _ble_builtin_readonly_blacklist "$v" 1; done +} +function ble/builtin/readonly/.check-variable-name { + ble/variable#is-global "$1" || return 0 + if [[ $1 == _* && $1 != _ble* && $1 != __ble* ]]; then + return 0 + fi + case $1 in + (?) return 1;; # single character variables + (BLE_*|ADVICE_*) return 1;; # ble.sh variables + (COMP_*|COMPREPLY) return 1;; # completion variables + (READLINE_*) return 1;; # readline variables + (LC_*|LANG) return 1;; # locale variables + esac + ble/builtin/readonly/.initialize-blacklist + if ble/gdict#has _ble_builtin_readonly_blacklist "$1"; then + return 1 + fi + if [[ $1 != *[a-z]* ]]; then + return 0 + fi + return 1 +} +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_builtin_readonly_mark}" +_ble_builtin_readonly_message_count=0 +blehook internal_PREEXEC!='_ble_builtin_readonly_message_count=0' +function ble/builtin/readonly/.print-warning { + [[ -t 2 ]] || return 0 + if [[ ! $_ble_local_caller ]]; then + _ble_local_caller=- + local i n=${#FUNCNAME[@]} + for ((i=1;i&2 + return 0 +} +function ble/builtin/readonly { + local _ble_local_set _ble_local_shopt + ble/base/.adjust-bash-options _ble_local_set _ble_local_shopt + local LC_ALL= LC_COLLATE=C 2>/dev/null # suppress locale error #D1440 + local _ble_local_flags= + local -a _ble_local_options=() + local _ble_local_caller= # used by print-warning + while (($#)); do + if ble/string#match "$1" '^([_a-zA-Z][_a-zA-Z0-9]*)($|=)'; then + _ble_local_flags=v$_ble_local_flags + local _ble_local_var=${BASH_REMATCH[1]} + if [[ ${BASH_REMATCH[2]} == = ]]; then + ble/util/sprintf "$_ble_local_var" "${1#*=}" + fi + if ble/builtin/readonly/.check-variable-name "$_ble_local_var"; then + _ble_local_flags=r$_ble_local_flags + ble/array#push _ble_local_options "$_ble_local_var" + else + ble/builtin/readonly/.print-warning "$1" + fi + else + ble/array#push _ble_local_options "$1" + fi + shift + done + if [[ $_ble_local_flags == *w* ]]; then + ble/util/print 'ble.sh: The global variables with unprefixed lowercase names or special names should not be made readonly. It can break arbitrary Bash configurations.' >&2 + fi + local _ble_local_ext=0 + if [[ $_ble_local_flags != *v* || $_ble_local_flags == *r* ]]; then + builtin readonly "${_ble_local_options[@]}" + _ble_local_ext=$? + fi + ble/util/unlocal LC_ALL LC_COLLATE 2>/dev/null # suppress locale error #D1440 + ble/base/.restore-bash-options _ble_local_set _ble_local_shopt + return "$?" +} +function readonly { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/readonly "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +>| "$_ble_base_run/$$.util.message-listening" +>> "$_ble_base_run/$$.util.message" +_ble_util_message_precmd=() +function ble/util/message/.encode-data { + local target=$1 data=$2 + if ((${#data}<256)); then + ble/string#quote-word "$data" + ret=eval:$ret + else + if ((_ble_bash<40000)); then + local BASHPID + ble/util/getpid + fi + local index=0 file + while + file=$_ble_base_run/$target.util.message.data-$BASHPID-$index + [[ -e $file ]] + do ((++index)); done + ble/util/put "$data" >| "$file" + ret=file:${file##*.} + fi +} +function ble/util/message/.decode-data { + ret=$1 + case $ret in + (eval:*) + local value=${ret#eval:} + ble/syntax:bash/simple-word/is-simple "$value" && + builtin eval -- "ret=($value)" ;; + (file:*) + local file=$_ble_base_run/$$.util.message.${ret#file:} + ble/util/readfile ret "$file" + ble/array#push _ble_local_remove "$file" + esac +} +function ble/util/message.post { + local target=${1:-$$} event=${2-} type=${3-} data=${4-} + if ! [[ $type && $type != *["$_ble_term_IFS"]* ]]; then + ble/util/print "ble/util/message: invalid message type format '$type'" >&2 + return 2 + elif [[ $target == $$ ]] && ! ble/is-function ble/util/message/handler:"$type"; then + ble/util/print "ble/util/message: unknown message type name '$type'" >&2 + return 2 + fi + case $event in + (precmd) ;; + (*) + ble/util/print "ble/util/message: unknown event type '$event'" >&2 + return 2 ;; + esac + if [[ $target == broadcast ]]; then + local ret file + ble/util/eval-pathname-expansion '"$_ble_base_run"/+([0-9]).util.message-listening' canonical + for file in "${ret[@]}"; do + file=${file%-listening} + local pid=${file##*/}; pid=${pid%%.*} + if builtin kill -0 "$pid"; then + ble/util/message/.encode-data "$pid" "$data" + ble/util/print "$event $type $ret" >> "$file" + fi + done + elif ble/string#match "$target" '^[0-9]+$'; then + if ! builtin kill -0 "$target"; then + ble/util/print "ble/util/message: target process $target is not found" >&2 + return 2 + elif [[ ! -f $_ble_base_run/$target.util.message-listening ]]; then + ble/util/print "ble/util/message: target process $target is not listening ble-messages" >&2 + return 2 + fi + local ret + ble/util/message/.encode-data "$target" "$data" + ble/util/print "$event $type $ret" >> "$_ble_base_run/$target.util.message" + else + ble/util/print "ble/util/message: unknown target '$target'" >&2 + return 2 + fi +} +function ble/util/message.check { + local file=$_ble_base_run/$$.util.message + while [[ -f $file && -s $file ]]; do + local fread=$file + ble/bin/mv -f "$file" "$file-reading" && fread=$file-reading + local IFS=$_ble_term_IFS event type data + while ble/bash/read event type data || [[ $event ]]; do + [[ $type ]] && ble/is-function ble/util/message/handler:"$type" || continue + case $event in + (precmd) ble/array#push _ble_util_message_precmd "$type $data" ;; + esac + done < "$fread" + >| "$fread" + done +} +function ble/util/message.process { + ble/util/message.check + local event=$1 + case $event in + (precmd) + local _ble_local_messages + _ble_local_messages=("${_ble_util_message_precmd[@]}") + _ble_util_message_precmd=() + local _ble_local_message + local -a _ble_local_remove=() + for _ble_local_message in "${_ble_local_messages[@]}"; do + local _ble_local_event=${_ble_local_message%%' '*} + local ret; ble/util/message/.decode-data "${_ble_local_message#* }" + local _ble_local_data=$ret + ble/util/unlocal ret + ble/util/message/handler:"$_ble_local_event" "$_ble_local_data" + done + ((${#_ble_local_remove[@]})) && ble/bin/rm -f "${_ble_local_remove[@]}" ;; + (*) + ble/util/print "ble/util/message: unknown event type '$event'" >&2 + return 2 ;; + esac +} +function ble/util/message/handler:print { + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + ble/util/print "$1" >&2 + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout +} +blehook internal_PRECMD!='ble/util/message.process precmd' +bleopt/declare -v debug_xtrace '' +bleopt/declare -v debug_xtrace_ps4 '+ ' +ble/bin#freeze-utility-path "${_ble_init_posix_command_list[@]}" # <- this uses ble/util/assign. +ble/bin#freeze-utility-path man +ble/bin#freeze-utility-path groff nroff mandoc gzip bzcat lzcat xzcat # used by core-complete.sh +ble/bin/sed/.instantiate +ble/bin/stty/.instantiate +ble/function#trace trap ble/builtin/trap ble/builtin/trap/finalize +ble/function#trace ble/builtin/trap/.handler ble/builtin/trap/invoke ble/builtin/trap/invoke.sandbox +ble/builtin/trap/install-hook EXIT +ble/builtin/trap/install-hook INT +ble/builtin/trap/install-hook ERR inactive +ble/builtin/trap/install-hook RETURN inactive +function ble/base/initialize-session { + local ret + ble/string#split ret / "${_ble_base_session-}" + [[ ${ret[1]} == "$$" ]] && return 0 + ble/util/timeval; local start_time=$ret + ((start_time-=SECONDS*1000000)) + _ble_base_session=${start_time::${#start_time}-6}.${start_time:${#start_time}-6}/$$ + export BLE_SESSION_ID=$_ble_base_session +} +ble/base/initialize-session +function ble/base/check-bash-debug-version { + [[ -t 2 ]] || return 0 + case ${BASH_VERSINFO[4]} in + (alp*|bet*|dev*|rc*|releng*|maint*) ;; + (*) return 0 ;; + esac + local type=check ret + ble/opts#extract-last-optarg "$_ble_base_arguments_opts" bash-debug-version check && type=$ret + [[ $type == ignore ]] && return 0 + if [[ $type == once ]]; then + local file=$_ble_base_cache/base.bash-debug-version-checked.txt + local -a checked=() + [[ ! -d $file && -r $file && -s $file ]] && ble/util/mapfile checked < "$file" + if ble/array#index checked "$BASH_VERSION"; then + return 0 + else + ble/util/print "$BASH_VERSION" >> "$file" + fi + fi + local sgr0=$_ble_term_sgr0 + local sgr1=${_ble_term_setaf[4]} + local sgr2=${_ble_term_setaf[6]} + local sgr3=${_ble_term_setaf[2]} + local sgrC=${_ble_term_setaf[8]} + local bold=$_ble_term_bold + if [[ $type == short || $_ble_init_command ]]; then + ble/util/print-lines \ + "Note: ble.sh can be very slow in a debug version of Bash: $sgr3$BASH_VERSION$sgr0" >&2 + else + ble/util/print-lines \ + "$bold# ble.sh with debug version of Bash$sgr0" \ + '' \ + 'ble.sh may become very slow because this is a debug version of Bash (version' \ + "\`$sgr3$BASH_VERSION$sgr0', release status: \`$sgr3${BASH_VERSINFO[4]}$sgr0'). We recommend using" \ + 'ble.sh with a release version of Bash. If you want to use ble.sh with a' \ + 'non-release version of Bash, it is highly recommended to build Bash with the' \ + "configure option \`$sgr2--with-bash-malloc=no$sgr0' for practical performance:" \ + '' \ + " $sgr1./configure $bold--with-bash-malloc=no$sgr0" \ + '' \ + 'To suppress this startup warning message, please specify the option' \ + "\`$sgr2--bash-debug-version=short$sgr0' or \`${sgr2}once$sgr0' or \`${sgr2}ignore$sgr0' to \`ble.sh':" \ + '' \ + " ${sgrC}# Show a short version of the message$sgr0" \ + " ${sgr1}source -- /path/to/ble.sh $bold--bash-debug-version=short$sgr0" \ + '' \ + " ${sgrC}# Do not print the warning message more than once$sgr0" \ + " ${sgr1}source -- /path/to/ble.sh $bold--bash-debug-version=once$sgr0" \ + '' \ + " ${sgrC}# Show the warning message only once for each debug version of Bash$sgr0" \ + " ${sgr1}source -- /path/to/ble.sh $bold--bash-debug-version=ignore$sgr0" \ + '' >&2 + fi +} +ble/base/check-bash-debug-version +bleopt/declare -v decode_error_char_abell '' +bleopt/declare -v decode_error_char_vbell 1 +bleopt/declare -v decode_error_char_discard '' +bleopt/declare -v decode_error_cseq_abell '' +bleopt/declare -v decode_error_cseq_vbell '' +bleopt/declare -v decode_error_cseq_discard 1 +bleopt/declare -v decode_error_kseq_abell 1 +bleopt/declare -v decode_error_kseq_vbell 1 +bleopt/declare -v decode_error_kseq_discard 1 +bleopt/declare -n default_keymap auto +function bleopt/check:default_keymap { + case $value in + (auto|emacs|vi|safe) + if [[ $_ble_decode_bind_state != none ]]; then + local bleopt_default_keymap=$value + ble/decode/reset-default-keymap + fi + return 0 ;; + (*) + ble/util/print "bleopt: Invalid value default_keymap='value'. The value should be one of \`auto', \`emacs', \`vi'." >&2 + return 1 ;; + esac +} +function bleopt/get:default_keymap { + ret=$bleopt_default_keymap + if [[ $ret == auto ]]; then + if [[ -o vi ]]; then + ret=vi + else + ret=emacs + fi + fi +} +bleopt/declare -n decode_isolated_esc auto +function bleopt/check:decode_isolated_esc { + case $value in + (meta|esc|auto) ;; + (*) + ble/util/print "bleopt: Invalid value decode_isolated_esc='$value'. One of the values 'auto', 'meta' or 'esc' is expected." >&2 + return 1 ;; + esac +} +function ble/decode/uses-isolated-esc { + if [[ $bleopt_decode_isolated_esc == esc ]]; then + return 0 + elif [[ $bleopt_decode_isolated_esc == auto ]]; then + if local ret; bleopt/get:default_keymap; [[ $ret == vi ]]; then + return 0 + elif [[ ! $_ble_decode_key__seq ]]; then + local dicthead=_ble_decode_${_ble_decode_keymap}_kmap_ key=$((_ble_decode_Ctrl|91)) + builtin eval "local ent=\${$dicthead$_ble_decode_key__seq[key]-}" + [[ ${ent:2} ]] && return 0 + fi + fi + return 1 +} +bleopt/declare -n decode_abort_char 28 +bleopt/declare -n decode_macro_limit 1024 +_ble_decode_Meta=0x08000000 +_ble_decode_Ctrl=0x04000000 +_ble_decode_Shft=0x02000000 +_ble_decode_Hypr=0x01000000 +_ble_decode_Supr=0x00800000 +_ble_decode_Altr=0x00400000 +_ble_decode_MaskChar=0x001FFFFF +_ble_decode_MaskFlag=0x7FC00000 +_ble_decode_Erro=0x40000000 +_ble_decode_Macr=0x20000000 +_ble_decode_Flag3=0x10000000 # unused +_ble_decode_FlagA=0x00200000 # unused +_ble_decode_IsolatedESC=$((0x07BC)) +_ble_decode_PrefixO=$((0x07BA)) # Used to detect "ESC O A" in bash <= 4.4 +_ble_decode_EscapedNUL=$((0x07BB)) # Used to record NUL +_ble_decode_Timeout=$((0x07B9)) # Used to record ble/decode/wait-input failure +_ble_decode_FunctionKeyBase=0x110000 +function ble/decode/mod2flag { + ret=0 + local mod=$1 + ((mod&0x01&&(ret|=_ble_decode_Shft), + mod&0x02&&(ret|=_ble_decode_Meta), + mod&0x04&&(ret|=_ble_decode_Ctrl), + mod&0x08&&(ret|=_ble_decode_Supr), + mod&0x10&&(ret|=_ble_decode_Hypr), + mod&0x20&&(ret|=_ble_decode_Altr))) +} +function ble/decode/flag2mod { + ret=0 + local flag=$1 + ((flag&_ble_decode_Shft&&(ret|=0x01), + flag&_ble_decode_Meta&&(ret|=0x02), + flag&_ble_decode_Ctrl&&(ret|=0x04), + flag&_ble_decode_Supr&&(ret|=0x08), + flag&_ble_decode_Hypr&&(ret|=0x10), + flag&_ble_decode_Altr&&(ret|=0x20))) +} +_ble_decode_kbd_ver=gdict +_ble_decode_kbd__n=0 +_ble_decode_kbd__c2k=() +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_decode_kbd__k2c}" +ble/is-assoc _ble_decode_kbd__k2c || _ble_decode_kbd_ver=adict +function ble/decode/kbd/.set-keycode { + local keyname=$1 + local code=$2 + : "${_ble_decode_kbd__c2k[code]:=$keyname}" + ble/gdict#set _ble_decode_kbd__k2c "$keyname" "$code" +} +function ble/decode/kbd/.get-keycode { + ble/gdict#get _ble_decode_kbd__k2c "$1" +} +function ble/decode/kbd/.get-keyname { + local keycode=$1 + ret=${_ble_decode_kbd__c2k[keycode]} + if [[ ! $ret ]] && ((keycode<_ble_decode_FunctionKeyBase)); then + ble/util/c2s "$keycode" + fi +} +function ble/decode/kbd/.generate-keycode { + local keyname=$1 + if ((${#keyname}==1)); then + ble/util/s2c "$1" + elif [[ $keyname && ! ${keyname//[_a-zA-Z0-9]} ]]; then + ble/decode/kbd/.get-keycode "$keyname" + if [[ ! $ret ]]; then + ((ret=_ble_decode_FunctionKeyBase+_ble_decode_kbd__n++)) + ble/decode/kbd/.set-keycode "$keyname" "$ret" + fi + else + ret=-1 + return 1 + fi +} +function ble/decode/kbd/generate-keycode { + ble/decode/cmap/initialize + ble/decode/kbd/.generate-keycode "$@" +} +function ble-decode-kbd { + ble/decode/cmap/initialize + local IFS=$_ble_term_IFS + local spec="$*" + case $spec in + (keys:*) + ret="${spec#*:}" + return 0 ;; + (chars:*) + local chars + ble/string#split-words chars "${spec#*:}" + ble/decode/cmap/decode-chars "${ret[@]}" + ret="${keys[*]}" + return 0 ;; + (keyseq:*) # i.e. untranslated keyseq + local keys + ble/util/keyseq2chars "${spec#*:}" + ble/decode/cmap/decode-chars "${ret[@]}" + ret="${keys[*]}" + return 0 ;; + (raw:*) # i.e. translated keyseq + ble/util/s2chars "${spec#*:}" + ble/decode/cmap/decode-chars "${ret[@]}" + ret="${keys[*]}" + return 0 ;; + (kspecs:*) + spec=${spec#*:} ;; + esac + local kspecs; ble/string#split-words kspecs "$spec" + local kspec code codes + codes=() + for kspec in "${kspecs[@]}"; do + code=0 + while [[ $kspec == ?-* ]]; do + case ${kspec::1} in + (S) ((code|=_ble_decode_Shft)) ;; + (C) ((code|=_ble_decode_Ctrl)) ;; + (M) ((code|=_ble_decode_Meta)) ;; + (A) ((code|=_ble_decode_Altr)) ;; + (s) ((code|=_ble_decode_Supr)) ;; + (H) ((code|=_ble_decode_Hypr)) ;; + (*) ((code|=_ble_decode_Erro)) ;; + esac + kspec=${kspec:2} + done + if [[ $kspec == ? ]]; then + ble/util/s2c "$kspec" + ((code|=ret)) + elif [[ $kspec && ! ${kspec//[@_a-zA-Z0-9]} ]]; then + ble/decode/kbd/.get-keycode "$kspec" + [[ $ret ]] || ble/decode/kbd/.generate-keycode "$kspec" + ((code|=ret)) + elif [[ $kspec == ^? ]]; then + if [[ $kspec == '^?' ]]; then + ((code|=0x7F)) + elif [[ $kspec == '^`' ]]; then + ((code|=0x20)) + else + ble/util/s2c "${kspec:1}" + ((code|=ret&0x1F)) + fi + elif local rex='^U\+([0-9a-fA-F]+)$'; [[ $kspec =~ $rex ]]; then + ((code|=0x${BASH_REMATCH[1]})) + else + ((code|=_ble_decode_Erro)) + fi + codes[${#codes[@]}]=$code + done + ret="${codes[*]}" +} +function ble-decode-unkbd/.single-key { + local key=$1 + local f_unknown= + local char=$((key&_ble_decode_MaskChar)) + ble/decode/kbd/.get-keyname "$char" + if [[ ! $ret ]]; then + f_unknown=1 + ret=__UNKNOWN__ + fi + ((key&_ble_decode_Shft)) && ret=S-$ret + ((key&_ble_decode_Meta)) && ret=M-$ret + ((key&_ble_decode_Ctrl)) && ret=C-$ret + ((key&_ble_decode_Altr)) && ret=A-$ret + ((key&_ble_decode_Supr)) && ret=s-$ret + ((key&_ble_decode_Hypr)) && ret=H-$ret + [[ ! $f_unknown ]] +} +function ble-decode-unkbd { + ble/decode/cmap/initialize + local IFS=$_ble_term_IFS + local -a keys + ble/string#split-words keys "$*" + local -a kspecs=() + local key + for key in "${keys[@]}"; do + ble-decode-unkbd/.single-key "$key" + kspecs[${#kspecs[@]}]=$ret + done + ret="${kspecs[*]}" +} +function ble/decode/keys2chars { + ble/decode/cmap/initialize + local -a keys=() + local key + for key; do + local flag=$((key&_ble_decode_MaskFlag)) + local char=$((key&_ble_decode_MaskChar)) + if ((flag&_ble_decode_Meta)); then + ble/array#push keys 27 + ((flag&=~_ble_decode_Meta)) + fi + if ((flag==_ble_decode_Ctrl&&(char==63||char==64||91<=char&&char<=95||97<=char&&char<=122))); then + ble/array#push keys "$((char==63?127:(char&0x1F)))" + continue + fi + local mod_param= + if ((flag)); then + ble/decode/flag2mod "$flag" + mod_param=$((ret+1)) + fi + local csi=${_ble_decode_csimap_dict[char]-} + if [[ $csi == tilde:* ]]; then + local params=${csi#*:} + if [[ $mod_param ]]; then + params=$params';'$mod_param + fi + ble/util/s2chars "$params" + ble/array#push keys 27 91 "${ret[@]}" 126 + elif [[ $csi == alpha:* ]]; then + if [[ $mod_param ]]; then + ble/util/s2chars "1;$mod_param" + else + ret=() + fi + ble/array#push keys 27 91 "${ret[@]}" "${csi#*:}" + elif ((flag||char>=_ble_decode_FunctionKeyBase)); then + ble/util/s2chars "27;${mod_param:-1};$char" + ble/array#push keys 27 91 "${ret[@]}" 126 + else + ble/array#push keys "$char" + fi + done + ret=("${keys[@]}") +} +function ble-decode/PROLOGUE { return 0; } +function ble-decode/EPILOGUE { return 0; } +_ble_decode_input_buffer=() +_ble_decode_input_count=0 +_ble_decode_input_original_info=() +_ble_decode_show_progress_hook=ble-decode/.hook/show-progress +_ble_decode_erase_progress_hook=ble-decode/.hook/erase-progress +function ble-decode/.hook/show-progress { + if [[ $_ble_edit_info_scene == store ]]; then + _ble_decode_input_original_info=("${_ble_edit_info[@]}") + return 0 + elif [[ $_ble_edit_info_scene == default ]]; then + _ble_decode_input_original_info=() + elif [[ $_ble_edit_info_scene != decode_input_progress ]]; then + return 0 + fi + local progress_opts= opt_percentage=1 + if [[ $ble_batch_insert_count ]]; then + local total=$ble_batch_insert_count + local value=$ble_batch_insert_index + local label='constructing text...' + local sgr=$'\e[1;38;5;204;48;5;253m' + elif ((${#_ble_decode_input_buffer[@]})); then + local total=10000 + local value=$((${#_ble_decode_input_buffer[@]}%10000)) + local label="${#_ble_decode_input_buffer[@]} bytes received..." + local sgr=$'\e[1;38;5;135;48;5;253m' + progress_opts=unlimited + opt_percentage= + elif ((_ble_decode_input_count)); then + local total=${#chars[@]} + local value=$((total-_ble_decode_input_count-1)) + local label='decoding input...' + local sgr=$'\e[1;38;5;69;48;5;253m' + elif ((ble_decode_char_total)); then + local total=$ble_decode_char_total + local value=$((total-ble_decode_char_rest-1)) + local label='processing input...' + local sgr=$'\e[1;38;5;71;48;5;253m' + else + return 0 + fi + if [[ $opt_percentage ]]; then + local mill=$((value*1000/total)) + local cent=${mill::${#mill}-1} frac=${mill:${#mill}-1} + label="${cent:-0}.$frac% $label" + fi + local text="($label)" + if ble/util/is-unicode-output; then + local ret + ble/string#create-unicode-progress-bar "$value" "$total" 10 "$progress_opts" + text=$sgr$ret$'\e[m '$text + fi + ble/edit/info/show ansi "$text" + _ble_edit_info_scene=decode_input_progress +} +function ble-decode/.hook/erase-progress { + [[ $_ble_edit_info_scene == decode_input_progress ]] || return 1 + if ((${#_ble_decode_input_original_info[@]})); then + ble/edit/info/show store "${_ble_decode_input_original_info[@]}" + else + ble/edit/info/default + fi +} +function ble-decode/.check-abort { + if (($1==bleopt_decode_abort_char)); then + local nbytes=${#_ble_decode_input_buffer[@]} + local nchars=${#_ble_decode_char_buffer[@]} + ((nbytes||nchars)); return "$?" + fi + (($1==0x7e||$1==0x75)) || return 1 + local i=$((${#_ble_decode_input_buffer[@]}-1)) + local n + ((n=bleopt_decode_abort_char, + n+=(1<=n&&n<=26?96:64))) + if (($1==0x7e)); then + for ((;n;n/=10)); do + ((i>=0)) && ((_ble_decode_input_buffer[i--]==n%10+48)) || return 1 + done + ((i>=4)) || return 1 + ((_ble_decode_input_buffer[i--]==59)) || return 1 + ((_ble_decode_input_buffer[i--]==53)) || return 1 + ((_ble_decode_input_buffer[i--]==59)) || return 1 + ((_ble_decode_input_buffer[i--]==55)) || return 1 + ((_ble_decode_input_buffer[i--]==50)) || return 1 + elif (($1==0x75)); then + ((i>=1)) || return 1 + ((_ble_decode_input_buffer[i--]==53)) || return 1 + ((_ble_decode_input_buffer[i--]==59)) || return 1 + for ((;n;n/=10)); do + ((i>=0)) && ((_ble_decode_input_buffer[i--]==n%10+48)) || return 1 + done + fi + ((i>=0)) && ((_ble_decode_input_buffer[i]==62&&i--)) + ((i>=0)) || return 1 + if ((_ble_decode_input_buffer[i]==0x5B)); then + if ((i>=1&&_ble_decode_input_buffer[i-1]==0x1B)); then + ((i-=2)) + elif ((i>=2&&_ble_decode_input_buffer[i-1]==0x9B&&_ble_decode_input_buffer[i-2]==0xC0)); then + ((i-=3)) + else + return 1 + fi + elif ((_ble_decode_input_buffer[i]==0x9B)); then + ((--i>=0)) && ((_ble_decode_input_buffer[i--]==0xC2)) || return 1 + else + return 1 + fi + (((i>=0||${#_ble_decode_char_buffer[@]}))); return "$?" + return 0 +} +if ((_ble_bash>=40400)); then + function ble/decode/nonblocking-read { + local timeout=${1:-0.01} ntimeout=${2:-1} loop=${3:-100} + local LC_ALL= LC_CTYPE=C IFS= + local -a data=() + local line buff ext + while ((loop--)); do + ble/bash/read-timeout "$timeout" -r -d '' buff; ext=$? + [[ $buff ]] && line=$line$buff + if ((ext==0)); then + ble/array#push data "$line" + line= + elif ((ext>128)); then + ((--ntimeout)) || break + [[ $buff ]] || break + else + break + fi + done + ble/util/assign ret '{ + ((${#data[@]})) && printf %s\\0 "${data[@]}" + [[ $line ]] && printf %s "$line" + } | ble/bin/od -A n -t u1 -v' + ble/string#split-words ret "$ret" + } + ble/function#suppress-stderr ble/decode/nonblocking-read +elif ((_ble_bash>=40000)); then + function ble/decode/nonblocking-read { + local timeout=${1:-0.01} ntimeout=${2:-1} loop=${3:-100} + local LC_ALL= LC_CTYPE=C IFS= 2>/dev/null + local -a data=() + local line buff + while ((loop--)); do + builtin read -t 0 || break + ble/bash/read -d '' -n 1 buff || break + if [[ $buff ]]; then + line=$line$buff + else + ble/array#push data "$line" + line= + fi + done + ble/util/assign ret '{ + ((${#data[@]})) && printf %s\\0 "${data[@]}" + [[ $line ]] && printf %s "$line" + } | ble/bin/od -A n -t u1 -v' + ble/string#split-words ret "$ret" + } + ble/function#suppress-stderr ble/decode/nonblocking-read +fi +function ble-decode/.hook/adjust-volatile-options { + if [[ $_ble_bash_options_adjusted ]]; then + set +ev + fi +} +_ble_decode_hook_count=${_ble_decode_hook_count:+0} +_ble_decode_hook_Processing= +function _ble_decode_hook { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_unset" + ((_ble_decode_hook_count++)) + if ble/util/is-stdin-ready; then + ble/array#push _ble_decode_input_buffer "$@" + local buflen=${#_ble_decode_input_buffer[@]} + if ((buflen%257==0&&buflen>=2000)); then + ble-decode/.hook/adjust-volatile-options + local IFS=$_ble_term_IFS + local _ble_decode_hook_Processing=prologue + ble-decode/PROLOGUE + _ble_decode_hook_Processing=body + local char=${_ble_decode_input_buffer[buflen-1]} + if ((_ble_bash<40000||char==0xC0||char==0xDE)); then + builtin eval -- "$_ble_decode_show_progress_hook" + else + while ble/util/is-stdin-ready; do + builtin eval -- "$_ble_decode_show_progress_hook" + local ret; ble/decode/nonblocking-read 0.02 1 527 + ble/array#push _ble_decode_input_buffer "${ret[@]}" + done + fi + _ble_decode_hook_Processing=epilogue + ble-decode/EPILOGUE + ble/util/unlocal _ble_decode_hook_Processing + local ret + ble/array#pop _ble_decode_input_buffer + _ble_decode_hook "$ret" + fi + return 0 + fi + ble-decode/.hook/adjust-volatile-options + local IFS=$_ble_term_IFS + local _ble_decode_hook_Processing=prologue + ble-decode/PROLOGUE + _ble_decode_hook_Processing=body + if ble-decode/.check-abort "$1"; then + _ble_decode_char__hook= + _ble_decode_input_buffer=() + _ble_decode_char_buffer=() + ble/term/visible-bell "Abort by 'bleopt decode_abort_char=$bleopt_decode_abort_char'" + shift + fi + local chars + ble/array#set chars "${_ble_decode_input_buffer[@]}" "$@" + _ble_decode_input_buffer=() + _ble_decode_input_count=${#chars[@]} + if ((_ble_decode_input_count>=200)); then + local i N=${#chars[@]} + local B=$((N/100)) + ((B<100)) && B=100 || ((B>1000)) && B=1000 + for ((i=0;i=0)); then + if ((33<=key&&key<_ble_decode_FunctionKeyBase)); then + local term=${_ble_term_TERM[0]+${_ble_term_TERM[${#_ble_term_TERM[@]}-1]}} + if (((mod&0x01)&&0x31<=key&&key<=0x39)) && [[ $term == RLogin:* ]]; then + ((key-=16,mod&=~0x01)) + elif ((mod==0x01)); then + if [[ $term != contra:* ]]; then + ((mod&=~0x01)) + fi + elif ((65<=key&&key<=90)); then + ((key|=0x20)) + fi + fi + local ret + ble/decode/mod2flag "$mod" + ((key|=ret)) + fi +} +function ble/decode/csi/.decode { + local char=$1 rex key + if ((char==126)); then # ~ + if rex='^>?27;([0-9]+);?([0-9]+)$' && [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param2=$((10#0${BASH_REMATCH[2]})) + local key=$((param2&_ble_decode_MaskChar)) + ble/decode/csi/.modify-key "$param1" + csistat=$key + return 0 + fi + if rex='^>?([0-9]+)(;([0-9]+))?$' && [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param3=$((10#0${BASH_REMATCH[3]})) + key=${_ble_decode_csimap_tilde[param1]} + if [[ $key ]]; then + ble/decode/csi/.modify-key "$param3" + csistat=$key + return 0 + fi + fi + elif ((char==117)); then # u + if rex='^([0-9]*)(;[0-9]*)?$'; [[ $_ble_decode_csi_args =~ $rex ]]; then + local rematch1=${BASH_REMATCH[1]} + if [[ $rematch1 != 1 ]]; then + local key=$((10#0$rematch1)) mods=$((10#0${BASH_REMATCH:${#rematch1}+1})) + [[ $_ble_term_TERM == kitty:* ]] && ble/decode/csi/.translate-kitty-csi-u + ble/decode/csi/.modify-key "$mods" + csistat=$key + fi + return 0 + fi + elif ((char==94||char==64)); then # ^, @ + if rex='^[0-9]+$' && [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param3=$((10#0${BASH_REMATCH[3]})) + key=${_ble_decode_csimap_tilde[param1]} + if [[ $key ]]; then + ((key|=_ble_decode_Ctrl, + char==64&&(key|=_ble_decode_Shft))) + ble/decode/csi/.modify-key "$param3" + csistat=$key + return 0 + fi + fi + elif ((char==99)); then # c + if rex='^[?>]'; [[ $_ble_decode_csi_args =~ $rex ]]; then + if [[ $_ble_decode_csi_args == '?'* ]]; then + ble/term/DA1/notify "${_ble_decode_csi_args:1}" + else + ble/term/DA2/notify "${_ble_decode_csi_args:1}" + fi + csistat=$_ble_decode_KCODE_IGNORE + return 0 + fi + elif ((char==82||char==110)); then # R or n + if rex='^([0-9]+);([0-9]+)$'; [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param2=$((10#0${BASH_REMATCH[2]})) + ble/term/CPR/notify "$param1" "$param2" + csistat=$_ble_decode_KCODE_IGNORE + return 0 + fi + elif ((char==77||char==109)); then # M or m + if rex='^<([0-9]+);([0-9]+);([0-9]+)$'; [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param2=$((10#0${BASH_REMATCH[2]})) + local param3=$((10#0${BASH_REMATCH[3]})) + local button=$param1 + ((_ble_term_mouse_button=button&~0x1C, + char==109&&(_ble_term_mouse_button|=0x70), + _ble_term_mouse_x=param2-1, + _ble_term_mouse_y=param3-1)) + local key=$_ble_decode_KCODE_MOUSE + ((button&32)) && key=$_ble_decode_KCODE_MOUSE_MOVE + ble/decode/csi/.modify-key "$((button>>2&0x07))" + csistat=$key + return 0 + fi + elif ((char==116)); then # t + if rex='^<([0-9]+);([0-9]+)$'; [[ $_ble_decode_csi_args =~ $rex ]]; then + local param1=$((10#0${BASH_REMATCH[1]})) + local param2=$((10#0${BASH_REMATCH[2]})) + ((_ble_term_mouse_button=128, + _ble_term_mouse_x=param1-1, + _ble_term_mouse_y=param2-1)) + local key=$_ble_decode_KCODE_MOUSE + csistat=$key + fi + fi + key=${_ble_decode_csimap_alpha[char]} + if [[ $key ]]; then + if rex='^(1?|>?1;([0-9]+))$' && [[ $_ble_decode_csi_args =~ $rex ]]; then + local param2=$((10#0${BASH_REMATCH[2]})) + ble/decode/csi/.modify-key "$param2" + csistat=$key + return 0 + fi + fi + csistat=$_ble_decode_KCODE_ERROR +} +function ble/decode/csi/consume { + csistat= + ((_ble_decode_csi_mode==0&&$1!=27&&$1!=155)) && return 1 + local char=$1 + case $_ble_decode_csi_mode in + (0) + ((_ble_decode_csi_mode=$1==155?2:1)) + _ble_decode_csi_args= + csistat=_ ;; + (1) + if ((char!=91)); then + _ble_decode_csi_mode=0 + return 1 + else + _ble_decode_csi_mode=2 + _ble_decode_csi_args= + csistat=_ + fi ;; + (2) + if ((32<=char&&char<64)); then + local ret; ble/util/c2s "$char" + _ble_decode_csi_args=$_ble_decode_csi_args$ret + csistat=_ + elif ((64<=char&&char<127)); then + _ble_decode_csi_mode=0 + ble/decode/csi/.decode "$char" + ((csistat==27)) && csistat=$_ble_decode_IsolatedESC + else + _ble_decode_csi_mode=0 + fi ;; + esac +} +_ble_decode_char_buffer=() +function ble/decode/has-input-for-char { + ((_ble_decode_input_count)) || + { [[ ! $ble_decode_char_sync ]] && ble/util/is-stdin-ready; } || + ble/encoding:"$bleopt_input_encoding"/is-intermediate +} +_ble_decode_char__hook= +_ble_decode_cmap_=() +_ble_decode_char2_seq= +_ble_decode_char2_keylog=() +_ble_decode_char2_reach_key= +_ble_decode_char2_reach_seq= +_ble_decode_char2_reach_keylog=() +_ble_decode_char2_modifier= +_ble_decode_char2_modkcode= +_ble_decode_char2_modseq=() +function ble-decode-char { + if [[ $ble_decode_char_nest && ! $ble_decode_char_sync ]]; then + ble/array#push _ble_decode_char_buffer "$@" + return 148 + fi + local ble_decode_char_nest=1 + local iloop=0 + local ble_decode_char_total=$# + local ble_decode_char_rest=$# + local ble_decode_char_rchar= + local ble_decode_char_next= + local chars ichar rchar char ent ent_timeout + chars=("$@") ichar=0 + while + if ((iloop++%50==0)); then + ((iloop>=200)) && builtin eval -- "$_ble_decode_show_progress_hook" + if [[ ! $ble_decode_char_sync ]] && ble/decode/has-input-for-char; then + ble/array#push _ble_decode_char_buffer "${chars[@]:ichar}" + return 148 + fi + fi + if ((${#_ble_decode_char_buffer[@]})); then + ((ble_decode_char_total+=${#_ble_decode_char_buffer[@]})) + ((ble_decode_char_rest+=${#_ble_decode_char_buffer[@]})) + ble/array#set chars "${_ble_decode_char_buffer[@]}" "${chars[@]:ichar}" + ichar=0 + _ble_decode_char_buffer=() + fi + ((ble_decode_char_rest)) + do + rchar=${chars[ichar]} # raw char + ble_decode_char_rchar=$rchar # used by ble/widget/.MACRO to test _ble_decode_Macr + ((char=rchar&~_ble_decode_Macr)) + ((ble_decode_char_rest--,ichar++)) + ble_decode_char_next=$((${chars[ichar]:-0}&~_ble_decode_Macr)) # for ble/decode/wait-input '...' char + if ((char==_ble_decode_PrefixO)); then + char=79 # @prefixO -> O + elif ((char==_ble_decode_Timeout)); then + continue + fi + if ((char&_ble_decode_Erro)); then + ((char&=~_ble_decode_Erro)) + if [[ $bleopt_decode_error_char_vbell ]]; then + local name; ble/util/sprintf name 'U+%04x' "$char" + ble/term/visible-bell "received a misencoded char $name" + fi + [[ $bleopt_decode_error_char_abell ]] && ble/term/audible-bell + if [[ $bleopt_decode_error_char_discard ]]; then + ble/decode/process-char/.keylog "$rchar" + continue + fi + fi + if [[ $_ble_decode_char__hook ]]; then + ((char==_ble_decode_IsolatedESC)) && char=27 # isolated ESC -> ESC + local hook=$_ble_decode_char__hook + _ble_decode_char__hook= + ble/decode/process-char/.keylog "$rchar" + ble-decode/widget/.call-async-read "$hook $char" "$char" + continue + fi + ble/decode/process-char/.getent # -> ent ent_timeout + if [[ ! $ent ]]; then + if [[ $_ble_decode_char2_reach_key ]]; then + local key=$_ble_decode_char2_reach_key + local seq=$_ble_decode_char2_reach_seq rest + rest=("${_ble_decode_char2_keylog[@]:${#_ble_decode_char2_reach_keylog[@]}}" "$rchar") + ble/decode/process-char/.keylog "${_ble_decode_char2_reach_keylog[@]}" + _ble_decode_char2_seq= + _ble_decode_char2_keylog=() + _ble_decode_char2_reach_key= + _ble_decode_char2_reach_seq= + _ble_decode_char2_reach_keylog=() + ble/decode/csi/clear + ble/decode/send-unmodified-key "$key" "$seq" + ((ble_decode_char_total+=${#rest[@]})) + ((ble_decode_char_rest+=${#rest[@]})) + chars=("${rest[@]}" "${chars[@]:ichar}") ichar=0 + else + ble/decode/process-char/.keylog "$rchar" ${ent_timeout:+"$_ble_decode_Timeout"} + local ret + ble/decode/process-char/.convert-c0 "$char" + ble/decode/send-unmodified-key "$ret" "_$char" + fi + elif [[ $ent == *_ ]]; then + _ble_decode_char2_seq=${_ble_decode_char2_seq}_$char + ble/array#push _ble_decode_char2_keylog "$rchar" + if [[ ${ent%_} ]]; then + _ble_decode_char2_reach_key=${ent%_} + _ble_decode_char2_reach_seq=$_ble_decode_char2_seq + _ble_decode_char2_reach_keylog=("${_ble_decode_char2_keylog[@]}") + elif [[ ! $_ble_decode_char2_reach_key ]]; then + local ret + ble/decode/process-char/.convert-c0 "$char" + _ble_decode_char2_reach_key=$ret + _ble_decode_char2_reach_seq=$_ble_decode_char2_seq + _ble_decode_char2_reach_keylog=("${_ble_decode_char2_keylog[@]}") + fi + else + local seq=${_ble_decode_char2_seq}_$char + ble/decode/process-char/.keylog "${_ble_decode_char2_keylog[@]}" "$rchar" ${ent_timeout:+"$_ble_decode_Timeout"} + _ble_decode_char2_seq= + _ble_decode_char2_keylog=() + _ble_decode_char2_reach_key= + _ble_decode_char2_reach_seq= + _ble_decode_char2_reach_keylog=() + ble/decode/csi/clear + ble/decode/send-unmodified-key "$ent" "$seq" + fi + done + return 0 +} +function ble/decode/char-hook/next-char { + ((ble_decode_char_rest)) || return 1 + ((char=chars[ichar]&~_ble_decode_Macr)) + ((char&_ble_decode_Erro)) && return 1 + ((iloop%1000==0)) && return 1 + ((char==_ble_decode_IsolatedESC)) && char=27 + ((ble_decode_char_rest--,ichar++,iloop++)) + return 0 +} +function ble/decode/process-char/.keylog { + if ((_ble_debug_keylog_enabled)); then + ble/array#push _ble_debug_keylog_chars "$@" + fi + if [[ $_ble_decode_keylog_chars_enabled ]]; then + local char + for char; do + if ! ((char&_ble_decode_Macr)); then + ble/array#push _ble_decode_keylog_chars "$char" + ((_ble_decode_keylog_chars_count++)) + fi + done + fi +} +function ble/decode/process-char/.getent { + local csistat= + builtin eval "ent=\${_ble_decode_cmap_$_ble_decode_char2_seq[char]-}" + ble/decode/csi/consume "$char" + if [[ $ent == ?*_ || $ent == _ && $_ble_decode_char2_seq == _27 ]]; then + if ((rchar!=_ble_decode_PrefixO)) && ! ble/decode/wait-input 5 char; then + ent=${ent%_} + ent_timeout=1 + fi + fi + if [[ $csistat && ! ${ent%_} ]]; then + ent_timeout= + if [[ $csistat == "$_ble_decode_KCODE_ERROR" ]]; then + if [[ $bleopt_decode_error_cseq_vbell ]]; then + local ret + ble/string#split ret "${_ble_decode_char2_seq//_/ } $char" + ble-decode-unkbd "${ret[@]}" + ble/term/visible-bell "unrecognized CSI sequence: $ret" + fi + [[ $bleopt_decode_error_cseq_abell ]] && ble/term/audible-bell + if [[ $bleopt_decode_error_cseq_discard ]]; then + csistat=$_ble_decode_KCODE_IGNORE + else + csistat= + fi + fi + if [[ ! $ent ]]; then + ent=$csistat + else + ent=${csistat%_}_ + fi + fi +} +function ble/decode/process-char/.convert-c0 { + ret=$1 + if ((0<=ret&&ret<32)); then + ((ret|=(ret==0||ret>26?64:96)|_ble_decode_Ctrl)) + elif ((ret==127)); then # C-? + ((ret=63|_ble_decode_Ctrl)) + fi +} +function ble/decode/send-unmodified-key/.add-modifier { + local mflag1=$1 mflag=$_ble_decode_char2_modifier + if ((mflag1&mflag)); then + return 1 + else + ((_ble_decode_char2_modkcode=key|mflag, + _ble_decode_char2_modifier=mflag1|mflag)) + ble/array#push _ble_decode_char2_modseq "${seq[@]}" + return 0 + fi +} +function ble/decode/send-unmodified-key { + local key=$1 + ((key==_ble_decode_KCODE_IGNORE)) && return 0 + local seq + ble/string#split-words seq "${2//_/ }" + ((seq[0]==_ble_decode_IsolatedESC)) && seq[0]=27 + if [[ $2 == _27 ]]; then + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Meta" && return 0 + fi + if + if ((key==_ble_decode_IsolatedESC)); then + if [[ $2 == "_$_ble_decode_IsolatedESC" ]]; then + key=$((_ble_decode_Ctrl|91)) + else + key=27 + fi + else + ((key==27)) + fi + then + if ! ble/decode/uses-isolated-esc; then + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Meta" && return 0 + fi + fi + if ((_ble_decode_KCODE_SHIFT<=key&&key<=_ble_decode_KCODE_HYPER)); then + case $1 in + ($_ble_decode_KCODE_SHIFT) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Shft" && return 0 ;; + ($_ble_decode_KCODE_CONTROL) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Ctrl" && return 0 ;; + ($_ble_decode_KCODE_ALTER) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Altr" && return 0 ;; + ($_ble_decode_KCODE_META) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Meta" && return 0 ;; + ($_ble_decode_KCODE_SUPER) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Supr" && return 0 ;; + ($_ble_decode_KCODE_HYPER) + ble/decode/send-unmodified-key/.add-modifier "$_ble_decode_Hypr" && return 0 ;; + esac + fi + if [[ $_ble_decode_char2_modifier ]]; then + local mflag mcode mseq + mflag=$_ble_decode_char2_modifier + mcode=$_ble_decode_char2_modkcode + mseq=("${_ble_decode_char2_modseq[@]}") + _ble_decode_char2_modifier= + _ble_decode_char2_modkcode= + _ble_decode_char2_modseq=() + if ((key&mflag)); then + local _ble_decode_key__chars + _ble_decode_key__chars=("${mseq[@]}") + ble-decode-key "$mcode" + else + seq=("${mseq[@]}" "${seq[@]}") + ((key|=mflag)) + fi + fi + local _ble_decode_key__chars + _ble_decode_key__chars=("${seq[@]}") + ble-decode-key "$key" +} +function ble-decode-char/is-intermediate { [[ $_ble_decode_char2_seq ]]; } +function ble-decode-char/bind { + local -a seq; ble/string#split-words seq "$1" + local kc=$2 + local i iN=${#seq[@]} char tseq= + for ((i=0;i| "$delay" + fi +} +function ble/decode/keymap#load { + local opts=:$2: + ble/decode/keymap#registered "$1" && return 0 + local init=ble-decode/keymap:$1/define + ble/is-function "$init" || return 1 + ble/decode/keymap#.register "$1" + local ble_bind_keymap=$1 + if ! "$init" || ble/decode/keymap#is-empty "$1"; then + ble/decode/keymap#.unregister "$1" + return 1 + fi + [[ $opts == *:dump:* ]] && + ble/decode/keymap#dump "$1" >&3 + ble/decode/keymap#.onload "$1" + return 0 +} +function ble/decode/keymap#unload { + if (($#==0)); then + local list; ble/string#split-words list "${_ble_decode_keymap_list//:/ }" + set -- "${list[@]}" + fi + while (($#)); do + local array_names array_name + builtin eval -- "array_names=(\"\${!_ble_decode_${1}_kmap_@}\")" + for array_name in "${array_names[@]}"; do + builtin unset -v "$array_name" + done + ble/decode/keymap#.unregister "$1" + shift + done +} +if [[ ${_ble_decode_kmaps-} ]]; then + function ble/decode/keymap/cleanup-old-keymaps { + local -a list=() + local var + for var in "${!_ble_decode_@}"; do + [[ $var == _ble_decode_*_kmap_ ]] || continue + var=${var#_ble_decode_} + var=${var%_kmap_} + ble/array#push list "$var" + done + local keymap_name + for keymap_name in "${list[@]}"; do + ble/decode/keymap#unload "$keymap_name" + done + builtin unset -v _ble_decode_kmaps + } + ble/decode/keymap/cleanup-old-keymaps +fi +function ble/decode/keymap#dump { + if (($#)); then + local kmap=$1 arrays + builtin eval "arrays=(\"\${!_ble_decode_${kmap}_kmap_@}\")" + ble/util/print "ble/decode/keymap#.register $kmap" + ble/util/declare-print-definitions "${arrays[@]}" + ble/util/print "ble/decode/keymap#.onload $kmap" + else + local list; ble/string#split-words list "${_ble_decode_keymap_list//:/ }" + local keymap_name + for keymap_name in "${list[@]}"; do + ble/decode/keymap#dump "$keymap_name" + done + fi +} +function ble-decode/GET_BASEMAP { + [[ $1 == -v ]] || return 1 + local ret; bleopt/get:default_keymap + [[ $ret == vi ]] && ret=vi_imap + builtin eval "$2=\$ret" +} +function ble-decode/INITIALIZE_DEFMAP { + ble-decode/GET_BASEMAP "$@" && + ble/decode/keymap#load "${!2}" && + return 0 + ble/decode/keymap#load safe && + builtin eval -- "$2=safe" && + bleopt_default_keymap=safe +} +function ble/widget/.SHELL_COMMAND { local IFS=$_ble_term_IFS; builtin eval -- "$*"; } +function ble/widget/.EDIT_COMMAND { local IFS=$_ble_term_IFS; builtin eval -- "$*"; } +function ble-decode-key/bind { + if ! ble/decode/keymap#registered "$1"; then + ble/util/print-quoted-command "$FUNCNAME" "$@" >> "$_ble_base_run/$$.bind.delay.$1" + return 0 + fi + local kmap=$1 keys=$2 cmd=$3 + if local widget=${cmd%%[$_ble_term_IFS]*}; ! ble/is-function "$widget"; then + local message="ble-bind: Unknown widget \`${widget#'ble/widget/'}'." + [[ $cmd == ble/widget/ble/widget/* ]] && + message="$message Note: The prefix 'ble/widget/' is redundant." + ble/util/print "$message" >&2 + return 1 + fi + local dicthead=_ble_decode_${kmap}_kmap_ + local -a seq; ble/string#split-words seq "$keys" + local i iN=${#seq[@]} tseq= + for ((i=0;i> "$_ble_base_run/$$.bind.delay.$1" + return 0 + fi + local kmap=$1 keys=$2 timeout=$3 + local dicthead=_ble_decode_${kmap}_kmap_ + local -a seq; ble/string#split-words seq "$keys" + [[ $timeout == - ]] && timeout= + local i iN=${#seq[@]} + local key=${seq[iN-1]} + local tseq= + for ((i=0;i&2 + return 1 + fi +} +function ble-decode-key/unbind { + if ! ble/decode/keymap#registered "$1"; then + ble/util/print-quoted-command "$FUNCNAME" "$@" >> "$_ble_base_run/$$.bind.delay.$1" + return 0 + fi + local kmap=$1 keys=$2 + local dicthead=_ble_decode_${kmap}_kmap_ + local -a seq; ble/string#split-words seq "$keys" + local i iN=${#seq[@]} + local key=${seq[iN-1]} + local tseq= + for ((i=0;i> "$_ble_base_run/$$.bind.delay.$keymap" + return 0 + fi + builtin eval "_ble_decode_${keymap}_kmap_cursor=\$cursor" + if [[ $keymap == "$_ble_decode_keymap" && $cursor ]]; then + ble/term/cursor-state/set-internal "$((cursor))" + fi +} +function ble/decode/keymap#print { + local kmap + if (($#==0)); then + for kmap in ${_ble_decode_keymap_list//:/ }; do + ble/util/print "$sgrc# keymap $kmap$sgr0" + ble/decode/keymap#print "$kmap" + done + return 0 + fi + [[ $ble_bind_print ]] || local sgr0= sgrf= sgrq= sgrc= sgro= + local kmap=$1 tseq=$2 nseq=$3 + local dicthead=_ble_decode_${kmap}_kmap_ + local kmapopt= + [[ $kmap ]] && kmapopt=" $sgro-m$sgr0 $sgrq'$kmap'$sgr0" + local q=\' Q="'\''" + local key keys + builtin eval "keys=(\${!$dicthead$tseq[@]})" + for key in "${keys[@]}"; do + local ret; ble-decode-unkbd "$key" + local knames=$nseq${nseq:+ }$ret + builtin eval "local ent=\${$dicthead$tseq[key]}" + local qknames + if [[ $ble_bind_print ]]; then + ble/string#quote-word "$knames" "$quote_word_opts"; qknames=$ret + else + qknames="'${knames//$q/$Q}'" + fi + if [[ $ent == *:* ]]; then + local cmd=${ent#*:} + local o v + case $cmd in + ('ble/widget/.SHELL_COMMAND '*) o=c v=${cmd#'ble/widget/.SHELL_COMMAND '}; builtin eval "v=$v" ;; + ('ble/widget/.EDIT_COMMAND '*) o=x v=${cmd#'ble/widget/.EDIT_COMMAND '} ; builtin eval "v=$v" ;; + ('ble/widget/.MACRO '*) o=s; ble/util/chars2keyseq ${cmd#*' '}; v=$ret ;; + ('ble/widget/'*) o=f v=${cmd#ble/widget/} ;; + (*) o=@ v=$cmd ;; + esac + local qv + if [[ $ble_bind_print ]]; then + ble/string#quote-word "$v" "$quote_word_opts"; qv=$ret + else + qv="'${v//$q/$Q}'" + fi + ble/util/print "${sgrf}ble-bind$sgr0$kmapopt $sgro-$o$sgr0 $qknames $qv" + fi + if [[ ${ent::1} == _ ]]; then + ble/decode/keymap#print "$kmap" "${tseq}_$key" "$knames" + if [[ $ent == _[0-9]* ]]; then + local timeout=${ent%%:*}; timeout=${timeout:1} + ble/util/print "${sgrf}ble-bind$sgr0$kmapopt $sgro-T$sgr0 $qknames $timeout" + fi + fi + done +} +_ble_decode_keymap= +_ble_decode_keymap_stack=() +function ble/decode/keymap/push { + if ble/decode/keymap#registered "$1"; then + ble/array#push _ble_decode_keymap_stack "$_ble_decode_keymap" + _ble_decode_keymap=$1 + local cursor; ble/decode/keymap#get-cursor "$1" + [[ $cursor ]] && ble/term/cursor-state/set-internal "$((cursor))" + return 0 + elif ble/decode/keymap#load "$1" && ble/decode/keymap#registered "$1"; then + ble/decode/keymap/push "$1" # 再実行 + else + ble/util/print "[ble: keymap '$1' not found]" >&2 + return 1 + fi +} +function ble/decode/keymap/pop { + local count=${#_ble_decode_keymap_stack[@]} + local last=$((count-1)) + ble/util/assert '((last>=0))' || return 1 + local cursor + ble/decode/keymap#get-cursor "$_ble_decode_keymap" + if [[ $cursor ]]; then + local i + for ((i=last;i>=0;i--)); do + ble/decode/keymap#get-cursor "${_ble_decode_keymap_stack[i]}" + [[ $cursor ]] && break + done + ble/term/cursor-state/set-internal "$((${cursor:-0}))" + fi + local old_keymap=_ble_decode_keymap + _ble_decode_keymap=${_ble_decode_keymap_stack[last]} + builtin unset -v '_ble_decode_keymap_stack[last]' +} +function ble/decode/keymap/get-parent { + local len=${#_ble_decode_keymap_stack[@]} + if ((len)); then + ret=${_ble_decode_keymap_stack[len-1]} + else + ret= + fi +} +function ble/decode/keymap/get-major-keymap { + keymap=$_ble_decode_keymap + local index=${#_ble_decode_keymap_stack[@]} + while ((1)); do + case $keymap in (vi_?map|emacs) return 0 ;; esac + ((--index<0)) && break + keymap=${_ble_decode_keymap_stack[index]} + done + return 1 +} +_ble_decode_key__chars=() +_ble_decode_key__seq= +_ble_decode_key__hook= +function ble-decode-key/is-intermediate { [[ $_ble_decode_key__seq ]]; } +_ble_decode_key_batch=() +function ble-decode-key/batch/flush { + ((${#_ble_decode_key_batch[@]})) || return 1 + local dicthead=_ble_decode_${_ble_decode_keymap}_kmap_ + builtin eval "local command=\${${dicthead}[_ble_decode_KCODE_BATCH_CHAR]-}" + command=${command:2} + if [[ $command ]]; then + local chars; chars=("${_ble_decode_key_batch[@]}") + _ble_decode_key_batch=() + ble/decode/widget/call-interactively "$command" "${chars[@]}"; local ext=$? + ((ext!=125)) && return 0 + fi + ble/decode/widget/call-interactively ble/widget/__batch_char__.default "${chars[@]}"; local ext=$? + return "$ext" +} +function ble/widget/__batch_char__.default { + builtin eval "local widget_defchar=\${${dicthead}[_ble_decode_KCODE_DEFCHAR]-}" + widget_defchar=${widget_defchar:2} + builtin eval "local widget_default=\${${dicthead}[_ble_decode_KCODE_DEFAULT]-}" + widget_default=${widget_default:2} + local -a unprocessed_chars=() + local key command + for key in "${KEYS[@]}"; do + if [[ $widget_defchar ]]; then + ble/decode/widget/call-interactively "$widget_defchar" "$key"; local ext=$? + ((ext!=125)) && continue + fi + if [[ $widget_default ]]; then + ble/decode/widget/call-interactively "$widget_default" "$key"; local ext=$? + ((ext!=125)) && continue + fi + ble/array#push unprocessed_chars "$key" + done + if ((${#unprocessed_chars[@]})); then + local ret; ble-decode-unkbd "${unprocessed_chars[@]}" + [[ $bleopt_decode_error_kseq_vbell ]] && ble/term/visible-bell "unprocessed chars: $ret" + [[ $bleopt_decode_error_kseq_abell ]] && ble/term/audible-bell + fi + return 0 +} +function ble-decode-key { + local CHARS + CHARS=("${_ble_decode_key__chars[@]}") + local key + while (($#)); do + key=$1; shift + ((_ble_debug_keylog_enabled)) && ble/array#push _ble_debug_keylog_keys "$key" + if [[ $_ble_decode_keylog_keys_enabled && $_ble_decode_keylog_depth == 0 ]]; then + ble/array#push _ble_decode_keylog_keys "$key" + ((_ble_decode_keylog_keys_count++)) + fi + local dicthead=_ble_decode_${_ble_decode_keymap}_kmap_ + if (((key&_ble_decode_MaskChar)==_ble_decode_KCODE_MOUSE_MOVE)); then + builtin eval "local command=\${${dicthead}[key]-}" + command=${command:2} + ble-decode/widget/.call-keyseq + continue + fi + if [[ $_ble_decode_key__hook ]]; then + local hook=$_ble_decode_key__hook + _ble_decode_key__hook= + ble-decode/widget/.call-async-read "$hook $key" "$key" + continue + fi + builtin eval "local ent=\${$dicthead$_ble_decode_key__seq[key]-}" + if [[ $ent == _[0-9]* ]]; then + local node_type=_ + if (($#==0)) && ! ble/decode/has-input; then + local timeout=${ent%%:*}; timeout=${timeout:1} + ble/decode/wait-input "$timeout" || node_type=1 + fi + if [[ $ent == *:* ]]; then + ent=$node_type:${ent#*:} + else + ent=$node_type + fi + fi + if [[ $ent == 1:* ]]; then + local command=${ent:2} + if [[ $command ]]; then + ble-decode/widget/.call-keyseq + else + _ble_decode_key__seq= + fi + elif [[ $ent == _ || $ent == _:* ]]; then + _ble_decode_key__seq=${_ble_decode_key__seq}_$key + else + ble-decode-key/.invoke-partial-match "$key" && continue + local kseq=${_ble_decode_key__seq}_$key ret + ble-decode-unkbd "${kseq//_/ }" + local kspecs=$ret + [[ $bleopt_decode_error_kseq_vbell ]] && ble/term/visible-bell "unbound keyseq: $kspecs" + [[ $bleopt_decode_error_kseq_abell ]] && ble/term/audible-bell + if [[ $_ble_decode_key__seq ]]; then + if [[ $bleopt_decode_error_kseq_discard ]]; then + _ble_decode_key__seq= + else + local -a keys + ble/string#split-words keys "${_ble_decode_key__seq//_/ } $key" + _ble_decode_key__seq= + ble-decode-key "${keys[@]:1}" + fi + fi + fi + done + if ((${#_ble_decode_key_batch[@]})); then + if ! ble/decode/has-input || ((${#_ble_decode_key_batch[@]}>=50)); then + ble-decode-key/batch/flush + fi + fi + return 0 +} +function ble-decode-key/.invoke-partial-match { + local dicthead=_ble_decode_${_ble_decode_keymap}_kmap_ + local next=$1 + if [[ $_ble_decode_key__seq ]]; then + local last=${_ble_decode_key__seq##*_} + _ble_decode_key__seq=${_ble_decode_key__seq%_*} + builtin eval "local ent=\${$dicthead$_ble_decode_key__seq[last]-}" + if [[ $ent == _*:* ]]; then + local command=${ent#*:} + if [[ $command ]]; then + ble-decode/widget/.call-keyseq + else + _ble_decode_key__seq= + fi + ble-decode-key "$next" + return 0 + else # ent = _ + if ble-decode-key/.invoke-partial-match "$last"; then + ble-decode-key "$next" + return 0 + else + _ble_decode_key__seq=${_ble_decode_key__seq}_$last + return 1 + fi + fi + else + local key=$1 + if ble-decode-key/ischar "$key"; then + if ble/decode/has-input && builtin eval "[[ \${${dicthead}[_ble_decode_KCODE_BATCH_CHAR]-} ]]"; then + ble/array#push _ble_decode_key_batch "$key" + return 0 + fi + builtin eval "local command=\${${dicthead}[_ble_decode_KCODE_DEFCHAR]-}" + command=${command:2} + if [[ $command ]]; then + local seq_save=$_ble_decode_key__seq + ble-decode/widget/.call-keyseq; local ext=$? + ((ext!=125)) && return 0 + _ble_decode_key__seq=$seq_save # 125 の時はまた元に戻して次の試行を行う + fi + fi + builtin eval "local command=\${${dicthead}[_ble_decode_KCODE_DEFAULT]-}" + command=${command:2} + ble-decode/widget/.call-keyseq; local ext=$? + ((ext!=125)) && return 0 + return 1 + fi +} +function ble-decode-key/ischar { + local key=$1 + (((key&_ble_decode_MaskFlag)==0&&32<=key&&key<_ble_decode_FunctionKeyBase)) +} +_ble_decode_widget_last= +function ble-decode/widget/.invoke-hook { + local key=$1 + local dicthead=_ble_decode_${_ble_decode_keymap}_kmap_ + builtin eval "local hook=\${$dicthead[key]-}" + hook=${hook:2} + [[ $hook ]] && builtin eval -- "$hook" +} +function ble-decode/widget/.call-keyseq { + ble-decode-key/batch/flush + [[ $command ]] || return 125 + local _ble_decode_keylog_depth=$((_ble_decode_keylog_depth+1)) + local WIDGET=$command KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last + local -a KEYS; ble/string#split-words KEYS "${_ble_decode_key__seq//_/ } $key" + _ble_decode_widget_last=$WIDGET + _ble_decode_key__seq= + ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_BEFORE_WIDGET" + builtin eval -- "$WIDGET"; local ext=$? + ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_AFTER_WIDGET" + ((_ble_decode_keylog_depth==1)) && + _ble_decode_keylog_chars_count=0 _ble_decode_keylog_keys_count=0 + return "$ext" +} +function ble-decode/widget/.call-async-read { + local _ble_decode_keylog_depth=$((_ble_decode_keylog_depth+1)) + local WIDGET=$1 KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last + local -a KEYS; ble/string#split-words KEYS "$2" + builtin eval -- "$WIDGET"; local ext=$? + ((_ble_decode_keylog_depth==1)) && + _ble_decode_keylog_chars_count=0 _ble_decode_keylog_keys_count=0 + return "$ext" +} +function ble/decode/widget/call-interactively { + local WIDGET=$1 KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last + local -a KEYS; KEYS=("${@:2}") + _ble_decode_widget_last=$WIDGET + ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_BEFORE_WIDGET" + builtin eval -- "$WIDGET"; local ext=$? + ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_AFTER_WIDGET" + return "$ext" +} +function ble/decode/widget/call { + local WIDGET=$1 KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last + local -a KEYS; KEYS=("${@:2}") + _ble_decode_widget_last=$WIDGET + builtin eval -- "$WIDGET" +} +function ble/decode/widget/dispatch { + local ret; ble/string#quote-command ble/widget/"${1#ble/widget/}" "${@:2}" + local WIDGET=$ret + _ble_decode_widget_last=$WIDGET + builtin eval -- "$WIDGET" +} +function ble/decode/widget/suppress-widget { + WIDGET= +} +function ble/decode/widget/redispatch-by-keys { + ble/decode/widget/skip-lastwidget + if ((_ble_decode_keylog_depth==1)); then + ble/decode/keylog#pop + _ble_decode_keylog_depth=0 + fi + ble-decode-key "$@" +} +function ble/decode/widget/redispatch { + ble/decode/widget/redispatch-by-keys "${KEYS[@]}" +} +function ble/decode/widget/skip-lastwidget { + _ble_decode_widget_last=$LASTWIDGET +} +function ble/decode/widget/keymap-dispatch { + local name=${FUNCNAME[1]#ble/widget/} + local widget=ble/widget/$_ble_decode_keymap/$name + ble/is-function "$widget" || widget=ble/widget/default/$name + "$widget" "$@" +} +function ble/decode/has-input { + ((_ble_decode_input_count||ble_decode_char_rest)) || + { [[ ! $ble_decode_char_sync ]] && ble/util/is-stdin-ready; } || + ble/encoding:"$bleopt_input_encoding"/is-intermediate || + ble-decode-char/is-intermediate +} +function ble/decode/has-input-char { + ((_ble_decode_input_count||ble_decode_char_rest)) || + { [[ ! $ble_decode_char_sync ]] && ble/util/is-stdin-ready; } || + ble/encoding:"$bleopt_input_encoding"/is-intermediate +} +function ble/decode/wait-input { + local timeout=$1 type=${2-} + if [[ $type == char ]]; then + ((ble_decode_char_next==_ble_decode_Timeout)) && return 1 + ble/decode/has-input-char && return 0 + else + ble/decode/has-input && return 0 + fi + if [[ ! $ble_decode_char_sync ]]; then + while ((timeout>0)); do + local w=$((timeout<20?timeout:20)) + ble/util/msleep "$w" + ((timeout-=w)) + ble/util/is-stdin-ready '' 0 && return 0 + done + fi + return 1 +} +function ble/util/idle/IS_IDLE { + ! ble/decode/has-input +} +_ble_debug_keylog_enabled=0 +_ble_debug_keylog_bytes=() +_ble_debug_keylog_chars=() +_ble_debug_keylog_keys=() +function ble/debug/keylog#start { + _ble_debug_keylog_enabled=1 +} +function ble/debug/keylog#end { + { + local IFS=$_ble_term_IFS + ble/util/print '===== bytes =====' + ble/util/print "${_ble_debug_keylog_bytes[*]}" + ble/util/print + ble/util/print '===== chars =====' + local ret; ble-decode-unkbd "${_ble_debug_keylog_chars[@]}" + ble/string#split ret ' ' "$ret" + ble/util/print "${ret[*]}" + ble/util/print + ble/util/print '===== keys =====' + local ret; ble-decode-unkbd "${_ble_debug_keylog_keys[@]}" + ble/string#split ret ' ' "$ret" + ble/util/print "${ret[*]}" + ble/util/print + } | fold -w 40 + _ble_debug_keylog_enabled=0 + _ble_debug_keylog_bytes=() + _ble_debug_keylog_chars=() + _ble_debug_keylog_keys=() +} +_ble_decode_keylog_depth=0 +_ble_decode_keylog_keys_enabled= +_ble_decode_keylog_keys_count=0 +_ble_decode_keylog_keys=() +_ble_decode_keylog_chars_enabled= +_ble_decode_keylog_chars_count=0 +_ble_decode_keylog_chars=() +function ble/decode/keylog#start { + [[ $_ble_decode_keylog_keys_enabled ]] && return 1 + _ble_decode_keylog_keys_enabled=${1:-1} + _ble_decode_keylog_keys=() +} +function ble/decode/keylog#end { + ret=("${_ble_decode_keylog_keys[@]}") + _ble_decode_keylog_keys_enabled= + _ble_decode_keylog_keys=() +} +function ble/decode/keylog#pop { + [[ $_ble_decode_keylog_keys_enabled && $_ble_decode_keylog_depth == 1 ]] || return 1 + local new_size=$((${#_ble_decode_keylog_keys[@]}-_ble_decode_keylog_keys_count)) + ((new_size<0)) && new_size=0 + _ble_decode_keylog_keys=("${_ble_decode_keylog_keys[@]::new_size}") + _ble_decode_keylog_keys_count=0 +} +function ble/decode/charlog#start { + [[ $_ble_decode_keylog_chars_enabled ]] && return 1 + _ble_decode_keylog_chars_enabled=${1:-1} + _ble_decode_keylog_chars=() +} +function ble/decode/charlog#end { + [[ $_ble_decode_keylog_chars_enabled ]] || { ret=(); return 1; } + ret=("${_ble_decode_keylog_chars[@]}") + _ble_decode_keylog_chars_enabled= + _ble_decode_keylog_chars=() +} +function ble/decode/charlog#end-exclusive { + ret=() + [[ $_ble_decode_keylog_chars_enabled ]] || return 1 + local size=$((${#_ble_decode_keylog_chars[@]}-_ble_decode_keylog_chars_count)) + ((size>0)) && ret=("${_ble_decode_keylog_chars[@]::size}") + _ble_decode_keylog_chars_enabled= + _ble_decode_keylog_chars=() +} +function ble/decode/charlog#end-exclusive-depth1 { + if ((_ble_decode_keylog_depth==1)); then + ble/decode/charlog#end-exclusive + else + ble/decode/charlog#end + fi +} +function ble/decode/charlog#encode { + local -a buff=() + for char; do + ((char==0)) && char=$_ble_decode_EscapedNUL + ble/util/c2s "$char" + ble/array#push buff "$ret" + done + IFS= builtin eval 'ret="${buff[*]}"' +} +function ble/decode/charlog#decode { + local text=$1 n=${#1} i chars + chars=() + for ((i=0;i=bleopt_decode_macro_limit)); then + ((_ble_decode_macro_count==bleopt_decode_macro_limit+1)) && + ble/term/visible-bell "Macro invocation is canceled by decode_macro_limit" + return 1 + fi + else + _ble_decode_macro_count=0 + fi + (($#)) || return 0 + local chars i + chars=("$@") + ((chars[$#-1]==27)) && chars[$#-1]=$_ble_decode_IsolatedESC + for i in "${!chars[@]}"; do + ((chars[i]|=_ble_decode_Macr)) + done + ble-decode-char "${chars[@]}" +} +function ble/decode/c2dqs { + local i=$1 + if ((0<=i&&i<32)); then + if ((1<=i&&i<=26)); then + ble/util/c2s "$((i+96))" + ret="\\C-$ret" + elif ((i==27)); then + ret="\\e" + elif ((i==28)); then + ret="\\x1c" + else + ble/decode/c2dqs "$((i+64))" + ret="\\C-$ret" + fi + elif ((32<=i&&i<127)); then + ble/util/c2s "$i" + if ((i==34||i==92)); then + ret='\'"$ret" + fi + elif ((128<=i&&i<160)); then + ble/util/sprintf ret '\\%03o' "$i" + else + ble/util/sprintf ret '\\%03o' "$i" + fi +} +function ble/decode/cmap/.generate-binder-template { + local tseq=$1 qseq=$2 nseq=$3 depth=${4:-1} ccode + local apos="'" escapos="'\\''" + builtin eval "local -a ccodes; ccodes=(\${!_ble_decode_cmap_$tseq[@]})" + for ccode in "${ccodes[@]}"; do + local ret + ble/decode/c2dqs "$ccode" + local qseq1=$qseq$ret + local nseq1="$nseq $ccode" + builtin eval "local ent=\${_ble_decode_cmap_$tseq[ccode]}" + if [[ ${ent%_} ]]; then + if ((depth>=3)); then + ble/util/print "\$binder \"$qseq1\" \"${nseq1# }\"" + fi + fi + if [[ ${ent//[0-9]} == _ ]]; then + ble/decode/cmap/.generate-binder-template "${tseq}_$ccode" "$qseq1" "$nseq1" "$((depth+1))" + fi + done +} +function ble/decode/cmap/initialize { + function ble/decode/cmap/initialize { return 0; } + local init=$_ble_base/lib/init-cmap.sh + local dump=$_ble_base_cache/decode.cmap.$_ble_decode_kbd_ver.$TERM.dump + local hash='015701ad744b9fdedb46d589a94ac9af5a8fdb60' + if [[ -s $dump && $dump -nt $init ]]; then + source -- "$dump" + [[ $_ble_decode_cmap_cache_hash == "$hash" ]] && return 0 + fi + source -- "$init" +} +function ble/decode/cmap/decode-chars.hook { + ble/array#push ble_decode_bind_keys "$1" + _ble_decode_key__hook=ble/decode/cmap/decode-chars.hook +} +function ble/decode/cmap/decode-chars { + ble/decode/cmap/initialize + local _ble_decode_csi_mode=0 + local _ble_decode_csi_args= + local _ble_decode_char2_seq= + local _ble_decode_char2_reach_key= + local _ble_decode_char2_reach_seq= + local _ble_decode_char2_modifier= + local _ble_decode_char2_modkcode= + local -a _ble_decode_char2_modseq=() + local _ble_decode_char__hook= + local _ble_debug_keylog_enabled= + local _ble_decode_keylog_keys_enabled= + local _ble_decode_keylog_chars_enabled= + local _ble_decode_show_progress_hook= + local _ble_decode_erase_progress_hook= + local bleopt_decode_error_cseq_abell= + local bleopt_decode_error_cseq_vbell= + local bleopt_decode_error_cseq_discard= + local -a ble_decode_bind_keys=() + local _ble_decode_key__hook=ble/decode/cmap/decode-chars.hook + local ble_decode_char_sync=1 # ユーザ入力があっても中断しない + ble-decode-char "$@" "$_ble_decode_KCODE_IGNORE" + keys=("${ble_decode_bind_keys[@]}") + if [[ $_ble_decode_char2_modkcode ]]; then + ble/array#push keys "$_ble_decode_char2_modkcode" + fi +} +_ble_decode_bind_hook= +_ble_decode_bind__uvwflag= +function ble/decode/readline/adjust-uvw { + [[ $_ble_decode_bind__uvwflag ]] && return 0 + _ble_decode_bind__uvwflag=1 + builtin bind -x $'"\025":_ble_decode_hook 21; builtin eval -- "$_ble_decode_bind_hook"' # ^U + builtin bind -x $'"\026":_ble_decode_hook 22; builtin eval -- "$_ble_decode_bind_hook"' # ^V + builtin bind -x $'"\027":_ble_decode_hook 23; builtin eval -- "$_ble_decode_bind_hook"' # ^W + builtin bind -x $'"\177":_ble_decode_hook 127; builtin eval -- "$_ble_decode_bind_hook"' # ^? + builtin bind -x $'"\010":_ble_decode_hook 8; builtin eval -- "$_ble_decode_bind_hook"' # ^H +} +if ((_ble_bash>=50100)); then + function ble/base/workaround-POSIXLY_CORRECT { + [[ $_ble_decode_bind_state == none ]] && return 0 + builtin bind -x '"\C-i":_ble_decode_hook 9; builtin eval -- "$_ble_decode_bind_hook"' + } +fi +function ble/decode/readline/.generate-source-to-unbind-default { + { + if ((_ble_bash>=40300)); then + ble/util/print '__BINDX__' + builtin bind -X + fi + ble/util/print '__BINDP__' + builtin bind -sp + } | ble/decode/readline/.generate-source-to-unbind-default/.process +} 2>/dev/null +function ble/decode/readline/.generate-source-to-unbind-default/.process { + local q=\' Q="'\''" + LC_ALL=C ble/bin/awk -v q="$q" ' + BEGIN { + IS_XPG4 = AWKTYPE == "xpg4"; + rep_Q = str2rep(q "\\" q q); + rep_bslash = str2rep("\\"); + rep_kseq_1c5c = str2rep("\"\\x1c\\x5c\""); + rep_kseq_1c = str2rep("\"\\x1c\""); + mode = 1; + } + function str2rep(str) { + if (IS_XPG4) sub(/\\/, "\\\\\\\\", str); + return str; + } + function quote(text) { + gsub(q, rep_Q, text); + return q text q; + } + function unescape_control_modifier(str, _, i, esc, chr) { + for (i = 0; i < 32; i++) { + if (i == 0 || i == 31) + esc = sprintf("\\\\C-%c", i + 64); + else if (27 <= i && i <= 30) + esc = sprintf("\\\\C-\\%c", i + 64); + else + esc = sprintf("\\\\C-%c", i + 96); + chr = sprintf("%c", i); + gsub(esc, chr, str); + } + gsub(/\\C-\?/, sprintf("%c", 127), str); + return str; + } + function unescape(str) { + if (str ~ /\\C-/) + str = unescape_control_modifier(str); + gsub(/\\e/, sprintf("%c", 27), str); + gsub(/\\"/, "\"", str); + gsub(/\\\\/, rep_bslash, str); + return str; + } + function output_bindr(line0, _seq) { + if (match(line0, /^"(([^"\\]|\\.)+)"/) > 0) { + _seq = substr(line0, 2, RLENGTH - 2); + gsub(/\\M-/, "\\e", _seq); + print "builtin bind -r " quote(_seq); + } + } + /^__BINDP__$/ { mode = 1; next; } + /^__BINDX__$/ { mode = 2; next; } + mode == 1 && $0 ~ /^"/ { + sub(/^"\\C-\\\\\\"/, rep_kseq_1c5c); + sub(/^"\\C-\\\\?"/, rep_kseq_1c); + output_bindr($0); + print "builtin bind " quote($0) > "/dev/stderr"; + } + mode == 2 && $0 ~ /^"/ { + output_bindr($0); + line = $0; + if (line ~ /(^|[^[:alnum:]])(ble-decode\/.hook|_ble_decode_hook)($|[^[:alnum:]])/) next; + if (match(line, /^("([^"\\]|\\.)*":) "(([^"\\]|\\.)*)"/) > 0) { + rlen = RLENGTH; + match(line, /^"([^"\\]|\\.)*":/); + rlen1 = RLENGTH; + rlen2 = rlen - rlen1 - 3; + sequence = substr(line, 1 , rlen1); + command = substr(line, rlen1 + 3, rlen2); + if (command ~ /\\/) + command = unescape(command); + line = sequence command; + } + print "builtin bind -x " quote(line) > "/dev/stderr"; + } + ' 2>| "$_ble_base_run/$$.bind.save" +} +_ble_decode_bind_state=none +_ble_decode_bind_bindp= +_ble_decode_bind_encoding= +function ble/decode/readline/bind { + _ble_decode_bind_encoding=$bleopt_input_encoding + local file=$_ble_base_cache/decode.bind.$_ble_bash.$_ble_decode_bind_encoding.bind + ble/term/rl-convert-meta/enter + local hash='d2348e25759c982a945fb64c2a8bce9940f78eae' + local _ble_decode_bind_cache_hash= + [[ -s $file && $file -nt $_ble_base/lib/init-bind.sh ]] && source -- "$file" + if [[ $_ble_decode_bind_cache_hash != "$hash" ]]; then + source -- "$_ble_base/lib/init-bind.sh" + source -- "$file" + fi + _ble_decode_bind__uvwflag= + ble/util/assign _ble_decode_bind_bindp 'builtin bind -p' # TERM 変更検出用 +} +function ble/decode/readline/unbind { + ble/function#try ble/encoding:"$bleopt_input_encoding"/clear + source -- "$_ble_base_cache/decode.bind.$_ble_bash.$_ble_decode_bind_encoding.unbind" +} +function ble/decode/readline/rebind { + [[ $_ble_decode_bind_state == none ]] && return 0 + ble/decode/readline/unbind + ble/decode/readline/bind +} +function ble/decode/bind/.initialize-kmap { + [[ $kmap ]] && return 0 + ble-decode/GET_BASEMAP -v kmap + if ! ble/decode/is-keymap "$kmap"; then + ble/util/print "ble-bind: the default keymap '$kmap' is unknown." >&2 + flags=R$flags + return 1 + fi + return 0 +} +function ble/decode/bind/option:help { + ble/util/cat <=1)) || return 0 + if [[ $3 ]]; then + ((req--)) + ble/array#push optarg "${4-$3}" + fi + ((req>=1)) || return 0 + if ((${#args[@]}-iarg&2 + else + ble/util/print "ble-bind: the option \`$label' requires $req arguments." >&2 + fi + return 2 + fi + ble/array#push optarg "${args[@]:iarg:req}" + ((iarg+=req)) + return 0 +} +function ble/decode/bind/option:csi { + local ret key= + if [[ $2 ]]; then + ble-decode-kbd "$2" + ble/string#split-words key "$ret" + if ((${#key[@]}!=1)); then + ble/util/print "ble-bind --csi: the second argument is not a single key!" >&2 + return 1 + elif ((key&~_ble_decode_MaskChar)); then + ble/util/print "ble-bind --csi: the second argument should not have modifiers!" >&2 + return 1 + fi + fi + local rex + if rex='^([1-9][0-9]*)~$' && [[ $1 =~ $rex ]]; then + _ble_decode_csimap_tilde[BASH_REMATCH[1]]=$key + if [[ ! ${_ble_decode_csimap_dict[key]} ]]; then + _ble_decode_csimap_dict[key]=tilde:${BASH_REMATCH[1]} + fi + local -a cseq + cseq=(27 91) + local ret i iN num="${BASH_REMATCH[1]}\$" + for ((i=0,iN=${#num};i&2 + return 1 + fi +} +function ble/decode/bind/option:list-widgets { + declare -f | ble/bin/sed -n 's/^ble\/widget\/\([a-zA-Z][^.[:blank:]();&|]\{1,\}\)[[:blank:]]*()[[:blank:]]*$/\1/p' +} +function ble/decode/bind/option:dump { + if (($#)); then + local keymap + for keymap; do + ble/decode/keymap#dump "$keymap" + done + else + ble/util/declare-print-definitions "${!_ble_decode_kbd__@}" "${!_ble_decode_KCODE_@}" "${!_ble_decode_cmap_@}" "${!_ble_decode_csimap_@}" + ble/decode/keymap#dump + fi +} +function ble/decode/bind/option:print { + local ble_bind_print=1 + local quote_word_opts= sgr0= sgrf= sgrq= sgrc= sgro= + if [[ $flags == *c* || $flags != *n* && -t 1 ]]; then + local ret + ble/color/face2sgr command_function; sgrf=$ret + ble/color/face2sgr syntax_quoted; sgrq=$ret + ble/color/face2sgr syntax_escape; local sgre=$ret + ble/color/face2sgr syntax_comment; sgrc=$ret + ble/color/face2sgr argument_option; sgro=$ret + sgr0=$_ble_term_sgr0 + quote_word_opts=quote-empty:sgrq=$sgrq:sgre=$sgre:sgr0=$sgr0 + fi + local keymap + ble-decode/INITIALIZE_DEFMAP -v keymap # 初期化を強制する + if (($#)); then + for keymap; do + ble/decode/keymap#load "$keymap" + ble/decode/keymap#print "$keymap" + done + else + ble/decode/csi/print + ble-decode-char/print + ble/decode/keymap#print + fi +} +function ble-bind { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/decode/bind "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function ble/decode/bind { + local set shopt + [[ $_ble_bash_options_adjusted ]] || ble/base/.adjust-bash-options set shopt + local IFS=$_ble_term_IFS q=\' Q="''\'" + local flags= kmap=${ble_bind_keymap-} ret + local -a keymaps; keymaps=() + ble/decode/initialize + local -a args + args=("$@") + local iarg=0 arg c optarg + while ((iarg<$#)); do + local arg=${args[iarg++]} + if [[ $arg == --?* ]]; then + local name=${arg:2} has_optarg= optarg= + if [[ $name == *=* ]]; then + has_optarg=set + optarg=${name#*=} + name=${name%%=*} + fi + case $name in + (color) + if [[ ! $has_optarg || $optarg == always ]]; then + flags=c${flags//[cn]} + elif [[ $optarg == never ]]; then + flags=n${flags//[cn]} + elif [[ $optarg == auto ]]; then + flags=${flags//[cn]} + else + flags=E$flags + ble/util/print "ble-bind: unrecognized color '--color=$optarg'." >&2 + fi ;; + (help) + ble/decode/bind/option:help + flags=D$flags ;; + (csi) + flags=D$flags + ble/decode/bind/get-optarg --csi 2 "$has_optarg" "$optarg" || break + ble/decode/bind/option:csi "${optarg[0]}" "${optarg[1]}" ;; + (cursor) + flags=D$flags + ble/decode/bind/get-optarg --cursor 1 "$has_optarg" "$optarg" || break + ble/decode/bind/.initialize-kmap && + ble/decode/keymap#set-cursor "$kmap" "${optarg[0]}" ;; + (list-widgets|list-functions) + flags=D$flags + ble/decode/bind/option:list-widgets ;; + (dump) + flags=D$flags + ble/decode/bind/option:dump "${keymaps[@]}" ;; + (print) + flags=D$flags + ble/decode/bind/option:print "${keymaps[@]}" ;; + (*) + flags=E$flags + ble/util/print "ble-bind: unrecognized long option $arg" >&2 ;; + esac + elif [[ $arg == -?* ]]; then + arg=${arg:1} + while ((${#arg})); do + c=${arg::1} arg=${arg:1} + case $c in + (k) + flags=D$flags + ble/decode/bind/get-optarg -k 2 "$arg" || break 2 + arg= + ble-decode-kbd "${optarg[0]}"; local cseq=$ret + if [[ ${optarg[1]} && ${optarg[1]} != - ]]; then + ble-decode-kbd "${optarg[1]}"; local kc=$ret + if [[ $kc == *' '* ]]; then + ble/util/print "ble-bind: -k: the target key (${optarg[1]}) cannot contain multiple keys." >&2 + flags=E$flags + continue + fi + ble-decode-char/bind "$cseq" "$kc" + else + ble-decode-char/unbind "$cseq" + fi ;; + (m) + ble/decode/bind/get-optarg -m 1 "$arg" || break 2 + arg= + if ! ble/decode/is-keymap "$optarg"; then + ble/util/print "ble-bind: the keymap '$optarg' is unknown." >&2 + flags=E$flags + continue + fi + kmap=$optarg + ble/array#push keymaps "$optarg" ;; + (D) + flags=D$flags + ble/decode/bind/option:dump "${keymaps[@]}" ;; + ([Pd]) + flags=D$flags + ble/decode/bind/option:print "${keymaps[@]}" ;; + (['fxc@s']) + flags=D$flags + [[ $c != f && $arg == f* ]] && arg=${arg:1} + ble/decode/bind/get-optarg "-$c" 2 "$arg" || break 2 + arg= + ble-decode-kbd "${optarg[0]}"; local kbd=$ret + if [[ ${optarg[1]} && ${optarg[1]} != - ]]; then + local command=${optarg[1]} + case $c in + (f) command=ble/widget/$command ;; # ble/widget/ 関数 + (x) command="ble/widget/.EDIT_COMMAND '${command//$q/$Q}'" ;; # 編集用の関数 + (c) command="ble/widget/.SHELL_COMMAND '${command//$q/$Q}'" ;; # コマンド実行 + (s) local ret; ble/util/keyseq2chars "$command"; command="ble/widget/.MACRO ${ret[*]}" ;; + ('@') ;; # 直接実行 + (*) + ble/util/print "error: unsupported binding type \`-$c'." >&2 + continue ;; + esac + ble/decode/bind/.initialize-kmap && + ble-decode-key/bind "$kmap" "$kbd" "$command" + else + ble/decode/bind/.initialize-kmap && + ble-decode-key/unbind "$kmap" "$kbd" + fi ;; + (T) + flags=D$flags + ble/decode/bind/get-optarg -T 2 "$arg" || break 2 + arg= + ble-decode-kbd "${optarg[0]}"; local kbd=$ret + ble/decode/bind/.initialize-kmap && + ble-decode-key/set-timeout "$kmap" "$kbd" "${optarg[1]}" ;; + (L) + flags=D$flags + ble/decode/bind/option:list-widgets ;; + (*) + ble/util/print "ble-bind: unrecognized short option \`-$c'." >&2 + flags=E$flags ;; + esac + done + else + ble/util/print "ble-bind: unrecognized argument \`$arg'." >&2 + flags=E$flags + fi + done + local ext=0 + case $flags in + (*E*) ext=2 ;; + (*R*) ext=1 ;; + (*D*) ;; + (*) ble/decode/bind/option:print "${keymaps[@]}" ;; + esac + [[ $_ble_bash_options_adjusted ]] || ble/base/.restore-bash-options set shopt + return "$ext" +} +function ble/decode/read-inputrc/test { + local text=$1 + if [[ ! $text ]]; then + ble/builtin/bind/.print-error "\$if: test condition is not supplied." + return 1 + elif local rex=$'[ \t]*([<>]=?|[=!]?=)[ \t]*(.*)$'; [[ $text =~ $rex ]]; then + local op=${BASH_REMATCH[1]} + local rhs=${BASH_REMATCH[2]} + local lhs=${text::${#text}-${#BASH_REMATCH}} + else + local lhs=application + local rhs=$text + fi + case $lhs in + (application) + local ret; ble/string#tolower "$rhs" + [[ $ret == bash || $ret == blesh ]] + return "$?" ;; + (mode) + if [[ -o emacs ]]; then + builtin test emacs "$op" "$rhs" + elif [[ -o vi ]]; then + builtin test vi "$op" "$rhs" + else + builtin false + fi + return "$?" ;; + (term) + if [[ $op == '!=' ]]; then + builtin test "$TERM" "$op" "$rhs" && builtin test "${TERM%%-*}" "$op" "$rhs" + else + builtin test "$TERM" "$op" "$rhs" || builtin test "${TERM%%-*}" "$op" "$rhs" + fi + return "$?" ;; + (version) + local lhs_major lhs_minor + if ((_ble_bash<40400)); then + ((lhs_major=2+_ble_bash/10000, + lhs_minor=_ble_bash/100%100)) + elif ((_ble_bash<50000)); then + ((lhs_major=7,lhs_minor=0)) + else + ((lhs_major=3+_ble_bash/10000, + lhs_minor=_ble_bash/100%100)) + fi + local rhs_major rhs_minor + if [[ $rhs == *.* ]]; then + local version + ble/string#split version . "$rhs" + rhs_major=${version[0]} + rhs_minor=${version[1]} + else + ((rhs_major=rhs,rhs_minor=0)) + fi + local lhs_ver=$((lhs_major*10000+lhs_minor)) + local rhs_ver=$((rhs_major*10000+rhs_minor)) + [[ $op == '=' ]] && op='==' + let "$lhs_ver$op$rhs_ver" + return "$?" ;; + (*) + if local ret; ble/util/rlvar#read "$lhs"; then + builtin test "$ret" "$op" "$rhs" + return "$?" + else + ble/builtin/bind/.print-error "\$if: unknown readline variable '${lhs//$q/$Q}'." + return 1 + fi ;; + esac +} +function ble/decode/read-inputrc { + local file=$1 ref=$2 q=\' Q="''\'" + if [[ -f $ref && $ref == */* && $file != /* ]]; then + local relative_file=${ref%/*}/$file + [[ -f $relative_file ]] && file=$relative_file + fi + local inputrc_file=$file inputrc_iline=0 + if [[ ! -f $inputrc_file ]]; then + ble/builtin/bind/.print-error "\$include: the file '${1//$q/$Q}' not found." + return 1 + fi + local -a script=() + local ret line= inputrc_iline=0 + while ble/bash/read line || [[ $line ]]; do + ((++inputrc_iline)) + ble/string#trim "$line"; line=$ret + [[ ! $line || $line == '#'* ]] && continue + if [[ $line == '$'* ]]; then + local directive=${line%%[$IFS]*} + case $directive in + ('$if') + local args=${line#'$if'} + ble/string#trim "$args"; args=$ret + ble/array#push script "inputrc_iline=$inputrc_iline" + ble/array#push script "if ble/decode/read-inputrc/test '${args//$q/$Q}'; then :" ;; + ('$else') ble/array#push script 'else :' ;; + ('$endif') ble/array#push script 'fi' ;; + ('$include') + local args=${line#'$include'} + ble/string#trim "$args"; args=$ret + ble/array#push script "inputrc_iline=$inputrc_iline" + ble/array#push script "ble/decode/read-inputrc '${args//$q/$Q}' '${inputrc_file//$q/$Q}'" ;; + (*) + ble/builtin/bind/.print-error "unrecognized directive '$directive'." ;; + esac + else + ble/array#push script "inputrc_iline=$inputrc_iline" + ble/array#push script "ble/builtin/bind/.process -- '${line//$q/$Q}'" + fi + done < "$inputrc_file" + IFS=$'\n' builtin eval 'script="${script[*]}"' + builtin eval -- "$script" +} +_ble_builtin_bind_keymap= +function ble/builtin/bind/set-keymap { + local opt_keymap= flags= + ble/builtin/bind/option:m "$1" && + _ble_builtin_bind_keymap=$opt_keymap + return 0 +} +function ble/builtin/bind/.print-error.find-caller { + for ((;level<${#FUNCNAME[@]}+1;level++)); do + f=${FUNCNAME[1+level]-} + case $f in + (ble/builtin/bind|ble/builtin/bind/*|bind|ble/decode/read-inputrc/test) ;; + (*) return 0 ;; + esac + done + f= +} +function ble/builtin/bind/.print-error { + local title='bind (ble.sh)' + local level=1 f + ble/builtin/bind/.print-error.find-caller + if [[ $f == ble/decode/read-inputrc ]]; then + if ((inputrc_iline)); then + title="$inputrc_file:$inputrc_iline: bind (ble.sh)" + f= + else + ((++level)) + ble/builtin/bind/.print-error.find-caller + fi + fi + if [[ $f && ${BASH_SOURCE[level]} ]]; then + title="${BASH_SOURCE[level]}:${BASH_LINENO[level-1]}: bind (ble.sh)" + fi + ble/util/print "$title: $1" >&2 +} +function ble/builtin/bind/option:m { + local name=$1 + local ret; ble/string#tolower "$name"; local keymap=$ret + case $keymap in + (emacs|emacs-standard|emacs-meta|emacs-ctlx) ;; + (vi|vi-command|vi-move|vi-insert) ;; + (*) keymap= ;; + esac + if [[ ! $keymap ]]; then + ble/builtin/bind/.print-error "unrecognized keymap name '$name'" + flags=e$flags + return 1 + else + opt_keymap=$keymap + return 0 + fi +} +function ble/builtin/bind/.unquote-macro-string { + local value=$1 q=\' Q="'\''" + local delim=${1::1} + if [[ $delim != [\"\'] ]]; then + ret=$value + fi + local rex='^'$delim'(([^\'$delim']|\\.)*)'$delim'['$_ble_term_IFS']*' + if ! [[ $value =~ $rex ]]; then + ble/builtin/bind/.print-error "no closing '${delim//$q/$Q}' in spec: '${spec//$q/$Q}'" + return 1 + elif ((${#BASH_REMATCH}<${#value})); then + local fragment=${value:${#BASH_REMATCH}} + ble/builtin/bind/.print-error "warning: unprocessed fragments '${fragment//$q/$Q}' in spec: '${spec//$q/$Q}'" + fi + ret=${BASH_REMATCH[1]} +} +function ble/builtin/bind/.decompose-pair.impl { + local LC_ALL= LC_CTYPE=C + local ret; ble/string#ltrim "$1" + local spec=$ret ifs=$_ble_term_IFS q=\' Q="'\''" + keyseq= value= + [[ ! $spec || $spec == 'set'["$ifs"]* ]] && return 3 + local rex_keyseq='^(("([^\"]|\\.)*"|[^":'$ifs'])*("([^\"]|\\.)*)?)' + if [[ :$2: == *:user-command:* ]]; then + if ! ble/string#match "$spec" "$rex_keyseq[$ifs]*[:$ifs]"; then + ble/builtin/bind/.print-error "no colon or space after keyseq: '${spec//$q/$Q}'" 2>&3 + return 1 + fi + local rematch=$BASH_REMATCH + keyseq=${BASH_REMATCH[1]} + ble/string#ltrim "${spec:${#BASH_REMATCH}}" + if [[ $rematch == *: ]]; then + if [[ $ret == [\"\']* ]]; then + ble/builtin/bind/.unquote-macro-string "$ret" 2>&3 || return 1 + fi + else + if [[ $ret == \"* ]]; then + ble/builtin/bind/.unquote-macro-string "$ret" 2>&3 || return 1 + ble/util/keyseq2chars "$ret" + ble/util/chars2s "${ret[@]}" + else + ble/builtin/bind/.print-error "the user command needs to be surrounded by \"..\": '${spec//$q/$Q}'" 2>&3 + return 1 + fi + fi + value=command:$ret + else + ble/string#match "$spec" "$rex_keyseq[$ifs]*(:[$ifs]*)?" + keyseq=${BASH_REMATCH[1]} + ble/string#trim "${spec:${#BASH_REMATCH}}" + if [[ $ret == [\"\']* ]]; then + ble/builtin/bind/.unquote-macro-string "$ret" 2>&3 || return 1 + value=macro:$ret + else + value=rlfunc:$ret + fi + fi + if [[ $keyseq == '$'* ]]; then + return 3 + elif [[ ! $keyseq ]]; then + ble/builtin/bind/.print-error "empty keyseq in spec: '${spec//$q/$Q}'" 2>&3 + return 1 + elif ble/string#match "$keyseq" '^"([^\"]|\\.)*$'; then + ble/builtin/bind/.print-error "no closing '\"' in keyseq: '${keyseq//$q/$Q}'" 2>&3 + return 1 + elif ble/string#match "$keyseq" '^"([^\"]|\\.)*"'; then + local rematch=${BASH_REMATCH[0]} + if ((${#rematch}<${#keyseq})); then + local fragment=${keyseq:${#rematch}} + ble/builtin/bind/.print-error "warning: unprocessed fragments in keyseq '${fragment//$q/$Q}'" 2>&3 + fi + keyseq=$rematch + return 0 + else + return 0 + fi +} +function ble/builtin/bind/.decompose-pair { + ble/builtin/bind/.decompose-pair.impl "$@" 3>&2 2>/dev/null # suppress locale error #D1440 +} +function ble/builtin/bind/.parse-keyname { + local ret mflags= + ble/string#tolower "$1"; local lower=$ret + if [[ $1 == *-* ]]; then + ble/string#split ret - "$lower" + local mod + for mod in "${ret[@]::${#ret[@]}-1}"; do + case $mod in + (*m|*meta) mflags=m$mflags ;; + (*c|*ctrl|*control) mflags=c$mflags ;; + esac + done + fi + local name=${lower##*-} ch= + case $name in + (rubout|del) ch=$'\177' ;; + (escape|esc) ch=$'\033' ;; + (newline|lfd) ch=$'\n' ;; + (return|ret) ch=$'\r' ;; + (space|spc) ch=' ' ;; + (tab) ch=$'\t' ;; + (*) ble/util/substr "${1##*-}" 0 1; ch=$ret ;; + esac + ble/util/s2c "$ch"; local key=$ret + [[ $mflags == *c* ]] && ((key&=0x1F)) + [[ $mflags == *m* ]] && ((key|=0x80)) + chars=("$key") +} +function ble/builtin/bind/.initialize-kmap { + local keymap=$1 + kmap= + case $keymap in + (emacs|emacs-standard) kmap=emacs ;; + (emacs-ctlx) kmap=emacs; keys=(24 "${keys[@]}") ;; + (emacs-meta) kmap=emacs; keys=(27 "${keys[@]}") ;; + (vi-insert) kmap=vi_imap ;; + (vi|vi-command|vi-move) kmap=vi_nmap ;; + (*) ble-decode/GET_BASEMAP -v kmap ;; + esac + if ! ble/decode/is-keymap "$kmap"; then + ble/util/print "ble/builtin/bind: the keymap '$kmap' is unknown." >&2 + return 1 + fi + return 0 +} +function ble/builtin/bind/.initialize-keys-and-value { + local spec=$1 opts=$2 + keys= value= + local keyseq + ble/builtin/bind/.decompose-pair "$spec" "$opts" || return "$?" + local chars + if [[ $keyseq == \"*\" ]]; then + local ret; ble/util/keyseq2chars "${keyseq:1:${#keyseq}-2}" + chars=("${ret[@]}") + ((${#chars[@]})) || ble/builtin/bind/.print-error "warning: empty keyseq: $keyseq" + ((_ble_bash<40300)) && + [[ :$opts: == *:check-bindx-bash42bug:* ]] && + ((${#chars[@]}>2)) && + bindx_bash42bug=1 + else + [[ :$opts: == *:nokeyname:* ]] && + ble/builtin/bind/.print-error "warning: readline \"bind -x\" does not support \"keyname\" spec" + ble/builtin/bind/.parse-keyname "$keyseq" + fi + ble/decode/cmap/decode-chars "${chars[@]}" +} +function ble/builtin/bind/option:x { + local q=\' Q="''\'" + local keys value kmap + if ! ble/builtin/bind/.initialize-keys-and-value "$1" nokeyname:user-command:check-bindx-bash42bug; then + ble/builtin/bind/.print-error "unrecognized user-command spec '${1//$q/$Q}'." + flags=e$flags + return 1 + elif ! ble/builtin/bind/.initialize-kmap "$opt_keymap"; then + ble/builtin/bind/.print-error "sorry, failed to initialize keymap:'$opt_keymap'." + flags=e$flags + return 1 + fi + value=${value#command:} + local command="ble/widget/.EDIT_COMMAND '${value//$q/$Q}'" + ble-decode-key/bind "$kmap" "${keys[*]}" "$command" +} +function ble/builtin/bind/option:r { + local keyseq=$1 + local ret chars keys + ble/util/keyseq2chars "$keyseq"; chars=("${ret[@]}") + ble/decode/cmap/decode-chars "${chars[@]}" + local kmap + ble/builtin/bind/.initialize-kmap "$opt_keymap" || return 1 + ble-decode-key/unbind "$kmap" "${keys[*]}" +} +_ble_decode_rlfunc2widget_emacs=() +_ble_decode_rlfunc2widget_vi_imap=() +_ble_decode_rlfunc2widget_vi_nmap=() +function ble/builtin/bind/rlfunc2widget/load-dict { + local kmap=${1-} + ble/decode/bind/.initialize-kmap + local rlfunc_file= rlfunc_dict= + case $kmap in + (emacs) rlfunc_file=$_ble_base/lib/core-decode.emacs-rlfunc.txt + rlfunc_dict=_ble_decode_rlfunc2widget_emacs ;; + (vi_imap) rlfunc_file=$_ble_base/lib/core-decode.vi_imap-rlfunc.txt + rlfunc_dict=_ble_decode_rlfunc2widget_vi_imap ;; + (vi_nmap) rlfunc_file=$_ble_base/lib/core-decode.vi_nmap-rlfunc.txt + rlfunc_dict=_ble_decode_rlfunc2widget_vi_nmap ;; + esac + [[ $rlfunc_file ]] || return 1 + local script=' + if ((!${#NAME[@]})); then + ble/util/mapfile NAME < "$rlfunc_file" + [[ $OSTYPE == msys* ]] && NAME=("${NAME[@]%$_ble_term_nl}") # disable=#D2352 + fi + dict=("${NAME[@]}") + '; builtin eval -- "${script//NAME/$rlfunc_dict}" +} +function ble/builtin/bind/rlfunc2widget { + local kmap=$1 rlfunc=$2 + local IFS=$_ble_term_IFS + if ble/builtin/bind/rlfunc2widget/load-dict "$kmap"; then + local line + for line in "${dict[@]}"; do + [[ $line == "$rlfunc "* ]] || continue + local rl widget; ble/bash/read rl widget <<< "$line" + if [[ $widget == - ]]; then + ble/builtin/bind/.print-error "unsupported readline function '${rlfunc//$q/$Q}' for keymap '$kmap'." + return 1 + elif [[ $widget == '' ]]; then + return 2 + fi + ret=ble/widget/$widget + return 0 + done + fi + if ble/is-function ble/widget/"${rlfunc%%[$IFS]*}"; then + ret=ble/widget/$rlfunc + return 0 + fi + ble/builtin/bind/.print-error "unsupported readline function '${rlfunc//$q/$Q}'." + return 1 +} +function ble/builtin/bind/rlfunc2widget/type { + local rlfunc=$1 dict + if ble/builtin/bind/rlfunc2widget/load-dict "$2"; then + local line + for line in "${dict[@]}"; do + if [[ $line == "$rlfunc "* ]]; then + ret=rlfunc + return 0 + fi + done + fi + if ble/is-function ble/widget/"$rlfunc"; then + ret=widget + return 0 + fi + ret=unknown + return 1 +} +function ble/builtin/bind/option:u { + local rlfunc=$1 + local kmap + if ! ble/builtin/bind/.initialize-kmap "$opt_keymap" || ! ble/decode/keymap#load "$kmap"; then + ble/builtin/bind/.print-error "sorry, failed to initialize keymap:'$opt_keymap'." + flags=e$flags + return 1 + fi + local ret + ble/builtin/bind/rlfunc2widget "$kmap" "$rlfunc" || return 0 + local command=$ret + local -a unbind_keys_list=() + ble/builtin/bind/option:u/search-recursive "$kmap" + local keys + for keys in "${unbind_keys_list[@]}"; do + ble-decode-key/unbind "$kmap" "$keys" + done +} +function ble/builtin/bind/option:u/search-recursive { + local kmap=$1 tseq=$2 + local dicthead=_ble_decode_${kmap}_kmap_ + local key keys + builtin eval "keys=(\${!$dicthead$tseq[@]})" + for key in "${keys[@]}"; do + builtin eval "local ent=\${$dicthead$tseq[key]}" + if [[ ${ent:2} == "$command" ]]; then + ble/array#push unbind_keys_list "${tseq//_/ } $key" + fi + if [[ ${ent::1} == _ ]]; then + ble/builtin/bind/option:u/search-recursive "$kmap" "${tseq}_$key" + fi + done +} +function ble/builtin/bind/option:- { + local ret; ble/string#trim "$1"; local arg=$ret + [[ ! $arg || $arg == '#'* ]] && return 0 + local ifs=$_ble_term_IFS + if [[ $arg == 'set'["$ifs"]* ]]; then + if [[ $_ble_decode_bind_state != none ]]; then + local variable= value= rex=$'^set[ \t]+([^ \t]+)[ \t]+([^ \t].*)$' + [[ $arg =~ $rex ]] && variable=${BASH_REMATCH[1]} value=${BASH_REMATCH[2]} + case $variable in + (keymap) + ble/builtin/bind/set-keymap "$value" + return 0 ;; + (editing-mode) + _ble_builtin_bind_keymap= ;; + esac + ble/function#try ble/builtin/bind/set:"$variable" "$value" && return 0 + builtin bind "$arg" + fi + return 0 + fi + local keys value kmap + if ! ble/builtin/bind/.initialize-keys-and-value "$arg"; then + local q=\' Q="''\'" + ble/builtin/bind/.print-error "unrecognized readline command '${arg//$q/$Q}'." + flags=e$flags + return 1 + elif ! ble/builtin/bind/.initialize-kmap "$opt_keymap"; then + ble/builtin/bind/.print-error "sorry, failed to initialize keymap:'$opt_keymap'." + flags=e$flags + return 1 + fi + if [[ $value == macro:* ]]; then + value=${value#macro:} + local bind_keys="${keys[*]}" + local ret chars; ble/util/keyseq2chars "$value"; chars=("${ret[@]}") + local command="ble/widget/.MACRO ${chars[*]}" + ble/decode/cmap/decode-chars "${chars[@]}" + [[ ${keys[*]} != "$bind_keys" ]] && + ble-decode-key/bind "$kmap" "$bind_keys" "$command" + elif [[ $value == rlfunc:?* ]]; then + value=${value#rlfunc:} + local ret; ble/builtin/bind/rlfunc2widget "$kmap" "$value"; local ext=$? + if ((ext==0)); then + local command=$ret + ble-decode-key/bind "$kmap" "${keys[*]}" "$command" + return 0 + elif ((ext==2)); then + return 0 + else + flags=e$flags + return 1 + fi + else + ble/builtin/bind/.print-error "readline function name is not specified ($arg)." + return 1 + fi +} +function ble/builtin/bind/.process { + flags= + local IFS=$_ble_term_IFS + local opt_literal= opt_keymap=$_ble_builtin_bind_keymap opt_print= + local -a opt_queries=() + while (($#)); do + local arg=$1; shift + if [[ ! $opt_literal ]]; then + case $arg in + (--) opt_literal=1 + continue ;; + (--help) + if ((_ble_bash<40400)); then + ble/builtin/bind/.print-error "unrecognized option $arg" + flags=e$flags + else + [[ $_ble_decode_bind_state != none ]] && + (builtin bind --help) + flags=h$flags + fi + continue ;; + (--*) + ble/builtin/bind/.print-error "unrecognized option $arg" + flags=e$flags + continue ;; + (-*) + arg=${arg:1} + while [[ $arg ]]; do + local c=${arg::1} + arg=${arg:1} + case $c in + ([lpPsSvVX]) + opt_print=$opt_print$c ;; + ([mqurfx]) + local optarg=$arg + arg= + if [[ ! $optarg ]]; then + if (($#==0)); then + ble/builtin/bind/.print-error "missing option argument for -$c" + flags=e$flags + break + fi + optarg=$1; shift + fi + case $c in + (m) ble/builtin/bind/option:m "$optarg" ;; + (x) ble/builtin/bind/option:x "$optarg" ;; + (r) ble/builtin/bind/option:r "$optarg" ;; + (u) ble/builtin/bind/option:u "$optarg" ;; + (q) ble/array#push opt_queries "$optarg" ;; + (f) ble/decode/read-inputrc "$optarg" ;; + (*) + ble/builtin/bind/.print-error "unsupported option -$c $optarg" + flags=e$flags ;; + esac ;; + (*) + ble/builtin/bind/.print-error "unrecognized option -$c" + flags=e$flags ;; + esac + done + continue ;; + esac + fi + ble/builtin/bind/option:- "$arg" + opt_literal=1 + done + if [[ $_ble_decode_bind_state != none ]]; then + if [[ $opt_print == *[pPsSX]* ]] || ((${#opt_queries[@]})); then + ( ble/decode/readline/unbind + [[ -s "$_ble_base_run/$$.bind.save" ]] && + source -- "$_ble_base_run/$$.bind.save" + [[ $opt_print ]] && + builtin bind ${opt_keymap:+-m "$opt_keymap"} -"$opt_print" + declare rlfunc + for rlfunc in "${opt_queries[@]}"; do + builtin bind ${opt_keymap:+-m "$opt_keymap"} -q "$rlfunc" + done ) + elif [[ $opt_print ]]; then + builtin bind ${opt_keymap:+-m "$opt_keymap"} -"$opt_print" + fi + fi + return 0 +} +_ble_builtin_bind_inputrc_done= +function ble/builtin/bind/initialize-inputrc { + [[ $_ble_builtin_bind_inputrc_done ]] && return 0 + _ble_builtin_bind_inputrc_done=1 + if [[ $1 == all ]]; then + local sys_inputrc=/etc/inputrc + [[ -e $sys_inputrc ]] && ble/decode/read-inputrc "$sys_inputrc" + fi + local inputrc=${INPUTRC:-$HOME/.inputrc} + [[ -e $inputrc ]] && ble/decode/read-inputrc "$inputrc" +} +_ble_builtin_bind_user_settings_loaded= +function ble/builtin/bind/read-user-settings/.collect { + local map + for map in vi-insert vi-command emacs; do + local cache=$_ble_base_cache/decode.readline.$_ble_bash.$map.txt + if ! [[ -s $cache && $cache -nt $_ble_base/ble.sh ]]; then + INPUTRC=/dev/null "$BASH" --noprofile --norc -i -c "builtin bind -m $map -p" 2>/dev/null | + LC_ALL= LC_CTYPE=C ble/bin/sed '/^#/d;s/"\\M-/"\\e/' >| "$cache.part" && + ble/bin/mv "$cache.part" "$cache" || continue + fi + local cache_content + ble/util/readfile cache_content "$cache" + ble/util/print __CLEAR__ + ble/util/print KEYMAP="$map" + ble/util/print __BIND0__ + ble/util/print "${cache_content%$_ble_term_nl}" + if ((_ble_bash>=40300)); then + ble/util/print __BINDX__ + builtin bind -m "$map" -X 2>/dev/null + fi + ble/util/print __BINDS__ + builtin bind -m "$map" -s 2>/dev/null + ble/util/print __BINDP__ + builtin bind -m "$map" -p 2>/dev/null + ble/util/print __PRINT__ + done +} +function ble/builtin/bind/read-user-settings/.reconstruct { + local collect q=\' + ble/util/assign collect ble/builtin/bind/read-user-settings/.collect + <<< "$collect" LC_ALL= LC_CTYPE=C ble/bin/awk -v q="$q" -v _ble_bash="$_ble_bash" ' + function keymap_register(key, val, type) { + if (!haskey[key]) { + keys[nkey++] = key; + haskey[key] = 1; + } + keymap[key] = val; + keymap_type[key] = type; + } + function keymap_clear(_, i, key) { + for(i = 0; i < nkey; i++) { + key = keys[i]; + delete keymap[key]; + delete keymap_type[key]; + delete keymap0[key]; + haskey[key] = 0; + } + nkey = 0; + } + function keymap_print(_, i, key, type, value, text, line) { + for (i = 0; i < nkey; i++) { + key = keys[i]; + type = keymap_type[key]; + value = keymap[key]; + if (type == "" && value == keymap0[key]) continue; + text = key ": " value; + gsub(/'$q'/, q "\\" q q, text); + line = "bind"; + if (KEYMAP != "") line = line " -m " KEYMAP; + if (type == "x") line = line " -x"; + line = line " " q text q; + print line; + } + } + /^__BIND0__$/ { mode = 0; next; } + /^__BINDX__$/ { mode = 1; next; } + /^__BINDS__$/ { mode = 2; next; } + /^__BINDP__$/ { mode = 3; next; } + /^__CLEAR__$/ { keymap_clear(); next; } + /^__PRINT__$/ { keymap_print(); next; } + sub(/^KEYMAP=/, "") { KEYMAP = $0; } + /(ble-decode\/.hook|_ble_decode_hook) / { next; } + function workaround_bashbug(keyseq, _, rex, out, unit) { + out = ""; + while (keyseq != "") { + if (mode == 0 || mode == 3) { + match(keyseq, /^\\C-\\(\\"$)?|^\\M-|^\\.|^./); + } else { + match(keyseq, /^\\[CM]-|^\\.|^./); + } + unit = substr(keyseq, 1, RLENGTH); + keyseq = substr(keyseq, 1 + RLENGTH); + if (unit == "\\C-\\") { + unit = unit "\\"; + } else if (unit == "\\M-") { + unit = "\\e"; + } + out = out unit; + } + return out; + } + function process_line(line, _, key, val) { + if (match(line, /^"(\\.|[^"])+": /)) { + key = substr(line, 1, RLENGTH - 2); + val = substr(line, 1 + RLENGTH); + } else if (mode == 1 && _ble_bash >= 50300 && match(line, /^"(\\.|[^"])+" /)) { + key = substr(line, 1, RLENGTH - 1); + val = substr(line, 1 + RLENGTH); + } else { + return 0; + } + if (_ble_bash < 50100) + key = workaround_bashbug(key); + if (mode) { + type = mode == 1 ? "x" : mode == 2 ? "s" : ""; + keymap_register(key, val, type); + } else { + keymap0[key] = val; + } + } + { process_line($0); } + ' 2>/dev/null # suppress LC_ALL error messages +} +function ble/builtin/bind/read-user-settings/.cache-enabled { + local keymap use_cache=1 + for keymap in emacs vi_imap vi_nmap; do + ble/decode/keymap#registered "$keymap" && return 1 + [[ -s $delay_prefix.$keymap ]] && return 1 + done + return 0 +} +function ble/builtin/bind/read-user-settings/.cache-alive { + [[ -e $cache_prefix.settings ]] || return 1 + [[ $cache_prefix.settings -nt $_ble_base/lib/init-cmap.sh ]] || return 1 + local keymap + for keymap in emacs vi_imap vi_nmap; do + [[ $cache_prefix.settings -nt $_ble_base/core-decode.$cache-rlfunc.txt ]] || return 1 + [[ -e $cache_prefix.$keymap ]] || return 1 + done + local content + ble/util/readfile content "$cache_prefix.settings" + [[ ${content%$'\n'} == "$settings" ]] +} +function ble/builtin/bind/read-user-settings/.cache-save { + local keymap content fail= + for keymap in emacs vi_imap vi_nmap; do + if [[ -s $delay_prefix.$keymap ]]; then + ble/util/copyfile "$delay_prefix.$keymap" "$cache_prefix.$keymap" + else + >| "$cache_prefix.$keymap" + fi || fail=1 + done + [[ $fail ]] && return 1 + ble/util/print "$settings" >| "$cache_prefix.settings" +} +function ble/builtin/bind/read-user-settings/.cache-load { + local keymap + for keymap in emacs vi_imap vi_nmap; do + ble/util/copyfile "$cache_prefix.$keymap" "$delay_prefix.$keymap" + done +} +function ble/builtin/bind/read-user-settings { + if [[ $_ble_decode_bind_state == none ]]; then + [[ $_ble_builtin_bind_user_settings_loaded ]] && return 0 + _ble_builtin_bind_user_settings_loaded=1 + builtin bind 2>/dev/null + local settings + ble/util/assign settings ble/builtin/bind/read-user-settings/.reconstruct + [[ $settings ]] || return 0 + local cache_prefix=$_ble_base_cache/decode.inputrc.$_ble_decode_kbd_ver.$TERM + local delay_prefix=$_ble_base_run/$$.bind.delay + if ble/builtin/bind/read-user-settings/.cache-enabled; then + if ble/builtin/bind/read-user-settings/.cache-alive; then + ble/builtin/bind/read-user-settings/.cache-load + else + builtin eval -- "$settings" 2>/dev/null # suppress "line editing not enabled" + ble/builtin/bind/read-user-settings/.cache-save + fi + else + builtin eval -- "$settings" 2>/dev/null # suppress "line editing not enabled" + fi + fi +} +function ble/builtin/bind { + local set shopt; ble/base/.adjust-bash-options set shopt + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/adjust-BASH_REMATCH + ble/decode/initialize + local flags= bindx_bash42bug= ext=0 + ble/builtin/bind/.process "$@" + if [[ $_ble_decode_bind_state == none ]]; then + if [[ ! $bindx_bash42bug ]]; then + builtin bind "$@"; ext=$? + fi + elif [[ $flags == *[eh]* ]]; then + [[ $flags == *e* ]] && + builtin bind --usage 2>&1 1>/dev/null | ble/bin/grep ^bind >&2 + ext=2 + fi + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/restore-BASH_REMATCH + ble/base/.restore-bash-options set shopt + return "$ext" +} +function bind { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/bind "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function ble/decode/initialize/.has-broken-suse-inputrc { + local content= + [[ -s /etc/inputrc.keys && -r /etc/os-release ]] && + ble/util/readfile content /etc/os-release && + [[ $content == *'SUSE'* ]] || return 1 + return 0 +} +_ble_decode_initialize_inputrc=auto +function ble/decode/initialize { + function ble/decode/initialize { return 0; } + ble/decode/cmap/initialize + if [[ $_ble_decode_initialize_inputrc == auto ]]; then + if ble/decode/initialize/.has-broken-suse-inputrc; then + [[ ${INPUTRC-} == /etc/inputrc || ${INPUTRC-} == /etc/inputrc.keys ]] && + local INPUTRC=~/.inputrc + _ble_decode_initialize_inputrc=user + else + _ble_decode_initialize_inputrc=diff + fi + fi + case $_ble_decode_initialize_inputrc in + (all) + ble/builtin/bind/initialize-inputrc all ;; + (user) + ble/builtin/bind/initialize-inputrc ;; + (diff) + ble/builtin/bind/read-user-settings ;; + esac +} +function ble/decode/reset-default-keymap { + local old_base_keymap=${_ble_decode_keymap_stack[0]:-$_ble_decode_keymap} + ble-decode/INITIALIZE_DEFMAP -v _ble_decode_keymap # 0ms + _ble_decode_keymap_stack=() + if [[ $_ble_decode_keymap != "$old_base_keymap" ]]; then + [[ $old_base_keymap ]] && + _ble_decode_keymap=$old_base_keymap ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_DETACH" + ble-decode/widget/.invoke-hook "$_ble_decode_KCODE_ATTACH" # 7ms for vi-mode + local cursor; ble/decode/keymap#get-cursor "$_ble_decode_keymap" + [[ $cursor ]] && ble/term/cursor-state/set-internal "$((cursor))" + fi +} +function ble/decode/attach { + if ble/decode/keymap#is-empty "$_ble_decode_keymap"; then + ble/util/print "ble.sh: The keymap '$_ble_decode_keymap' is empty." >&2 + return 1 + fi + [[ $_ble_decode_bind_state != none ]] && return 0 + ble/util/save-editing-mode _ble_decode_bind_state + [[ $_ble_decode_bind_state == none ]] && return 1 + ble/term/attach # 3ms + ble/util/reset-keymap-of-editing-mode + ble/util/eval-stdout 'ble/decode/readline/.generate-source-to-unbind-default' # 21ms + ble/decode/readline/bind # 20ms + return 0 +} +function ble/decode/detach { + [[ $_ble_decode_bind_state != none ]] || return 1 + local current_editing_mode= + ble/util/save-editing-mode current_editing_mode + [[ $_ble_decode_bind_state == "$current_editing_mode" ]] || ble/util/restore-editing-mode _ble_decode_bind_state + ble/term/detach + ble/decode/readline/unbind + if [[ -s "$_ble_base_run/$$.bind.save" ]]; then + source -- "$_ble_base_run/$$.bind.save" + >| "$_ble_base_run/$$.bind.save" + fi + [[ $_ble_decode_bind_state == "$current_editing_mode" ]] || ble/util/restore-editing-mode current_editing_mode + _ble_decode_bind_state=none +} +function ble/encoding:UTF-8/generate-binder { return 0; } +_ble_encoding_utf8_decode_mode=0 +_ble_encoding_utf8_decode_code=0 +_ble_encoding_utf8_decode_table=( + 'M&&E,A[i++]='{0..127} + 'C=C<<6|'{0..63}',--M==0&&(A[i++]=C)' + 'M&&E,C='{0..31}',M=1' + 'M&&E,C='{0..15}',M=2' + 'M&&E,C='{0..7}',M=3' + 'M&&E,C='{0..3}',M=4' + 'M&&E,C='{0..1}',M=5' + 'M&&E,A[i++]=_ble_decode_Erro|'{254,255} +) +function ble/encoding:UTF-8/clear { + _ble_encoding_utf8_decode_mode=0 + _ble_encoding_utf8_decode_code=0 +} +function ble/encoding:UTF-8/is-intermediate { + ((_ble_encoding_utf8_decode_mode)) +} +function ble/encoding:UTF-8/decode { + local C=$_ble_encoding_utf8_decode_code + local M=$_ble_encoding_utf8_decode_mode + local E='M=0,A[i++]=_ble_decode_Erro|C' + local -a A=() + local i=0 b + for b; do + ((_ble_encoding_utf8_decode_table[b&255])) + done + _ble_encoding_utf8_decode_code=$C + _ble_encoding_utf8_decode_mode=$M + ((i)) && ble-decode-char "${A[@]}" +} +function ble/encoding:UTF-8/c2bc { + local code=$1 + ((ret=code<0x80?1: + (code<0x800?2: + (code<0x10000?3: + (code<0x200000?4:5))))) +} +function ble/encoding:C/generate-binder { + ble/init:bind/bind-s '"\C-@":"\x9B\x80"' + ble/init:bind/bind-s '"\e":"\x9B\x8B"' # isolated ESC (U+07BC) に後で変換 + local i ret + for i in {0..255}; do + ble/decode/c2dqs "$i" + ble/init:bind/bind-s "\"\e$ret\": \"\x9B\x9B$ret\"" + done +} +_ble_encoding_c_csi= +function ble/encoding:C/clear { + _ble_encoding_c_csi= +} +function ble/encoding:C/is-intermediate { + [[ $_ble_encoding_c_csi ]] +} +function ble/encoding:C/decode { + local -a A=() + local i=0 b + for b; do + if [[ $_ble_encoding_c_csi ]]; then + _ble_encoding_c_csi= + case $b in + (155) A[i++]=27 # ESC + continue ;; + (139) A[i++]=1980 # isolated ESC U+07BC + continue ;; + (128) A[i++]=0 # C-@ + continue ;; + esac + A[i++]=155 + fi + if ((b==155)); then + _ble_encoding_c_csi=1 + else + A[i++]=$b + fi + done + ((i)) && ble-decode-char "${A[@]}" +} +function ble/encoding:C/c2bc { + ret=1 +} +_ble_color_gflags_Bold=0x01 +_ble_color_gflags_Italic=0x02 +_ble_color_gflags_Underline=0x04 +_ble_color_gflags_Revert=0x08 +_ble_color_gflags_Invisible=0x10 +_ble_color_gflags_Strike=0x20 +_ble_color_gflags_Blink=0x40 +_ble_color_gflags_DecorationMask=0x77 +_ble_color_gflags_FgMask=0x01000000FFFFFF00 +_ble_color_gflags_BgMask=0x02FFFFFF00000000 +_ble_color_gflags_FgShift=8 +_ble_color_gflags_BgShift=32 +_ble_color_gflags_FgTrueColor=0x0100000000000000 +_ble_color_gflags_BgTrueColor=0x0200000000000000 +_ble_color_gflags_FgIndexedColor=0x0000000000010000 +_ble_color_gflags_BgIndexedColor=0x0000010000000000 +_ble_color_index_colors_default=$_ble_term_colors +if [[ $TERM == xterm* || $TERM == *-256color || $TERM == kterm* ]]; then + _ble_color_index_colors_default=256 +elif [[ $TERM == *-88color ]]; then + _ble_color_index_colors_default=88 +fi +bleopt/declare -v term_true_colors semicolon +bleopt/declare -v term_index_colors auto +function bleopt/check:term_true_colors { + ble/color/g2sgr/.clear-cache + return 0 +} +function bleopt/check:term_index_colors { + ble/color/g2sgr/.clear-cache + return 0 +} +function ble/color/initialize-term-colors { + local fields + ble/string#split fields \; "$_ble_term_DA2R" + if [[ $bleopt_term_true_colors == auto ]]; then + local value= + if [[ $TERM == *-24bit || $TERM == *-direct ]]; then + value=colon + elif [[ $TERM == *-24bits || $TERM == *-truecolor || $COLORTERM == *24bit* || $COLORTERM == *truecolor* ]]; then + value=semicolon + else + case ${fields[0]} in + (83) # screen (truecolor on にしている必要がある。判定方法は不明) + if ((fields[1]>=49900)); then + value=semicolon + fi ;; + (67) + if ((fields[1]>=100000)); then + : # cygwin terminal + else + value=colon + fi ;; + esac + fi + [[ $value ]] && + bleopt term_true_colors="$value" + fi +} +blehook term_DA2R!=ble/color/initialize-term-colors +function ble/color/palette/.print-indexed-colors { + local cols=$(((${COLUMNS:-80}-1)/4)) + ((cols<1?(cols=1):(cols>16&&(cols=16)))) + local bg bg0 bgN ret gflags=$((_ble_color_gflags_BgIndexedColor|_ble_color_gflags_FgIndexedColor)) + for ((bg0=0;bg0<256;bg0+=cols)); do + ((bgN=bg0+cols,bgN<256||(bgN=256))) + for ((bg=bg0;bg=12?3+p:p)) + for ((B=0;B<6;B++)); do + ((bg=16+R*36+G*6+B)) + ble/color/g2sgr "$((gflags|bg<<_ble_color_gflags_BgShift|(l%2?15:0)<<_ble_color_gflags_FgShift))" + printf '%s%03d ' "$ret" "$bg" + done + if ((p+1<3)); then + printf '%s ' "$_ble_term_sgr0" + else + printf '%s\n' "$_ble_term_sgr0" + fi + done + done + local l c K + for ((l=0;l<4;l++)); do + for ((c=0;c<12;c++)); do + ((K=l/2*12+c)) + ((bg=232+K)) + ble/color/g2sgr "$((gflags|bg<<_ble_color_gflags_BgShift|(l%2?15:0)<<_ble_color_gflags_FgShift))" + printf '%s%03d ' "$ret" "$bg" + done + printf '%s\n' "$_ble_term_sgr0" + done + return 0 +} +function ble-color-show { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + if (($#)); then + ble/base/print-usage-for-no-argument-command 'Update and reload ble.sh.' "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return 2 + fi + ble/color/palette/.print-indexed-colors + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function ble-palette { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + if (($#)); then + ble/base/print-usage-for-no-argument-command 'Update and reload ble.sh.' "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return 2 + fi + if ((${COLUMNS:-80}<80)); then + ble/color/palette/.print-indexed-colors + else + ble/color/palette/.print-xterm-256color + fi + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_color_g2sgr_version=0 +_ble_color_g2sgr=() +_ble_color_g2sgr_ansi=() +function ble/color/g2sgr/.impl { + local g=$(($1)) + local sgr=0 + ((g&_ble_color_gflags_Bold)) && sgr="$sgr;${_ble_term_sgr_bold:-1}" + ((g&_ble_color_gflags_Italic)) && sgr="$sgr;${_ble_term_sgr_sitm:-3}" + ((g&_ble_color_gflags_Underline)) && sgr="$sgr;${_ble_term_sgr_smul:-4}" + ((g&_ble_color_gflags_Blink)) && sgr="$sgr;${_ble_term_sgr_blink:-5}" + ((g&_ble_color_gflags_Revert)) && sgr="$sgr;${_ble_term_sgr_rev:-7}" + ((g&_ble_color_gflags_Invisible)) && sgr="$sgr;${_ble_term_sgr_invis:-8}" + ((g&_ble_color_gflags_Strike)) && sgr="$sgr;${_ble_term_sgr_strike:-9}" + if ((g&_ble_color_gflags_FgTrueColor)); then + local rgb=$((1<<24|g>>8&0xFFFFFF)) + ble/color/.color2sgrfg "$rgb" + sgr="$sgr;$ret" + elif ((g&_ble_color_gflags_FgIndexedColor)); then + local fg=$((g>>8&0xFF)) + ble/color/.color2sgrfg "$fg" + sgr="$sgr;$ret" + fi + if ((g&_ble_color_gflags_BgTrueColor)); then + local rgb=$((1<<24|g>>32&0xFFFFFF)) + ble/color/.color2sgrbg "$rgb" + sgr="$sgr;$ret" + elif ((g&_ble_color_gflags_BgIndexedColor)); then + local bg=$((g>>32&0xFF)) + ble/color/.color2sgrbg "$bg" + sgr="$sgr;$ret" + fi + ret=$'\e['$sgr'm' + _ble_color_g2sgr[$1]=$ret +} +function ble/color/g2sgr/.clear-cache { + _ble_color_g2sgr=() + ((_ble_color_g2sgr_version++)) +} +function ble/color/g2sgr { + ret=${_ble_color_g2sgr[$1]} + [[ $ret ]] || ble/color/g2sgr/.impl "$1" +} +function ble/color/g2sgr-ansi/.impl { + local g=$(($1)) + local sgr=0 + ((g&_ble_color_gflags_Bold)) && sgr="$sgr;1" + ((g&_ble_color_gflags_Italic)) && sgr="$sgr;3" + ((g&_ble_color_gflags_Underline)) && sgr="$sgr;4" + ((g&_ble_color_gflags_Blink)) && sgr="$sgr;5" + ((g&_ble_color_gflags_Revert)) && sgr="$sgr;7" + ((g&_ble_color_gflags_Invisible)) && sgr="$sgr;8" + ((g&_ble_color_gflags_Strike)) && sgr="$sgr;9" + if ((g&_ble_color_gflags_FgTrueColor)); then + local rgb=$((1<<24|g>>8&0xFFFFFF)) + local R=$((rgb>>16&0xFF)) G=$((rgb>>8&0xFF)) B=$((rgb&0xFF)) + sgr="$sgr;38:2::$R:$G:$B" + elif ((g&_ble_color_gflags_FgIndexedColor)); then + local fg=$((g>>8&0xFF)) + sgr="$sgr;38:5:$fg" + fi + if ((g&_ble_color_gflags_BgTrueColor)); then + local rgb=$((1<<24|g>>32&0xFFFFFF)) + local R=$((rgb>>16&0xFF)) G=$((rgb>>8&0xFF)) B=$((rgb&0xFF)) + sgr="$sgr;48:2::$R:$G:$B" + elif ((g&_ble_color_gflags_BgIndexedColor)); then + local bg=$((g>>32&0xFF)) + sgr="$sgr;48:5:$bg" + fi + ret=$'\e['$sgr'm' + _ble_color_g2sgr_ansi[$1]=$ret +} +function ble/color/g2sgr-ansi { + ret=${_ble_color_g2sgr_ansi[$1]} + [[ $ret ]] || ble/color/g2sgr-ansi/.impl "$1" +} +function ble/color/g#setfg-clear { + (($1&=~_ble_color_gflags_FgMask)) +} +function ble/color/g#setbg-clear { + (($1&=~_ble_color_gflags_BgMask)) +} +function ble/color/g#setfg-index { + local _ble_local_color=$2 + (($1=$1&~_ble_color_gflags_FgMask|_ble_color_gflags_FgIndexedColor|(_ble_local_color&0xFF)<<8)) # index color +} +function ble/color/g#setbg-index { + local _ble_local_color=$2 + (($1=$1&~_ble_color_gflags_BgMask|_ble_color_gflags_BgIndexedColor|(_ble_local_color&0xFF)<<32)) # index color +} +function ble/color/g#setfg-rgb { + local _ble_local_R=$2 + local _ble_local_G=$3 + local _ble_local_B=$4 + ((_ble_local_R&=0xFF,_ble_local_G&=0xFF,_ble_local_B&=0xFF)) + (($1=$1&~_ble_color_gflags_FgMask|_ble_color_gflags_FgTrueColor|_ble_local_R<<24|_ble_local_G<<16|_ble_local_B<<8)) # true color +} +function ble/color/g#setbg-rgb { + local _ble_local_R=$2 + local _ble_local_G=$3 + local _ble_local_B=$4 + ((_ble_local_R&=0xFF,_ble_local_G&=0xFF,_ble_local_B&=0xFF)) + (($1=$1&~_ble_color_gflags_BgMask|_ble_color_gflags_BgTrueColor|_ble_local_R<<48|_ble_local_G<<40|_ble_local_B<<32)) # true color +} +function ble/color/g#setfg-cmyk { + local _ble_local_C=$2 + local _ble_local_M=$3 + local _ble_local_Y=$4 + local _ble_local_K=${5:-0} + ((_ble_local_K=~_ble_local_K&0xFF, + _ble_local_C=(~_ble_local_C&0xFF)*_ble_local_K/255, + _ble_local_M=(~_ble_local_M&0xFF)*_ble_local_K/255, + _ble_local_Y=(~_ble_local_Y&0xFF)*_ble_local_K/255)) + ble/color/g#setfg-rgb "$_ble_local_C" "$_ble_local_M" "$_ble_local_Y" +} +function ble/color/g#setbg-cmyk { + local _ble_local_C=$2 + local _ble_local_M=$3 + local _ble_local_Y=$4 + local _ble_local_K=${5:-0} + ((_ble_local_K=~_ble_local_K&0xFF, + _ble_local_C=(~_ble_local_C&0xFF)*_ble_local_K/255, + _ble_local_M=(~_ble_local_M&0xFF)*_ble_local_K/255, + _ble_local_Y=(~_ble_local_Y&0xFF)*_ble_local_K/255)) + ble/color/g#setbg-rgb "$1" "$_ble_local_C" "$_ble_local_M" "$_ble_local_Y" +} +function ble/color/g#setfg { + local _ble_local_color=$2 + if ((_ble_local_color<0)); then + ble/color/g#setfg-clear "$1" + elif ((_ble_local_color>=0x1000000)); then + (($1=$1&~_ble_color_gflags_FgMask|_ble_color_gflags_FgTrueColor|(_ble_local_color&0xFFFFFF)<<8)) # true color + else + ble/color/g#setfg-index "$1" "$_ble_local_color" + fi +} +function ble/color/g#setbg { + local _ble_local_color=$2 + if ((_ble_local_color<0)); then + ble/color/g#setbg-clear "$1" + elif ((_ble_local_color>=0x1000000)); then + (($1=$1&~_ble_color_gflags_BgMask|_ble_color_gflags_BgTrueColor|(_ble_local_color&0xFFFFFF)<<32)) # true color + else + ble/color/g#setbg-index "$1" "$_ble_local_color" + fi +} +function ble/color/g#append { + local _ble_local_g2=$2 + ((_ble_local_g2&_ble_color_gflags_FgMask)) && + (($1&=~_ble_color_gflags_FgMask)) + ((_ble_local_g2&_ble_color_gflags_BgMask)) && + (($1&=~_ble_color_gflags_BgMask)) + (($1|=_ble_local_g2&~_ble_color_gflags_Revert)) + (($1^=_ble_local_g2&_ble_color_gflags_Revert)) + return 0 +} +function ble/color/g#compose { + local _ble_local_g2=$2 + (($1=_ble_local_g2)) + for _ble_local_g2 in "${@:3}"; do + ble/color/g#append "$1" "$_ble_local_g2" + done +} +function ble/color/g.setfg { ble/color/g#setfg g "$@"; } +function ble/color/g.setbg { ble/color/g#setbg g "$@"; } +function ble/color/g.setfg-clear { ble/color/g#setfg-clear g "$@"; } +function ble/color/g.setbg-clear { ble/color/g#setbg-clear g "$@"; } +function ble/color/g.setfg-index { ble/color/g#setfg-index g "$@"; } +function ble/color/g.setbg-index { ble/color/g#setbg-index g "$@"; } +function ble/color/g.setfg-rgb { ble/color/g#setfg-rgb g "$@"; } +function ble/color/g.setbg-rgb { ble/color/g#setbg-rgb g "$@"; } +function ble/color/g.setfg-cmyk { ble/color/g#setfg-cmyk g "$@"; } +function ble/color/g.setbg-cmyk { ble/color/g#setbg-cmyk g "$@"; } +function ble/color/g.append { ble/color/g#append g "$@"; } +function ble/color/g.compose { ble/color/g#compose g "$@"; } +function ble/color/g#getfg { + local g=$1 + if ((g&_ble_color_gflags_FgTrueColor)); then + ((ret=0x1000000|(g>>8&0xFFFFFF))) + elif ((g&_ble_color_gflags_FgIndexedColor)); then + ((ret=g>>8&0xFF)) + else + ((ret=-1)) + fi +} +function ble/color/g#getbg { + local g=$1 + if ((g&_ble_color_gflags_BgTrueColor)); then + ((ret=0x1000000|(g>>32&0xFFFFFF))) + elif ((g&_ble_color_gflags_BgIndexedColor)); then + ((ret=g>>32&0xFF)) + else + ((ret=-1)) + fi +} +function ble/color/g#compute-fg { + local g=$1 + if ((g&_ble_color_gflags_Invisible)); then + ble/color/g#compute-bg "$g" + elif ((g&_ble_color_gflags_Revert)); then + ble/color/g#getbg "$g" + else + ble/color/g#getfg "$g" + fi +} +function ble/color/g#compute-bg { + local g=$1 + if ((g&_ble_color_gflags_Revert)); then + ble/color/g#getfg "$g" + else + ble/color/g#getbg "$g" + fi +} +function ble/color/gspec2g { + local g=0 entry + for entry in ${1//,/ }; do + case $entry in + (bold) ((g|=_ble_color_gflags_Bold)) ;; + (underline) ((g|=_ble_color_gflags_Underline)) ;; + (blink) ((g|=_ble_color_gflags_Blink)) ;; + (invis) ((g|=_ble_color_gflags_Invisible)) ;; + (reverse) ((g|=_ble_color_gflags_Revert)) ;; + (strike) ((g|=_ble_color_gflags_Strike)) ;; + (italic) ((g|=_ble_color_gflags_Italic)) ;; + (standout) ((g|=_ble_color_gflags_Revert|_ble_color_gflags_Bold)) ;; + (fg=*) + ble/color/.name2color "${entry:3}" + ble/color/g.setfg "$ret" ;; + (bg=*) + ble/color/.name2color "${entry:3}" + ble/color/g.setbg "$ret" ;; + (none) + g=0 ;; + esac + done + ret=$g +} +function ble/color/g2gspec { + local g=$1 gspec= + if ((g&_ble_color_gflags_FgTrueColor)); then + local rgb=$((1<<24|g>>8&0xFFFFFF)) + ble/color/.color2name "$rgb" + gspec=$gspec,fg=$ret + elif ((g&_ble_color_gflags_FgIndexedColor)); then + local fg=$((g>>8&0xFF)) + ble/color/.color2name "$fg" + gspec=$gspec,fg=$ret + fi + if ((g&_ble_color_gflags_BgTrueColor)); then + local rgb=$((1<<24|g>>32&0xFFFFFF)) + ble/color/.color2name "$rgb" + gspec=$gspec,bg=$ret + elif ((g&_ble_color_gflags_BgIndexedColor)); then + local bg=$((g>>32&0xFF)) + ble/color/.color2name "$bg" + gspec=$gspec,bg=$ret + fi + ((g&_ble_color_gflags_Bold)) && gspec=$gspec,bold + ((g&_ble_color_gflags_Underline)) && gspec=$gspec,underline + ((g&_ble_color_gflags_Blink)) && gspec=$gspec,blink + ((g&_ble_color_gflags_Invisible)) && gspec=$gspec,invis + ((g&_ble_color_gflags_Revert)) && gspec=$gspec,reverse + ((g&_ble_color_gflags_Strike)) && gspec=$gspec,strike + ((g&_ble_color_gflags_Italic)) && gspec=$gspec,italic + gspec=${gspec#,} + ret=${gspec:-none} +} +function ble/color/gspec2sgr { + local sgr=0 entry + for entry in ${1//,/ }; do + case $entry in + (bold) sgr="$sgr;${_ble_term_sgr_bold:-1}" ;; + (underline) sgr="$sgr;${_ble_term_sgr_smul:-4}" ;; + (blink) sgr="$sgr;${_ble_term_sgr_blink:-5}" ;; + (invis) sgr="$sgr;${_ble_term_sgr_invis:-8}" ;; + (reverse) sgr="$sgr;${_ble_term_sgr_rev:-7}" ;; + (strike) sgr="$sgr;${_ble_term_sgr_strike:-9}" ;; + (italic) sgr="$sgr;${_ble_term_sgr_sitm:-3}" ;; + (standout) sgr="$sgr;${_ble_term_sgr_bold:-1};${_ble_term_sgr_rev:-7}" ;; + (fg=*) + ble/color/.name2color "${entry:3}" + ble/color/.color2sgrfg "$ret" + sgr="$sgr;$ret" ;; + (bg=*) + ble/color/.name2color "${entry:3}" + ble/color/.color2sgrbg "$ret" + sgr="$sgr;$ret" ;; + (none) + sgr=0 ;; + esac + done + ret="[${sgr}m" +} +function ble/color/.name2color/.clamp { + local text=$1 max=$2 + if [[ $text == *% ]]; then + ((ret=10#0${text%'%'}*max/100)) + else + ((ret=10#0$text)) + fi + ((ret>max)) && ret=max +} +function ble/color/.name2color/.wrap { + local text=$1 max=$2 + if [[ $text == *% ]]; then + ((ret=10#0${text%'%'}*max/100)) + else + ((ret=10#0$text)) + fi + ((ret%=max)) +} +function ble/color/.hxx2color { + local H=$1 Min=$2 Range=$3 Unit=$4 + local h1 h2 x=$Min y=$Min z=$Min + ((h1=H%120,h2=120-h1, + x+=Range*(h2<60?h2:60)/60, + y+=Range*(h1<60?h1:60)/60)) + ((x=x*255/Unit, + y=y*255/Unit, + z=z*255/Unit)) + case $((H/120)) in + (0) local R=$x G=$y B=$z ;; + (1) local R=$z G=$x B=$y ;; + (2) local R=$y G=$z B=$x ;; + esac + ((ret=1<<24|R<<16|G<<8|B)) +} +function ble/color/.hsl2color { + local H=$1 S=$2 L=$3 Unit=$4 + local Range=$((2*(L<=Unit/2?L:Unit-L)*S/Unit)) + local Min=$((L-Range/2)) + ble/color/.hxx2color "$H" "$Min" "$Range" "$Unit" +} +function ble/color/.hsb2color { + local H=$1 S=$2 B=$3 Unit=$4 + local Range=$((B*S/Unit)) + local Min=$((B-Range)) + ble/color/.hxx2color "$H" "$Min" "$Range" "$Unit" +} +function ble/color/.name2color { + local colorName=$1 + if [[ ! ${colorName//[0-9]} ]]; then + ((ret=10#0$colorName&255)) + elif [[ $colorName == '#'* ]]; then + if local rex='^#[0-9a-fA-F]{3}$'; [[ $colorName =~ $rex ]]; then + let "ret=1<<24|16#${colorName:1:1}*0x11<<16|16#${colorName:2:1}*0x11<<8|16#${colorName:3:1}*0x11" + elif rex='^#[0-9a-fA-F]{6}$'; [[ $colorName =~ $rex ]]; then + let "ret=1<<24|16#${colorName:1:2}<<16|16#${colorName:3:2}<<8|16#${colorName:5:2}" + else + ret=-1 + fi + elif [[ $colorName == *:* ]]; then + if local rex='^rgb:([0-9]+%?)/([0-9]+%?)/([0-9]+%?)$'; [[ $colorName =~ $rex ]]; then + ble/color/.name2color/.clamp "${BASH_REMATCH[1]}" 255; local R=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[2]}" 255; local G=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[3]}" 255; local B=$ret + ((ret=1<<24|R<<16|G<<8|B)) + elif + local rex1='^cmy:([0-9]+%?)/([0-9]+%?)/([0-9]+%?)$' + local rex2='^cmyk:([0-9]+%?)/([0-9]+%?)/([0-9]+%?)/([0-9]+%?)$' + [[ $colorName =~ $rex1 || $colorName =~ $rex2 ]] + then + ble/color/.name2color/.clamp "${BASH_REMATCH[1]}" 255; local C=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[2]}" 255; local M=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[3]}" 255; local Y=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[4]:-0}" 255; local K=$ret + local K=$((~K&0xFF)) + local R=$(((~C&0xFF)*K/255)) + local G=$(((~M&0xFF)*K/255)) + local B=$(((~Y&0xFF)*K/255)) + ((ret=1<<24|R<<16|G<<8|B)) + elif rex='^hs[lvb]:([0-9]+)/([0-9]+%)/([0-9]+%)$'; [[ $colorName =~ $rex ]]; then + ble/color/.name2color/.wrap "${BASH_REMATCH[1]}" 360; local H=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[2]}" 1000; local S=$ret + ble/color/.name2color/.clamp "${BASH_REMATCH[3]}" 1000; local X=$ret + if [[ $colorName == hsl:* ]]; then + ble/color/.hsl2color "$H" "$S" "$X" 1000 + else + ble/color/.hsb2color "$H" "$S" "$X" 1000 + fi + else + ret=-1 + fi + else + case $colorName in + (black) ret=0 ;; + (brown) ret=1 ;; + (green) ret=2 ;; + (olive) ret=3 ;; + (navy) ret=4 ;; + (purple) ret=5 ;; + (teal) ret=6 ;; + (silver) ret=7 ;; + (gr[ae]y) ret=8 ;; + (red) ret=9 ;; + (lime) ret=10 ;; + (yellow) ret=11 ;; + (blue) ret=12 ;; + (magenta) ret=13 ;; + (cyan) ret=14 ;; + (white) ret=15 ;; + (orange) ret=202 ;; + (transparent|default) ret=-1 ;; + (*) ret=-1 ;; + esac + fi +} +function ble/color/.color2name { + if (($1>=0x1000000)); then + ble/util/sprintf ret '#%06x' "$(($1&0xFFFFFF))" + return 0 + fi + ((ret=(10#0$1&255))) + case $ret in + (0) ret=black ;; + (1) ret=brown ;; + (2) ret=green ;; + (3) ret=olive ;; + (4) ret=navy ;; + (5) ret=purple ;; + (6) ret=teal ;; + (7) ret=silver ;; + (8) ret=gray ;; + (9) ret=red ;; + (10) ret=lime ;; + (11) ret=yellow ;; + (12) ret=blue ;; + (13) ret=magenta ;; + (14) ret=cyan ;; + (15) ret=white ;; + (202) ret=orange ;; + esac +} +function ble/color/convert-color88-to-color256 { + local color=$1 + if ((color>=16)); then + if ((color>=80)); then + local L=$((((color-80+1)*25+4)/9)) + ((color=L==0?16:(L==25?231:232+(L-1)))) + else + ((color-=16)) + local R=$((color/16)) G=$((color/4%4)) B=$((color%4)) + ((R=(R*5+1)/3,G=(G*5+1)/3,B=(B*5+1)/3, + color=16+R*36+G*6+B)) + fi + fi + ret=$color +} +function ble/color/convert-color256-to-color88 { + local color=$1 + if ((color>=16)); then + if ((color>=232)); then + local L=$((((color-232+1)*9+12)/25)) + ((color=L==0?16:(L==9?79:80+(L-1)))) + else + ((color-=16)) + local R=$((color/36)) G=$((color/6%6)) B=$((color%6)) + ((R=(R*3+2)/5,G=(G*3+2)/5,B=(B*3+2)/5, + color=16+R*16+G*4+B)) + fi + fi + ret=$color +} +function ble/color/convert-rgb24-to-color256 { + local R=$1 G=$2 B=$3 + if ((R!=G||G!=B)); then + local r=$((R<=47?0:(R<=95?1:(R-35)/40))) + local g=$((G<=47?0:(G<=95?1:(G-35)/40))) + local b=$((B<=47?0:(B<=95?1:(B-35)/40))) + if ((r!=g||g!=b)); then + ((ret=16+36*r+6*g+b)) + return 0 + fi + fi + local W=$(((R+G+B+1)/3)) + if ((W<=3)); then + ret=16 + elif ((W>=247)); then + ret=231 + elif ((W>=92&&(W-92)%40<5)); then + ((ret=59+43*(W-92)/40)) + else + local level=$(((W-3)/10)) + ((ret=232+(level<=23?level:23))) + fi +} +function ble/color/convert-rgb24-to-color88 { + local R=$1 G=$2 B=$3 + if ((R!=G||G!=B)); then + local r=$((R<=69?0:(R<=168?1:(R-52)/58))) + local g=$((G<=69?0:(G<=168?1:(G-52)/58))) + local b=$((B<=69?0:(B<=168?1:(B-52)/58))) + if ((r!=g||g!=b)); then + ((ret=16+16*r+4*g+b)) + return 0 + fi + fi + local W=$(((R+G+B+1)/3)) + if ((W<=22)); then + ret=16 # 4x4x4 cube (0,0,0)=0:0:0 + elif ((W>=239)); then + ret=79 # 4x4x4 cube (3,3,3)=255:255:255 + elif ((131<=W&&W<=142)); then + ret=37 # 4x4x4 cube (1,1,1)=139:139:139 + elif ((197<=W&&W<=208)); then + ret=58 # 4x4x4 cube (2,2,2)=197:197:197 + else + local level=$(((W-34)/25)) + ((ret=80+(level<=7?level:7))) + fi +} +_ble_color_color2sgr_filter= +function ble/color/.color2sgr-impl { + local ccode=$1 prefix=$2 # 3 for fg, 4 for bg + builtin eval -- "$_ble_color_color2sgr_filter" + if ((ccode<0)); then + ret=${prefix}9 + elif ((ccode<16&&ccode<_ble_term_colors)); then + if ((prefix==4)); then + ret=${_ble_term_sgr_ab[ccode]} + else + ret=${_ble_term_sgr_af[ccode]} + fi + elif ((ccode<256)); then + local index_colors=$_ble_color_index_colors_default + [[ $bleopt_term_index_colors == auto ]] || ((index_colors=bleopt_term_index_colors)) + if ((index_colors>=256)); then + ret="${prefix}8;5;$ccode" + elif ((index_colors>=88)); then + ble/color/convert-color256-to-color88 "$ccode" + ret="${prefix}8;5;$ret" + elif ((ccode=16||_ble_term_colors==8)); then + if ((ccode>=16)); then + if ((ccode>=232)); then + local L=$((((ccode-232+1)*3+12)/25)) + ((ccode=L==0?0:(L==1?8:(L==2?7:15)))) + else + ((ccode-=16)) + local R=$((ccode/36)) G=$((ccode/6%6)) B=$((ccode%6)) + if ((R==G&&G==B)); then + local L=$(((R*3+2)/5)) + ((ccode=L==0?0:(L==1?8:(L==2?7:15)))) + else + local min max + ((Rmax&&(max=B)))) + local Range=$((max-min)) + ((R=(R-min+Range/2)/Range, + G=(G-min+Range/2)/Range, + B=(B-min+Range/2)/Range, + ccode=R+G*2+B*4+(min+max>=5?8:0))) + fi + fi + fi + ((_ble_term_colors==8&&ccode>=8&&(ccode-=8))) + if ((prefix==4)); then + ret=${_ble_term_sgr_ab[ccode]} + else + ret=${_ble_term_sgr_af[ccode]} + fi + else + ret=${prefix}9 + fi + elif ((0x1000000<=ccode&&ccode<0x2000000)); then + local R=$((ccode>>16&0xFF)) G=$((ccode>>8&0xFF)) B=$((ccode&0xFF)) + if [[ $bleopt_term_true_colors == semicolon ]]; then + ret="${prefix}8;2;$R;$G;$B" + elif [[ $bleopt_term_true_colors == colon ]]; then + ret="${prefix}8:2::$R:$G:$B" + else + local index_colors=$_ble_color_index_colors_default + [[ $bleopt_term_index_colors == auto ]] || ((index_colors=bleopt_term_index_colors)) + local index= + if ((index_colors>=256)); then + ble/color/convert-rgb24-to-color256 "$R" "$G" "$B" + index=$ret + elif ((index_colors>=88)); then + ble/color/convert-rgb24-to-color88 "$R" "$G" "$B" + index=$ret + else + ble/color/convert-rgb24-to-color256 "$R" "$G" "$B" + if ((ret5)) && + ble/color/read-sgrspec/.arg-next -v S + ble/color/read-sgrspec/.arg-next -v R + ble/color/read-sgrspec/.arg-next -v G + ble/color/read-sgrspec/.arg-next -v B + ble/color/g.setfg-rgb "$R" "$G" "$B" + elif ((cspace==3||cspace==4)); then + local S C M Y K=0 + ((${#fields[@]}>2+cspace)) && + ble/color/read-sgrspec/.arg-next -v S + ble/color/read-sgrspec/.arg-next -v C + ble/color/read-sgrspec/.arg-next -v M + ble/color/read-sgrspec/.arg-next -v Y + ((cspace==4)) && + ble/color/read-sgrspec/.arg-next -v K + ble/color/g.setfg-cmyk "$C" "$M" "$Y" "$K" + else + ble/color/g.setfg-clear + fi + elif ((arg==48)); then + local j=1 color cspace + ble/color/read-sgrspec/.arg-next -v cspace + if ((cspace==5)); then + ble/color/read-sgrspec/.arg-next -v color + if [[ :$opts: != *:ansi:* ]] && ((bleopt_term_index_colors==88)); then + local ret; ble/color/convert-color88-to-color256 "$color"; color=$ret + fi + ble/color/g.setbg-index "$color" + elif ((cspace==2)); then + local S R G B + ((${#fields[@]}>5)) && + ble/color/read-sgrspec/.arg-next -v S + ble/color/read-sgrspec/.arg-next -v R + ble/color/read-sgrspec/.arg-next -v G + ble/color/read-sgrspec/.arg-next -v B + ble/color/g.setbg-rgb "$R" "$G" "$B" + elif ((cspace==3||cspace==4)); then + local S C M Y K=0 + ((${#fields[@]}>2+cspace)) && + ble/color/read-sgrspec/.arg-next -v S + ble/color/read-sgrspec/.arg-next -v C + ble/color/read-sgrspec/.arg-next -v M + ble/color/read-sgrspec/.arg-next -v Y + ((cspace==4)) && + ble/color/read-sgrspec/.arg-next -v K + ble/color/g.setbg-cmyk "$C" "$M" "$Y" "$K" + else + ble/color/g.setbg-clear + fi + elif ((arg==39)); then + ble/color/g.setfg-clear + elif ((arg==49)); then + ble/color/g.setbg-clear + fi + elif ((90<=arg&&arg<98)); then + local color=$((arg-90+8)) + ble/color/g.setfg-index "$color" + elif ((100<=arg&&arg<108)); then + local color=$((arg-100+8)) + ble/color/g.setbg-index "$color" + else + case $arg in + (1) ((g|=_ble_color_gflags_Bold)) ;; + (22) ((g&=~_ble_color_gflags_Bold)) ;; + (4) ((g|=_ble_color_gflags_Underline)) ;; + (24) ((g&=~_ble_color_gflags_Underline)) ;; + (7) ((g|=_ble_color_gflags_Revert)) ;; + (27) ((g&=~_ble_color_gflags_Revert)) ;; + (9807) ((g^=_ble_color_gflags_Revert)) ;; # toggle (for internal use) + (3) ((g|=_ble_color_gflags_Italic)) ;; + (23) ((g&=~_ble_color_gflags_Italic)) ;; + (5) ((g|=_ble_color_gflags_Blink)) ;; + (25) ((g&=~_ble_color_gflags_Blink)) ;; + (8) ((g|=_ble_color_gflags_Invisible)) ;; + (28) ((g&=~_ble_color_gflags_Invisible)) ;; + (9) ((g|=_ble_color_gflags_Strike)) ;; + (29) ((g&=~_ble_color_gflags_Strike)) ;; + esac + fi + done +} +function ble/color/sgrspec2g { + local g=0 + ble/color/read-sgrspec "$1" + ret=$g +} +function ble/color/ansi2g { + local x=0 y=0 g=0 + ble/function#try ble/canvas/trace "$1" # -> ret + ret=$g +} +if [[ ! ${_ble_faces_count-} ]]; then # reload #D0875 + _ble_faces_count=0 + _ble_faces=() +fi +function ble/color/setface/.check-argument { + local rex='^[_a-zA-Z0-9]+$' + [[ $# == 2 && $1 =~ $rex && $2 ]] && return 0 + local flags=a + while (($#)); do + local arg=$1; shift + case $arg in + (--help) flags=H$flags ;; + (--color|--color=always) flags=c${flags//[ac]} ;; + (--color=auto) flags=a${flags//[ac]} ;; + (--color=never) flags=${flags//[ac]} ;; + (-*) + ble/util/print "${FUNCNAME[1]}: unrecognized option '$arg'." >&2 + flags=E$flags ;; + (*) + ble/util/print "${FUNCNAME[1]}: unrecognized argument '$arg'." >&2 + flags=E$flags ;; + esac + done + if [[ $flags == *E* ]]; then + ext=2; return 1 + elif [[ $flags == *H* ]]; then + ble/util/print-lines \ + "usage: $name FACE_NAME [TYPE:]SPEC" \ + ' Set face.' \ + '' \ + ' TYPE Specifies the format of SPEC. The following values are available.' \ + ' gspec Comma separated graphic attribute list' \ + ' g Integer value' \ + ' ref Face name or id (reference)' \ + ' copy Face name or id (copy value)' \ + ' sgrspec Parameters to the control function SGR' \ + ' ansi ANSI Sequences' >&2 + ext=0; return 1 + fi + local opts= + [[ $flags == *c* || $flags == *a* && -t 1 ]] && opts=$opts:color + ble/color/list-faces "$opts"; ext=$?; return 1 +} +function ble-color-defface { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local set shopt + [[ $_ble_bash_options_adjusted ]] || ble/base/.adjust-bash-options set shopt + if local ext; ble/color/setface/.check-argument "$@"; then + ble/color/defface "$@" + ext=$? + fi + [[ $_ble_bash_options_adjusted ]] || ble/base/.restore-bash-options set shopt + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" +} +function ble-color-setface { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local set shopt + [[ $_ble_bash_options_adjusted ]] || ble/base/.adjust-bash-options set shopt + if local ext; ble/color/setface/.check-argument "$@"; then + ble/color/setface "$@" + ext=$? + fi + [[ $_ble_bash_options_adjusted ]] || ble/base/.restore-bash-options set shopt + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return "$ext" +} +function ble/color/defface { local q=\' Q="'\''"; blehook color_defface_load+="ble/color/defface '${1//$q/$Q}' '${2//$q/$Q}'"; } +function ble/color/setface { local q=\' Q="'\''"; blehook color_setface_load+="ble/color/setface '${1//$q/$Q}' '${2//$q/$Q}'"; } +function ble/color/face2g { ble/color/initialize-faces && ble/color/face2g "$@"; } +function ble/color/face2sgr { ble/color/initialize-faces && ble/color/face2sgr "$@"; } +function ble/color/iface2g { ble/color/initialize-faces && ble/color/iface2g "$@"; } +function ble/color/iface2sgr { ble/color/initialize-faces && ble/color/iface2sgr "$@"; } +function ble/color/spec2g { ble/color/initialize-faces && ble/color/spec2g "$@"; } +function ble/color/face2sgr-ansi { ble/color/initialize-faces && ble/color/face2sgr "$@"; } +_ble_color_faces_initialized= +function ble/color/initialize-faces { + [[ $_ble_color_faces_initialized ]] && return 0 + local _ble_color_faces_initializing=1 + local -a _ble_color_faces_errors=() + function ble/color/face2g { + ((ret=_ble_faces[_ble_faces__$1])) + } + function ble/color/face2sgr { ble/color/g2sgr "$((_ble_faces[_ble_faces__$1]))"; } + function ble/color/face2sgr-ansi { ble/color/g2sgr-ansi "$((_ble_faces[_ble_faces__$1]))"; } + function ble/color/iface2g { + ((ret=_ble_faces[$1])) + } + function ble/color/iface2sgr { + ble/color/g2sgr "$((_ble_faces[$1]))" + } + function ble/color/spec2g { + ble/color/setface/.spec2gexpr "$@" prefix-face + ((ret=ret)) + } + function ble/color/setface/.spec2gexpr { + local spec=$1 value=${1#*:} opts=$2 + case $spec in + (gspec:*) ble/color/gspec2g "$value" ;; + (g:*) ret=$(($value)) ;; + (ref:*) + if [[ ! ${value//[0-9]} ]]; then + ret=_ble_faces[$((value))] + else + ret=_ble_faces[_ble_faces__$value] + fi ;; + (copy:*|face:*|iface:*) + [[ $spec == copy:* || $spec == face:* && :$opts: == *:prefix-face:* ]] || + ble/util/print "ble-face: \"${spec%%:*}:*\" is obsoleted. Use \"copy:*\" instead." >&2 + if [[ ! ${value//[0-9]} ]]; then + ble/color/iface2g "$value" + else + ble/color/face2g "$value" + fi ;; + (sgrspec:*) ble/color/sgrspec2g "$value" ;; + (ansi:*) ble/color/ansi2g "$value" ;; + (*) ble/color/gspec2g "$spec" ;; + esac + } + function ble/color/defface { + local name=_ble_faces__$1 spec=$2 ret + (($name)) && return 0 + (($name=++_ble_faces_count)) + ble/color/setface/.spec2gexpr "$spec" + _ble_faces[$name]=$ret + _ble_faces_def[$name]=$ret + } + function ble/color/setface { + local name=_ble_faces__$1 spec=$2 ret + if [[ ${!name} ]]; then + ble/color/setface/.spec2gexpr "$spec"; _ble_faces[$name]=$ret + else + local message="ble.sh: the specified face \`$1' is not defined." + if [[ $_ble_color_faces_initializing ]]; then + ble/array#push _ble_color_faces_errors "$message" + else + ble/util/print "$message" >&2 + fi + return 1 + fi + } + _ble_color_faces_initialized=1 + blehook/invoke color_defface_load + [[ $bleopt_color_scheme == default ]] || + bleopt/check:color_scheme/load "$bleopt_color_scheme" + blehook/invoke color_setface_load + blehook color_defface_load= + blehook color_setface_load= + if ((${#_ble_color_faces_errors[@]})); then + if ((_ble_edit_attached)) && [[ ! $_ble_textarea_invalidated && $_ble_term_state == internal ]]; then + IFS=$'\n' builtin eval 'local message="${_ble_color_faces_errors[*]}"' + ble/widget/print "$message" + else + printf '%s\n' "${_ble_color_faces_errors[@]}" >&2 + fi + return 1 + else + return 0 + fi +} +ble/function#try ble/util/idle.push ble/color/initialize-faces +function ble/color/list-faces { + local flags= + [[ :$1: == *:color:* ]] && flags=c + local ret sgr0= sgr1= sgr2= + if [[ $flags == *c* ]]; then + sgr0=$_ble_term_sgr0 + ble/color/face2sgr command_function; sgr1=$ret + ble/color/face2sgr syntax_varname; sgr2=$ret + fi + local key + for key in "${!_ble_faces__@}"; do + ble/color/face/.print-face "$key" + done +} +function ble/color/face/.read-arguments/process-set { + local o=$1 face=$2 value=$3 + if local rex='^[_a-zA-Z0-9@][_a-zA-Z0-9@]*$'; ! [[ $face =~ $rex ]]; then + ble/util/print "ble-face: invalid face name '$face'." >&2 + flags=E$flags + return 1 + elif [[ $o == '-d' && $face == *@* ]]; then + ble/util/print "ble-face: wildcards cannot be used in the face name '$face' for definition." >&2 + flags=E$flags + return 1 + fi + local assign='=' + [[ $o == -d ]] && assign=':=' + ble/array#push setface "$face$assign$value" +} +function ble/color/face/.read-arguments { + flags= setface=() print=() + local opt_color=auto + local args iarg narg=$#; args=("$@") + for ((iarg=0;iarg&2 + flags=E$flags + else + case $arg in + (--help) flags=H$flags ;; + (--color) + opt_color=always ;; + (--color=always|--color=auto|--color=never) + opt_color=${arg#*=} ;; + (--color=*) + ble/util/print "ble-face: '${arg#*=}': unrecognized option argument for '--color'." >&2 + flags=E$flags ;; + (--reset) flags=r$flags ;; + (--changed) flags=u$flags ;; + (--) flags=L$flags ;; + (--*) + ble/util/print "ble-face: unrecognized long option '$arg'." >&2 + flags=E$flags ;; + (-?*) + local i c + for ((i=1;i<${#arg};i++)); do + c=${arg:i:1} + case $c in + ([ru]) flags=$c$flags ;; + ([sd]) + if ((i+1<${#arg})); then + local lhs=${arg:i+1} + else + local lhs=${args[iarg++]} + fi + local rhs=${args[iarg++]} + if ((iarg>narg)); then + ble/util/print "ble-face: missing option argument for '-$c FACE SPEC'." >&2 + flags=E$flags + continue + fi + ble/color/face/.read-arguments/process-set "${arg::2}" "$lhs" "$rhs" + break ;; + (*) + ble/util/print "ble-face: unrecognized option '-$c'." >&2 + flags=E$flags ;; + esac + done ;; + (-) + ble/util/print "ble-face: unrecognized argument '$arg'." >&2 + flags=E$flags ;; + esac + fi + elif [[ $arg == *=* ]]; then + if local rex='^[_a-zA-Z@][_a-zA-Z0-9@]*:?='; [[ $arg =~ $rex ]]; then + ble/array#push setface "$arg" + else + local lhs=${arg%%=*}; lhs=${lhs%:} + ble/util/print "ble-face: invalid left-hand side '$lhs' ($arg)." >&2 + flags=E$flags + fi + else + if local rex='^[_a-zA-Z@][_a-zA-Z0-9@]*$'; [[ $arg =~ $rex ]]; then + ble/array#push print "$arg" + else + ble/util/print "ble-face: unrecognized form of argument '$arg'." >&2 + flags=E$flags + fi + fi + done + [[ $opt_color == auto && -t 1 || $opt_color == always ]] && flags=c$flags + [[ $flags != *E* ]] +} +function ble/color/face/.print-help { + ble/util/print-lines >&2 \ + 'ble-face --help' \ + 'ble-face [FACEPAT[:=|=][TYPE:]SPEC | -[sd] FACEPAT [TYPE:]SPEC]]...' \ + 'ble-face [-ur|--color[=WHEN]] [FACE...]' \ + '' \ + ' OPTIONS/ARGUMENTS' \ + '' \ + ' FACEPAT=[TYPE:]SPEC' \ + ' -s FACEPAT [TYPE:]SPEC' \ + ' Set a face. FACEPAT can include a wildcard @ which matches one or' \ + ' more characters.' \ + '' \ + ' FACE:=[TYPE:]SPEC' \ + ' -d FACE [TYPE:]SPEC' \ + ' Define a face' \ + '' \ + ' [-u | --color[=always|never|auto]]... FACEPAT...' \ + ' Print faces. If faces are not specified, all faces are selected.' \ + ' If -u is specified, only the faces with different values from their' \ + ' default will be printed. The option "--color" controls the output' \ + ' color settings. The default is "auto".' \ + '' \ + ' -r FACEPAT...' \ + ' Reset faces. If faces are not specified, all faces are selected.' \ + '' \ + ' FACEPAT Specifies a face name. The characters "@", "*", and "?" in the' \ + ' face name are treated as wildcards.' \ + '' \ + ' FACE Specifies a face name. The wildcards "@", "*", and "?" cannot be' \ + ' used.' \ + '' \ + ' TYPE Specifies the format of SPEC. The following values are available.' \ + ' gspec Comma separated graphic attribute list' \ + ' g Integer value' \ + ' ref Face name or id (reference)' \ + ' copy Face name or id (copy value)' \ + ' sgrspec Parameters to the control function SGR' \ + ' ansi ANSI Sequences' \ + '' + return 0 +} +function ble/color/face/.print-face { + local key=$1 ret + local name=${key#_ble_faces__} + local cur=${_ble_faces[key]} + if [[ $flags == *u* ]]; then + local def=_ble_faces_def[key] + [[ ${!def+set} && $cur == "${!def}" ]] && return 0 + fi + local def=${_ble_faces[key]} + if [[ $cur == '_ble_faces['*']' ]]; then + cur=${cur#'_ble_faces['} + cur=${cur%']'} + cur=ref:${cur#_ble_faces__} + else + ble/color/g2gspec "$((cur))"; cur=$ret + fi + if [[ $flags == *c* ]]; then + ble/color/iface2sgr "$((key))" + cur=$ret$cur$_ble_term_sgr0 + fi + printf '%s %s=%s\n' "${sgr1}ble-face$sgr0" "$sgr2$name$sgr0" "$cur" +} +function ble/color/face/.reset-face { + local key=$1 ret + [[ ${_ble_faces_def[key]+set} ]] && + _ble_faces[key]=${_ble_faces_def[key]} +} +function ble/color/face { + local set shopt reset= + if [[ ! $_ble_bash_options_adjusted ]]; then + ble/base/.adjust-bash-options set shopt + reset='ble/base/.restore-bash-options set shopt' + fi + local flags setface print + ble/color/face/.read-arguments "$@" + if [[ $flags == *H* ]]; then + ble/color/face/.print-help + builtin eval -- "$reset" + return 2 + elif [[ $flags == *E* ]]; then + builtin eval -- "$reset" + return 2 + fi + if ((!${#print[@]}&&!${#setface[@]})); then + print=('?@') + fi + ((${#print[@]})) && ble/color/initialize-faces + if [[ ! $_ble_color_faces_initialized ]]; then + local ret + ble/string#quote-command ble-face "${setface[@]}" + blehook color_setface_load+="$ret" + builtin eval -- "$reset" + return 0 + fi + local spec + for spec in "${setface[@]}"; do + if local rex='^([_a-zA-Z@*?][_a-zA-Z0-9@*?]*)(:?=)(.*)$'; ! [[ $spec =~ $rex ]]; then + ble/util/print "ble-face: unrecognized setting '$spec'" >&2 + flags=E$flags + continue + fi + local var=${BASH_REMATCH[1]} + local type=${BASH_REMATCH[2]} + local value=${BASH_REMATCH[3]} + if [[ $type == ':=' ]]; then + if [[ $var == *[@*?]* ]]; then + ble/util/print "ble-face: wildcards @*? cannot be used for face definition ($spec)." >&2 + flags=E$flags + else + ble/color/defface "$var" "$value" + fi + else + local ret face + if bleopt/expand-variable-pattern "_ble_faces__$var"; then + for face in "${ret[@]}"; do + ble/color/setface "${face#_ble_faces__}" "$value" + done + else + ble/util/print "ble-face: face '$var' not found" >&2 + flags=E$flags + fi + fi + done + if ((${#print[@]})); then + local ret sgr0= sgr1= sgr2= + if [[ $flags == *c* ]]; then + sgr0=$_ble_term_sgr0 + ble/color/face2sgr command_function; sgr1=$ret + ble/color/face2sgr syntax_varname; sgr2=$ret + fi + local spec + for spec in "${print[@]}"; do + local ret face + if bleopt/expand-variable-pattern "_ble_faces__$spec"; then + if [[ $flags == *r* ]]; then + for face in "${ret[@]}"; do + ble/color/face/.reset-face "$face" + done + else + for face in "${ret[@]}"; do + ble/color/face/.print-face "$face" + done + fi + else + ble/util/print "ble-face: face '$spec' not found" >&2 + flags=E$flags + fi + done + fi + [[ $flags != *E* ]] + local ext=$? + builtin eval -- "$reset" + return "$ext" +} +function ble-face { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/color/face "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function bleopt/check:color_scheme/error { + if [[ $_ble_color_faces_initializing ]]; then + ble/array#push _ble_color_faces_errors "$1" + else + ble/util/print "$1" >&2 + fi +} +function bleopt/check:color_scheme/load { + if ! ble-import "contrib/scheme/$1"; then + bleopt/check:color_scheme/error "bleopt: The specified scheme '$1' not found." + return 1 + fi + local init=ble/contrib/scheme:$1/initialize + if ! ble/is-function "$init"; then + bleopt/check:color_scheme/error "bleopt: scheme=$1: The function '$init' not found." + return 1 + fi + "$init" +} +bleopt/declare -n color_scheme 'default' +function bleopt/check:color_scheme { + if [[ ! $_ble_color_faces_initialized ]]; then + local ret + if ! ble/util/import/search "contrib/scheme/$value"; then + ble/util/print "bleopt: The file for the specified scheme '$value' not found." >&2 + return 1 + fi + return 0 + fi + bleopt/check:color_scheme/load "$value" +} +_ble_highlight_layer_list=(plain) +function ble/highlight/layer/update { + local text=$1 iN=${#1} opts=$2 + local DMIN=${3:-0} DMAX=${4:-$iN} DMAX0=${5:-0} + local PREV_BUFF=_ble_highlight_layer_plain_buff + local PREV_UMIN=-1 + local PREV_UMAX=-1 + local layer player=plain LEVEL + local nlevel=${#_ble_highlight_layer_list[@]} + for ((LEVEL=0;LEVELumin)&&(PREV_UMIN=umin), + (PREV_UMAX<0||PREV_UMAX=0)); then + ble/array#reserve-prototype "$((DMAX-DMIN))" + builtin eval " + $_ble_local_dstarr=( + \"\${$_ble_local_srcarr[@]::DMIN}\" + \"\${_ble_array_prototype[@]::DMAX-DMIN}\" + \"\${$_ble_local_srcarr[@]:DMAX0}\")" + else + [[ $_ble_local_dstarr != "$_ble_local_srcarr" ]] && + builtin eval -- "$_ble_local_dstarr=(\"\${$_ble_local_srcarr[@]}\")" + fi +} +function ble/highlight/layer/update/getg { + g= + local LEVEL=$LEVEL + while ((--LEVEL>=0)); do + ble/highlight/layer:"${_ble_highlight_layer_list[LEVEL]}"/getg "$1" + [[ $g ]] && return 0 + done + g=0 +} +function ble/highlight/layer/getg { + LEVEL=${#_ble_highlight_layer_list[*]} ble/highlight/layer/update/getg "$1" +} +_ble_highlight_layer_plain_VARNAMES=( + _ble_highlight_layer_plain_buff) +function ble/highlight/layer:plain/initialize-vars { + _ble_highlight_layer_plain_buff=() +} +ble/highlight/layer:plain/initialize-vars +function ble/highlight/layer:plain/update/.getch { + [[ $ch == [' '-'~'] ]] && return 0 + if [[ $ch == [$'\t\n\177'] ]]; then + if [[ $ch == $'\t' ]]; then + ch=${_ble_string_prototype::it} + elif [[ $ch == $'\n' ]]; then + ch=$_ble_term_el$_ble_term_nl + elif [[ $ch == $'\177' ]]; then + ch='^?' + fi + else + local ret + ble/util/s2c "$ch" + ble/unicode/GraphemeCluster/ControlRepresentation "$ret" && ch=$ret + fi +} +function ble/highlight/layer:plain/update { + if ((DMIN>=0)); then + ble/highlight/layer/update/shift _ble_highlight_layer_plain_buff + local i text=$1 ch + local it=${bleopt_tab_width:-$_ble_term_it} + for ((i=DMIN;ip)&&(umin=p), + (umax<0||umax=0)); then + local k + for ((k=0;k=2&&sel[0]<=PREV_UMIN&&PREV_UMAX<=sel[1]))); then + if [[ ${sel[*]} == "${osel[*]}" && ${gflags[*]} == "${ogflags[*]}" ]]; then + [[ ${sel[*]} ]] && PREV_BUFF=${layer_prefix}buff + return 0 + fi + else + [[ ! ${sel[*]} && ! ${osel[*]} ]] && return 0 + fi + local umin=-1 umax=-1 + if ((rlen)); then + local rmin=${sel[0]} + local rmax=${sel[rlen-1]} + local -a buff=() + local g ret + local k=0 inext iprev=0 + for inext in "${sel[@]}"; do + if ((inext>iprev)); then + if ((k==0)); then + ble/array#push buff "\"\${$PREV_BUFF[@]::$inext}\"" + elif ((k%2)); then + ble/color/g2sgr "${gflags[k/2]}" + ble/array#push buff "\"$ret\${_ble_highlight_layer_plain_buff[@]:$iprev:$((inext-iprev))}\"" + else + ble/highlight/layer/update/getg "$iprev" + ble/color/g2sgr "$g" + ble/array#push buff "\"$ret\${$PREV_BUFF[@]:$iprev:$((inext-iprev))}\"" + fi + fi + ((iprev=inext,k++)) + done + ble/highlight/layer/update/getg "$iprev" + ble/color/g2sgr "$g" + ble/array#push buff "\"$ret\${$PREV_BUFF[@]:$iprev}\"" + builtin eval -- "${layer_prefix}buff=(${buff[*]})" + PREV_BUFF=${layer_prefix}buff + if ((DMIN>=0)); then + ble/highlight/layer:{selection}/.invalidate "$DMIN" "$DMAX" + fi + if ((olen==2&&rlen==2)); then + if [[ ${gflags[0]} != "${ogflags[0]}" ]]; then + ble/highlight/layer:{selection}/.invalidate "$omin" "$omax" + ble/highlight/layer:{selection}/.invalidate "$rmin" "$rmax" + else + ble/highlight/layer:{selection}/.invalidate "$omin" "$rmin" + ble/highlight/layer:{selection}/.invalidate "$omax" "$rmax" + fi + elif ((omin>=0)); then + local k m + local min_len=$((olenrlen?olen:rlen)) + for ((k=0;kosel[oind]?sel[rind]:osel[oind])) + ((smin=0;k-=2)); do + if ((sel[k+1]=4)); then + local l=0 u=$((olen-1)) m + local L='osel[m=(l+u)/2]<=index?(l=m):(u=m),L[l+1>=u]' + ((l+1_ble_edit_ind)); then + selection=("$_ble_edit_ind" "$_ble_edit_mark") + elif ((_ble_edit_mark<_ble_edit_ind)); then + selection=("$_ble_edit_mark" "$_ble_edit_ind") + fi + fi + sel=("${selection[@]}") + local nsel=$((${#sel[@]}/2)) + local face=region + ble/function#try ble/highlight/layer:region/mark:"$_ble_edit_mark_active"/get-face + face=("${face[@]::nsel}") + local f ret + for f in "${face[@]}"; do + ble/color/face2g "$f" + ble/array#push gflags "$ret" + done + if ((${#gflags[@]}=0)) || [[ ! $_ble_highlight_layer_disabled_prev ]]; then + local ret; ble/color/face2sgr disabled; local sgr=$ret + _ble_highlight_layer_disabled_buff=("$sgr""${_ble_highlight_layer_plain_buff[@]}") + fi + PREV_BUFF=_ble_highlight_layer_disabled_buff + if [[ $_ble_highlight_layer_disabled_prev ]]; then + PREV_UMIN=$DMIN PREV_UMAX=$DMAX + else + PREV_UMIN=0 PREV_UMAX=${#1} + fi + else + if [[ $_ble_highlight_layer_disabled_prev ]]; then + PREV_UMIN=0 PREV_UMAX=${#1} + fi + fi + _ble_highlight_layer_disabled_prev=$_ble_edit_line_disabled +} +function ble/highlight/layer:disabled/getg { + if [[ $_ble_highlight_layer_disabled_prev ]]; then + local ret; ble/color/face2g disabled; g=$ret + fi +} +_ble_highlight_layer_overwrite_mode_VARNAMES=( + _ble_highlight_layer_overwrite_mode_index + _ble_highlight_layer_overwrite_mode_buff) +function ble/highlight/layer:overwrite_mode/initialize-vars { + _ble_highlight_layer_overwrite_mode_index=-1 + _ble_highlight_layer_overwrite_mode_buff=() +} +ble/highlight/layer:overwrite_mode/initialize-vars +function ble/highlight/layer:overwrite_mode/update { + local oindex=$_ble_highlight_layer_overwrite_mode_index + if ((DMIN>=0)); then + if ((oindex>=DMAX0)); then + ((oindex+=DMAX-DMAX0)) + elif ((oindex>=DMIN)); then + oindex=-1 + fi + fi + local index=-1 + if [[ $_ble_edit_overwrite_mode && ! $_ble_edit_mark_active ]]; then + local next=${_ble_edit_str:_ble_edit_ind:1} + if [[ $next && $next != [$'\n\t'] ]]; then + index=$_ble_edit_ind + local g ret + if ((PREV_UMIN<0&&oindex>=0)); then + ble/highlight/layer/update/getg "$oindex" + ble/color/g2sgr "$g" + _ble_highlight_layer_overwrite_mode_buff[oindex]=$ret${_ble_highlight_layer_plain_buff[oindex]} + else + builtin eval "_ble_highlight_layer_overwrite_mode_buff=(\"\${$PREV_BUFF[@]}\")" + fi + PREV_BUFF=_ble_highlight_layer_overwrite_mode_buff + ble/color/face2g overwrite_mode + ble/color/g2sgr "$ret" + _ble_highlight_layer_overwrite_mode_buff[index]=$ret${_ble_highlight_layer_plain_buff[index]} + if ((index+1<${#1})); then + ble/highlight/layer/update/getg "$((index+1))" + ble/color/g2sgr "$g" + _ble_highlight_layer_overwrite_mode_buff[index+1]=$ret${_ble_highlight_layer_plain_buff[index+1]} + fi + fi + fi + if ((index>=0)); then + ble/term/cursor-state/hide + else + ble/term/cursor-state/reveal + fi + if ((index!=oindex)); then + ((oindex>=0)) && ble/highlight/layer/update/add-urange "$oindex" "$((oindex+1))" + ((index>=0)) && ble/highlight/layer/update/add-urange "$index" "$((index+1))" + fi + _ble_highlight_layer_overwrite_mode_index=$index +} +function ble/highlight/layer:overwrite_mode/getg { + local index=$_ble_highlight_layer_overwrite_mode_index + if ((index>=0&&index==$1)); then + local ret; ble/color/face2g overwrite_mode; g=$ret + fi +} +_ble_highlight_layer_list=(plain syntax region overwrite_mode disabled) +bleopt/declare -v tab_width '' +function bleopt/check:tab_width { + local old_width=${bleopt_tab_width:-$_ble_term_it} + if [[ $value ]] && (((value=value)<=0)); then + ble/util/print "bleopt: an empty string or a positive value is required for tab_width." >&2 + return 1 + fi + if ((value!=old_width)); then + local ret + if ble/string#index-of "$_ble_edit_str" $'\t'; then + local beg=$ret + ble/string#last-index-of "$_ble_edit_str" $'\t' + ble-edit/content/.update-dirty-range "$beg" "$ret" "$ret" tab_width + fi + fi +} +function ble/arithmetic/sum { + IFS=+ builtin eval 'let "ret=$*+0"' +} +_ble_util_c2w=() +_ble_util_c2w_cache=() +function ble/util/c2w/clear-cache { + _ble_util_c2w_cache=() +} +bleopt/declare -n char_width_mode auto +function bleopt/check:char_width_mode { + if ! ble/is-function ble/util/c2w:"$value"; then + ble/util/print "bleopt: Invalid value char_width_mode='$value'. A function 'ble/util/c2w:$value' is not defined." >&2 + return 1 + fi + case $value in + (auto) + _ble_unicode_c2w_ambiguous=1 + ble && ble/util/c2w:auto/test.buff first-line ;; + (west) _ble_unicode_c2w_ambiguous=1 ;; + (east) _ble_unicode_c2w_ambiguous=2 ;; + esac + ((_ble_prompt_version++)) + ble/util/c2w/clear-cache +} +function ble/util/c2w { + ret=${_ble_util_c2w_cache[$1]:-${_ble_util_c2w[$1]}} + if [[ ! $ret ]]; then + ble/util/c2w:"$bleopt_char_width_mode" "$1" + _ble_util_c2w_cache[$1]=$ret + fi +} +function ble/util/c2w-edit { + if ble/unicode/GraphemeCluster/ControlRepresentation "$1"; then + ret=${#ret} + else + ble/util/c2w "$1" + fi +} +function ble/util/s2w-edit { + local text=$1 iN=${#1} flags=$2 i + ret=0 + for ((i=0;i&2 + return 1 + fi +} +_ble_unicode_c2w_custom[173]=1 # U+00ad Cf A SHY(soft-hyphen) +let '_ble_unicode_c2w_custom['{1536..1541}']=1' # U+0600..0605 Cf 1 アラブの数字? +_ble_unicode_c2w_custom[1757]=1 # U+06dd Cf 1 ARABIC END OF AYAH +_ble_unicode_c2w_custom[1807]=1 # U+070f Cf 1 SYRIAC ABBREVIATION MARK +_ble_unicode_c2w_custom[2274]=1 # U+08e2 Cf 1 ARABIC DISPUTED END OF AYAH +_ble_unicode_c2w_custom[69821]=1 # U+110bd Cf 1 KAITHI NUMBER SIGN +_ble_unicode_c2w_custom[69837]=1 # U+110cd Cf 1 KAITHI NUMBER SIGN ABOVE +let '_ble_unicode_c2w_custom['{12872..12879}']=2' # U+3248..324f No A 囲み文字10-80 (8字) +let '_ble_unicode_c2w_custom['{19904..19967}']=2' # U+4dc0..4dff So 1 易経記号 (6字) +let '_ble_unicode_c2w_custom['{4448..4607}']=0' # U+1160..11ff Lo 1 HANGUL JAMO (160字) +let '_ble_unicode_c2w_custom['{55216..55238}']=0' # U+d7b0..d7c6 Lo 1 HANGUL JAMO EXTENDED-B (1) (23字) +let '_ble_unicode_c2w_custom['{55243..55291}']=0' # U+d7cb..d7fb Lo 1 HANGUL JAMO EXTENDED-B (2) (49字) +function ble/unicode/c2w { + local c=$1 + ret=${_ble_unicode_c2w_custom[c]} + [[ $ret ]] && return 0 + ret=${_ble_unicode_c2w[c]} + if [[ ! $ret ]]; then + ret=${_ble_unicode_c2w_index[c<0x20000?c>>8:((c>>12)-32+512)]} + if [[ $ret == *:* ]]; then + local l=${ret%:*} u=${ret#*:} m + local L='_ble_unicode_c2w_ranges[m=(l+u)/2]<=c?(l=m):(u=m),L[l+1>=u]' + ((l+1&2 + return 1 + else + ble/util/print "bleopt: Unsupported emoji_version: '$value'." >&2 + return 1 + fi + fi + _ble_unicode_EmojiStatus_version=$ret + ((_ble_prompt_version++)) + ble/util/c2w/clear-cache + return 0 +} +function bleopt/check:emoji_width { ble/util/c2w/clear-cache; } +_ble_unicode_EmojiStatus_xIsEmoji='ret&&ret!=_ble_unicode_EmojiStatus_Unqualified' +function bleopt/check:emoji_opts { + _ble_unicode_EmojiStatus_xIsEmoji='ret' + [[ :$value: != *:unqualified:* ]] && + _ble_unicode_EmojiStatus_xIsEmoji=$_ble_unicode_EmojiStatus_xIsEmoji'&&ret!=_ble_unicode_EmojiStatus_Unqualified' + ble/string#match ":$value:" ':min=^U\+([0-9a-fA-F]+):' && + _ble_unicode_EmojiStatus_xIsEmoji=$_ble_unicode_EmojiStatus_xIsEmoji'&&code>=0x'${BASH_REMATCH[1]} + ((_ble_prompt_version++)) + ble/util/c2w/clear-cache + return 0 +} +function ble/unicode/EmojiStatus { + local code=$1 V=$_ble_unicode_EmojiStatus_version + ret=${_ble_unicode_EmojiStatus[code]} + if [[ ! $ret ]]; then + ret=$_ble_unicode_EmojiStatus_None + if ((_ble_unicode_EmojiStatus_xmaybe)); then + local l=0 u=${#_ble_unicode_EmojiStatus_ranges[@]} m + local L='_ble_unicode_EmojiStatus_ranges[m=(l+u)/2]<=code?(l=m):(u=m),L[l+1>=u]' + ((l+1=0x80?2:1 + ):(ah==0x2f?( + ret=2 + ):(ah==0x30?( + ret=al!=0x3f?2:1 + ):(ah==0xf9||ah==0xfa?( + ret=2 + ):(ah==0xfe?( + ret=0x30<=al&&al<0x70?2:1 + ):(ah==0xff?( + ret=0x01<=al&&al<0x61||0xE0<=al&&al<=0xE7?2:1 + ):(ret=1)))))))))) + )) + )) + [[ $tIndex ]] || return 0 + if ((tIndex<_ble_util_c2w_emacs_wranges[0])); then + ret=1 + return 0 + fi + local l=0 u=${#_ble_util_c2w_emacs_wranges[@]} m + local L='_ble_util_c2w_emacs_wranges[m=(l+u)/2]<=tIndex?(l=m):(u=m),L[l+1>=u]' + ((l+1&2 + return 1 ;; + esac +} +_ble_unicode_GraphemeClusterBreak_Count=18 +_ble_unicode_GraphemeClusterBreak_Other=0 +_ble_unicode_GraphemeClusterBreak_Control=1 +_ble_unicode_GraphemeClusterBreak_ZWJ=2 +_ble_unicode_GraphemeClusterBreak_Prepend=3 +_ble_unicode_GraphemeClusterBreak_Extend=4 +_ble_unicode_GraphemeClusterBreak_SpacingMark=5 +_ble_unicode_GraphemeClusterBreak_Regional_Indicator=6 +_ble_unicode_GraphemeClusterBreak_L=7 +_ble_unicode_GraphemeClusterBreak_V=8 +_ble_unicode_GraphemeClusterBreak_T=9 +_ble_unicode_GraphemeClusterBreak_LV=10 +_ble_unicode_GraphemeClusterBreak_LVT=11 +_ble_unicode_GraphemeClusterBreak_Pictographic=12 +_ble_unicode_GraphemeClusterBreak_HighSurrogate=13 +_ble_unicode_GraphemeClusterBreak_LowSurrogate=14 +_ble_unicode_GraphemeClusterBreak_InCB_Consonant=15 +_ble_unicode_GraphemeClusterBreak_InCB_Linker=16 +_ble_unicode_GraphemeClusterBreak_InCB_Extend=17 +_ble_unicode_GraphemeClusterBreak_MaxCode=921600 +_ble_unicode_GraphemeClusterBreak=( + [169]=12 [173]=1 [174]=12 [1470]=0 [1471]=17 [1472]=0 [1473]=17 [1474]=17 [1475]=0 [1476]=17 [1477]=17 [1478]=0 [1479]=17 [1563]=0 [1564]=1 [1648]=17 + [1757]=3 [1758]=0 [1765]=0 [1766]=0 [1767]=17 [1768]=17 [1769]=0 [1807]=3 [1808]=0 [1809]=17 [2045]=17 [2074]=0 [2084]=0 [2088]=0 [2192]=3 [2193]=3 + [2274]=3 [2307]=5 [2362]=17 [2363]=5 [2364]=17 [2365]=0 [2381]=16 [2382]=5 [2383]=5 [2384]=0 [2400]=0 [2401]=0 [2402]=17 [2403]=17 [2432]=0 [2433]=17 + [2434]=5 [2435]=5 [2473]=0 [2481]=0 [2482]=15 [2490]=0 [2491]=0 [2492]=17 [2493]=0 [2494]=17 [2495]=5 [2496]=5 [2501]=0 [2502]=0 [2503]=5 [2504]=5 + [2505]=0 [2506]=0 [2507]=5 [2508]=5 [2509]=16 [2519]=17 [2524]=15 [2525]=15 [2526]=0 [2527]=15 [2528]=0 [2529]=0 [2530]=17 [2531]=17 [2544]=15 [2545]=15 + [2558]=17 [2559]=0 [2560]=0 [2561]=17 [2562]=17 [2563]=5 [2620]=17 [2621]=0 [2625]=17 [2626]=17 [2631]=17 [2632]=17 [2633]=0 [2634]=0 [2641]=17 [2672]=17 + [2673]=17 [2677]=17 [2689]=17 [2690]=17 [2691]=5 [2729]=0 [2737]=0 [2738]=15 [2739]=15 [2740]=0 [2746]=0 [2747]=0 [2748]=17 [2749]=0 [2758]=0 [2759]=17 + [2760]=17 [2761]=5 [2762]=0 [2763]=5 [2764]=5 [2765]=16 [2786]=17 [2787]=17 [2809]=15 [2816]=0 [2817]=17 [2818]=5 [2819]=5 [2857]=0 [2865]=0 [2866]=15 + [2867]=15 [2868]=0 [2874]=0 [2875]=0 [2876]=17 [2877]=0 [2878]=17 [2879]=17 [2880]=5 [2885]=0 [2886]=0 [2887]=5 [2888]=5 [2889]=0 [2890]=0 [2891]=5 + [2892]=5 [2893]=16 [2908]=15 [2909]=15 [2910]=0 [2911]=15 [2912]=0 [2913]=0 [2914]=17 [2915]=17 [2929]=15 [2946]=17 [3006]=17 [3007]=5 [3008]=17 [3009]=5 + [3010]=5 [3017]=0 [3021]=17 [3031]=17 [3072]=17 [3076]=17 [3113]=0 [3130]=0 [3131]=0 [3132]=17 [3133]=0 [3141]=0 [3145]=0 [3149]=16 [3157]=17 [3158]=17 + [3159]=0 [3170]=17 [3171]=17 [3201]=17 [3202]=5 [3203]=5 [3260]=17 [3261]=0 [3262]=5 [3263]=17 [3264]=17 [3265]=5 [3266]=17 [3267]=5 [3268]=5 [3269]=0 + [3273]=0 [3285]=17 [3286]=17 [3298]=17 [3299]=17 [3315]=5 [3328]=17 [3329]=17 [3330]=5 [3331]=5 [3387]=17 [3388]=17 [3389]=0 [3390]=17 [3391]=5 [3392]=5 + [3397]=0 [3401]=0 [3405]=16 [3406]=3 [3415]=17 [3426]=17 [3427]=17 [3457]=17 [3458]=5 [3459]=5 [3530]=17 [3535]=17 [3536]=5 [3537]=5 [3541]=0 [3542]=17 + [3543]=0 [3551]=17 [3570]=5 [3571]=5 [3633]=17 [3634]=0 [3635]=5 [3761]=17 [3762]=0 [3763]=5 [3864]=17 [3865]=17 [3893]=17 [3894]=0 [3895]=17 [3896]=0 + [3897]=17 [3902]=5 [3903]=5 [3967]=5 [3973]=0 [3974]=17 [3975]=17 [3992]=0 [4038]=17 [4145]=5 [4152]=0 [4153]=17 [4154]=17 [4155]=5 [4156]=5 [4157]=17 + [4158]=17 [4182]=5 [4183]=5 [4184]=17 [4185]=17 [4226]=17 [4227]=0 [4228]=5 [4229]=17 [4230]=17 [4237]=17 [4253]=17 [5970]=17 [5971]=17 [6002]=17 [6003]=17 + [6068]=17 [6069]=17 [6070]=5 [6086]=17 [6087]=5 [6088]=5 [6109]=17 [6158]=1 [6159]=17 [6277]=17 [6278]=17 [6313]=17 [6439]=17 [6440]=17 [6448]=5 [6449]=5 + [6450]=17 [6679]=17 [6680]=17 [6681]=5 [6682]=5 [6683]=17 [6741]=5 [6742]=17 [6743]=5 [6751]=0 [6752]=17 [6753]=0 [6754]=17 [6755]=0 [6756]=0 [6781]=0 + [6782]=0 [6783]=17 [6916]=5 [7040]=17 [7041]=17 [7042]=5 [7073]=5 [7078]=5 [7079]=5 [7142]=17 [7143]=5 [7144]=17 [7145]=17 [7149]=17 [7150]=5 [7220]=5 + [7221]=5 [7222]=17 [7223]=17 [7379]=0 [7393]=5 [7405]=17 [7412]=17 [7413]=0 [7414]=0 [7415]=5 [7416]=17 [7417]=17 [8203]=1 [8204]=4 [8205]=2 [8206]=1 + [8207]=1 [8252]=12 [8265]=12 [8482]=12 [8505]=12 [8617]=12 [8618]=12 [8986]=12 [8987]=12 [9000]=12 [9096]=12 [9167]=12 [9410]=12 [9642]=12 [9643]=12 [9654]=12 + [9664]=12 [9727]=0 [9734]=0 [9747]=0 [9990]=0 [9991]=0 [10003]=0 [10004]=12 [10005]=0 [10006]=12 [10013]=12 [10017]=12 [10024]=12 [10035]=12 [10036]=12 [10052]=12 + [10053]=0 [10054]=0 [10055]=12 [10060]=12 [10061]=0 [10062]=12 [10070]=0 [10071]=12 [10145]=12 [10160]=12 [10175]=12 [10548]=12 [10549]=12 [11035]=12 [11036]=12 [11088]=12 + [11093]=12 [11647]=17 [12336]=12 [12349]=12 [12441]=17 [12442]=17 [12951]=12 [12952]=0 [12953]=12 [42611]=0 [42654]=17 [42655]=17 [42736]=17 [42737]=17 [43010]=17 [43014]=17 + [43019]=17 [43043]=5 [43044]=5 [43045]=17 [43046]=17 [43047]=5 [43052]=17 [43136]=5 [43137]=5 [43204]=17 [43205]=17 [43263]=17 [43346]=5 [43347]=17 [43395]=5 [43443]=17 + [43444]=5 [43445]=5 [43450]=5 [43451]=5 [43452]=17 [43453]=17 [43454]=5 [43455]=5 [43456]=17 [43493]=17 [43567]=5 [43568]=5 [43569]=17 [43570]=17 [43571]=5 [43572]=5 + [43573]=17 [43574]=17 [43587]=17 [43596]=17 [43597]=5 [43644]=17 [43696]=17 [43697]=0 [43701]=0 [43702]=0 [43703]=17 [43704]=17 [43710]=17 [43711]=17 [43712]=0 [43713]=17 + [43755]=5 [43756]=17 [43757]=17 [43758]=5 [43759]=5 [43765]=5 [43766]=17 [44003]=5 [44004]=5 [44005]=17 [44006]=5 [44007]=5 [44008]=17 [44009]=5 [44010]=5 [44011]=0 + [44012]=5 [44013]=17 [44032]=10 [44060]=10 [44088]=10 [44116]=10 [44144]=10 [44172]=10 [44200]=10 [44228]=10 [44256]=10 [44284]=10 [44312]=10 [44340]=10 [44368]=10 [44396]=10 + [44424]=10 [44452]=10 [44480]=10 [44508]=10 [44536]=10 [44564]=10 [44592]=10 [44620]=10 [44648]=10 [44676]=10 [44704]=10 [44732]=10 [44760]=10 [44788]=10 [44816]=10 [44844]=10 + [44872]=10 [44900]=10 [44928]=10 [44956]=10 [44984]=10 [45012]=10 [45040]=10 [45068]=10 [45096]=10 [45124]=10 [45152]=10 [45180]=10 [45208]=10 [45236]=10 [45264]=10 [45292]=10 + [45320]=10 [45348]=10 [45376]=10 [45404]=10 [45432]=10 [45460]=10 [45488]=10 [45516]=10 [45544]=10 [45572]=10 [45600]=10 [45628]=10 [45656]=10 [45684]=10 [45712]=10 [45740]=10 + [45768]=10 [45796]=10 [45824]=10 [45852]=10 [45880]=10 [45908]=10 [45936]=10 [45964]=10 [45992]=10 [46020]=10 [46048]=10 [46076]=10 [46104]=10 [46132]=10 [46160]=10 [46188]=10 + [46216]=10 [46244]=10 [46272]=10 [46300]=10 [46328]=10 [46356]=10 [46384]=10 [46412]=10 [46440]=10 [46468]=10 [46496]=10 [46524]=10 [46552]=10 [46580]=10 [46608]=10 [46636]=10 + [46664]=10 [46692]=10 [46720]=10 [46748]=10 [46776]=10 [46804]=10 [46832]=10 [46860]=10 [46888]=10 [46916]=10 [46944]=10 [46972]=10 [47000]=10 [47028]=10 [47056]=10 [47084]=10 + [47112]=10 [47140]=10 [47168]=10 [47196]=10 [47224]=10 [47252]=10 [47280]=10 [47308]=10 [47336]=10 [47364]=10 [47392]=10 [47420]=10 [47448]=10 [47476]=10 [47504]=10 [47532]=10 + [47560]=10 [47588]=10 [47616]=10 [47644]=10 [47672]=10 [47700]=10 [47728]=10 [47756]=10 [47784]=10 [47812]=10 [47840]=10 [47868]=10 [47896]=10 [47924]=10 [47952]=10 [47980]=10 + [48008]=10 [48036]=10 [48064]=10 [48092]=10 [48120]=10 [48148]=10 [48176]=10 [48204]=10 [48232]=10 [48260]=10 [48288]=10 [48316]=10 [48344]=10 [48372]=10 [48400]=10 [48428]=10 + [48456]=10 [48484]=10 [48512]=10 [48540]=10 [48568]=10 [48596]=10 [48624]=10 [48652]=10 [48680]=10 [48708]=10 [48736]=10 [48764]=10 [48792]=10 [48820]=10 [48848]=10 [48876]=10 + [48904]=10 [48932]=10 [48960]=10 [48988]=10 [49016]=10 [49044]=10 [49072]=10 [49100]=10 [49128]=10 [49156]=10 [49184]=10 [49212]=10 [49240]=10 [49268]=10 [49296]=10 [49324]=10 + [49352]=10 [49380]=10 [49408]=10 [49436]=10 [49464]=10 [49492]=10 [49520]=10 [49548]=10 [49576]=10 [49604]=10 [49632]=10 [49660]=10 [49688]=10 [49716]=10 [49744]=10 [49772]=10 + [49800]=10 [49828]=10 [49856]=10 [49884]=10 [49912]=10 [49940]=10 [49968]=10 [49996]=10 [50024]=10 [50052]=10 [50080]=10 [50108]=10 [50136]=10 [50164]=10 [50192]=10 [50220]=10 + [50248]=10 [50276]=10 [50304]=10 [50332]=10 [50360]=10 [50388]=10 [50416]=10 [50444]=10 [50472]=10 [50500]=10 [50528]=10 [50556]=10 [50584]=10 [50612]=10 [50640]=10 [50668]=10 + [50696]=10 [50724]=10 [50752]=10 [50780]=10 [50808]=10 [50836]=10 [50864]=10 [50892]=10 [50920]=10 [50948]=10 [50976]=10 [51004]=10 [51032]=10 [51060]=10 [51088]=10 [51116]=10 + [51144]=10 [51172]=10 [51200]=10 [51228]=10 [51256]=10 [51284]=10 [51312]=10 [51340]=10 [51368]=10 [51396]=10 [51424]=10 [51452]=10 [51480]=10 [51508]=10 [51536]=10 [51564]=10 + [51592]=10 [51620]=10 [51648]=10 [51676]=10 [51704]=10 [51732]=10 [51760]=10 [51788]=10 [51816]=10 [51844]=10 [51872]=10 [51900]=10 [51928]=10 [51956]=10 [51984]=10 [52012]=10 + [52040]=10 [52068]=10 [52096]=10 [52124]=10 [52152]=10 [52180]=10 [52208]=10 [52236]=10 [52264]=10 [52292]=10 [52320]=10 [52348]=10 [52376]=10 [52404]=10 [52432]=10 [52460]=10 + [52488]=10 [52516]=10 [52544]=10 [52572]=10 [52600]=10 [52628]=10 [52656]=10 [52684]=10 [52712]=10 [52740]=10 [52768]=10 [52796]=10 [52824]=10 [52852]=10 [52880]=10 [52908]=10 + [52936]=10 [52964]=10 [52992]=10 [53020]=10 [53048]=10 [53076]=10 [53104]=10 [53132]=10 [53160]=10 [53188]=10 [53216]=10 [53244]=10 [53272]=10 [53300]=10 [53328]=10 [53356]=10 + [53384]=10 [53412]=10 [53440]=10 [53468]=10 [53496]=10 [53524]=10 [53552]=10 [53580]=10 [53608]=10 [53636]=10 [53664]=10 [53692]=10 [53720]=10 [53748]=10 [53776]=10 [53804]=10 + [53832]=10 [53860]=10 [53888]=10 [53916]=10 [53944]=10 [53972]=10 [54000]=10 [54028]=10 [54056]=10 [54084]=10 [54112]=10 [54140]=10 [54168]=10 [54196]=10 [54224]=10 [54252]=10 + [54280]=10 [54308]=10 [54336]=10 [54364]=10 [54392]=10 [54420]=10 [54448]=10 [54476]=10 [54504]=10 [54532]=10 [54560]=10 [54588]=10 [54616]=10 [54644]=10 [54672]=10 [54700]=10 + [54728]=10 [54756]=10 [54784]=10 [54812]=10 [54840]=10 [54868]=10 [54896]=10 [54924]=10 [54952]=10 [54980]=10 [55008]=10 [55036]=10 [55064]=10 [55092]=10 [55120]=10 [55148]=10 + [55176]=10 [64286]=17 [65279]=1 [65438]=17 [65439]=17 [66045]=17 [66272]=17 [68100]=0 [68101]=17 [68102]=17 [68159]=17 [68325]=17 [68326]=17 [69291]=17 [69292]=17 [69632]=5 + [69633]=17 [69634]=5 [69744]=17 [69745]=0 [69746]=0 [69747]=17 [69748]=17 [69762]=5 [69815]=5 [69816]=5 [69817]=17 [69818]=17 [69819]=0 [69820]=0 [69821]=3 [69826]=17 + [69837]=3 [69932]=5 [69957]=5 [69958]=5 [70003]=17 [70016]=17 [70017]=17 [70018]=5 [70079]=5 [70080]=17 [70081]=0 [70082]=3 [70083]=3 [70093]=0 [70094]=5 [70095]=17 + [70194]=5 [70195]=5 [70206]=17 [70207]=0 [70208]=0 [70209]=17 [70367]=17 [70400]=17 [70401]=17 [70402]=5 [70403]=5 [70459]=17 [70460]=17 [70461]=0 [70462]=17 [70463]=5 + [70464]=17 [70469]=0 [70470]=0 [70471]=5 [70472]=5 [70473]=0 [70474]=0 [70475]=5 [70476]=5 [70477]=17 [70487]=17 [70498]=5 [70499]=5 [70500]=0 [70501]=0 [70584]=17 + [70585]=5 [70586]=5 [70593]=0 [70594]=17 [70595]=0 [70596]=0 [70597]=17 [70598]=0 [70602]=5 [70603]=0 [70604]=5 [70605]=5 [70609]=3 [70610]=17 [70625]=17 [70626]=17 + [70720]=5 [70721]=5 [70725]=5 [70726]=17 [70750]=17 [70832]=17 [70833]=5 [70834]=5 [70841]=5 [70842]=17 [70843]=5 [70844]=5 [70845]=17 [70846]=5 [70847]=17 [70848]=17 + [70849]=5 [70850]=17 [70851]=17 [71087]=17 [71088]=5 [71089]=5 [71094]=0 [71095]=0 [71100]=17 [71101]=17 [71102]=5 [71103]=17 [71104]=17 [71132]=17 [71133]=17 [71227]=5 + [71228]=5 [71229]=17 [71230]=5 [71231]=17 [71232]=17 [71339]=17 [71340]=5 [71341]=17 [71342]=5 [71343]=5 [71453]=17 [71454]=5 [71455]=17 [71456]=0 [71457]=0 [71462]=5 + [71736]=5 [71737]=17 [71738]=17 [71984]=17 [71990]=0 [71991]=5 [71992]=5 [71993]=0 [71994]=0 [71999]=3 [72000]=5 [72001]=3 [72002]=5 [72003]=17 [72152]=0 [72153]=0 + [72154]=17 [72155]=17 [72160]=17 [72164]=5 [72249]=5 [72250]=3 [72263]=17 [72279]=5 [72280]=5 [72343]=5 [72344]=17 [72345]=17 [72751]=5 [72759]=0 [72766]=5 [72767]=17 + [72872]=0 [72873]=5 [72881]=5 [72882]=17 [72883]=17 [72884]=5 [72885]=17 [72886]=17 [73018]=17 [73019]=0 [73020]=17 [73021]=17 [73022]=0 [73030]=3 [73031]=17 [73103]=0 + [73104]=17 [73105]=17 [73106]=0 [73107]=5 [73108]=5 [73109]=17 [73110]=5 [73111]=17 [73459]=17 [73460]=17 [73461]=5 [73462]=5 [73472]=17 [73473]=17 [73474]=3 [73475]=5 + [73524]=5 [73525]=5 [73534]=5 [73535]=5 [73562]=17 [78912]=17 [93539]=8 [94031]=17 [94032]=0 [94180]=17 [94192]=17 [94193]=17 [113821]=17 [113822]=17 [113823]=0 [118574]=0 + [118575]=0 [119171]=0 [119172]=0 [121461]=17 [121476]=17 [121504]=0 [122887]=0 [122905]=0 [122906]=0 [122914]=0 [122915]=17 [122916]=17 [122917]=0 [123023]=17 [123566]=17 [124398]=17 + [124399]=17 [127279]=12 [127358]=12 [127359]=12 [127374]=12 [127375]=0 [127376]=0 [127488]=0 [127514]=12 [127535]=12 [127536]=0 [127537]=0 [127547]=0 [129339]=0 [129350]=0 + [0]=1 [32]=0 [127]=1 [160]=0 [768]=17 [880]=0 [1155]=17 [1162]=0 [1425]=17 [1480]=0 [1536]=3 [1542]=0 [1552]=17 [1565]=0 [1611]=17 [1632]=0 + [1750]=17 [1774]=0 [1840]=17 [1867]=0 [1958]=17 [1969]=0 [2027]=17 [2036]=0 [2070]=17 [2094]=0 [2137]=17 [2140]=0 [2199]=17 [2208]=0 [2250]=17 [2308]=0 + [2325]=15 [2366]=5 [2369]=17 [2377]=5 [2385]=17 [2392]=15 [2404]=0 [2424]=15 [2436]=0 [2453]=15 [2483]=0 [2486]=15 [2497]=17 [2510]=0 [2622]=5 [2627]=0 + [2635]=17 [2638]=0 [2709]=15 [2750]=5 [2753]=17 [2766]=0 [2810]=17 [2820]=0 [2837]=15 [2881]=17 [2894]=0 [2901]=17 [2904]=0 [3014]=5 [3022]=0 [3073]=5 + [3077]=0 [3093]=15 [3134]=17 [3137]=5 [3142]=17 [3150]=0 [3160]=15 [3163]=0 [3270]=17 [3278]=0 [3349]=15 [3393]=17 [3398]=5 [3407]=0 [3538]=17 [3544]=5 + [3552]=0 [3636]=17 [3643]=0 [3655]=17 [3663]=0 [3764]=17 [3773]=0 [3784]=17 [3791]=0 [3953]=17 [3976]=0 [3981]=17 [4029]=0 [4141]=17 [4159]=0 [4190]=17 + [4193]=0 [4209]=17 [4213]=0 [4352]=7 [4448]=8 [4520]=9 [4608]=0 [4957]=17 [4960]=0 [5906]=17 [5910]=0 [5938]=17 [5941]=0 [6071]=17 [6078]=5 [6089]=17 + [6100]=0 [6155]=17 [6160]=0 [6432]=17 [6435]=5 [6444]=0 [6451]=5 [6457]=17 [6460]=0 [6744]=17 [6765]=5 [6771]=17 [6784]=0 [6832]=17 [6863]=0 [6912]=17 + [6917]=0 [6964]=17 [6974]=5 [6978]=17 [6981]=0 [7019]=17 [7028]=0 [7074]=17 [7086]=0 [7146]=5 [7151]=17 [7156]=0 [7204]=5 [7212]=17 [7224]=0 [7376]=17 + [7401]=0 [7616]=17 [7680]=0 [8232]=1 [8239]=0 [8288]=1 [8304]=0 [8400]=17 [8433]=0 [8596]=12 [8602]=0 [9193]=12 [9204]=0 [9208]=12 [9211]=0 [9723]=12 + [9862]=0 [9872]=12 [10007]=0 [10067]=12 [10072]=0 [10083]=12 [10088]=0 [10133]=12 [10136]=0 [11013]=12 [11016]=0 [11503]=17 [11506]=0 [11744]=17 [11776]=0 [12330]=17 + [12337]=0 [42607]=17 [42622]=0 [43188]=5 [43206]=0 [43232]=17 [43250]=0 [43302]=17 [43310]=0 [43335]=17 [43348]=0 [43360]=7 [43389]=0 [43392]=17 [43396]=0 [43446]=17 + [43457]=0 [43561]=17 [43575]=0 [43698]=17 [43705]=0 [44033]=11 [55204]=0 [55216]=8 [55239]=0 [55243]=9 [55292]=0 [55296]=13 [56320]=14 [57344]=0 [65024]=17 [65040]=0 + [65056]=17 [65072]=0 [65520]=1 [65532]=0 [66422]=17 [66427]=0 [68097]=17 [68103]=0 [68108]=17 [68112]=0 [68152]=17 [68155]=0 [68900]=17 [68904]=0 [68969]=17 [68974]=0 + [69372]=17 [69376]=0 [69446]=17 [69457]=0 [69506]=17 [69510]=0 [69688]=17 [69703]=0 [69759]=17 [69763]=0 [69808]=5 [69811]=17 [69822]=0 [69888]=17 [69891]=0 [69927]=17 + [69941]=0 [70067]=5 [70070]=17 [70084]=0 [70089]=17 [70096]=0 [70188]=5 [70191]=17 [70200]=0 [70368]=5 [70371]=17 [70379]=0 [70465]=5 [70478]=0 [70502]=17 [70509]=0 + [70512]=17 [70517]=0 [70587]=17 [70611]=0 [70709]=5 [70712]=17 [70727]=0 [70835]=17 [70852]=0 [71090]=17 [71096]=5 [71105]=0 [71216]=5 [71219]=17 [71233]=0 [71344]=17 + [71352]=0 [71458]=17 [71468]=0 [71724]=5 [71727]=17 [71739]=0 [71985]=5 [71995]=17 [72004]=0 [72145]=5 [72148]=17 [72156]=5 [72161]=0 [72193]=17 [72203]=0 [72243]=17 + [72255]=0 [72273]=17 [72284]=0 [72324]=3 [72330]=17 [72346]=0 [72752]=17 [72768]=0 [72850]=17 [72887]=0 [73009]=17 [73015]=0 [73023]=17 [73032]=0 [73098]=5 [73112]=0 + [73526]=17 [73531]=0 [73536]=17 [73539]=0 [78896]=1 [78913]=0 [78919]=17 [78934]=0 [90398]=17 [90410]=5 [90413]=17 [90416]=0 [92912]=17 [92917]=0 [92976]=17 [92983]=0 + [93543]=8 [93547]=0 [94033]=5 [94088]=0 [94095]=17 [94099]=0 [113824]=1 [113828]=0 [118528]=17 [118599]=0 [119141]=17 [119146]=0 [119149]=17 [119155]=1 [119163]=17 [119180]=0 + [119210]=17 [119214]=0 [119362]=17 [119365]=0 [121344]=17 [121399]=0 [121403]=17 [121453]=0 [121499]=17 [121520]=0 [122880]=17 [122923]=0 [123184]=17 [123191]=0 [123628]=17 [123632]=0 + [124140]=17 [124144]=0 [125136]=17 [125143]=0 [125252]=17 [125259]=0 [126976]=12 [127232]=0 [127245]=12 [127248]=0 [127340]=12 [127346]=0 [127377]=12 [127387]=0 [127405]=12 [127462]=6 + [127489]=12 [127504]=0 [127538]=12 [127552]=0 [127561]=12 [127995]=17 [128000]=12 [128318]=0 [128326]=12 [128592]=0 [128640]=12 [128768]=0 [128884]=12 [128896]=0 [128981]=12 [129024]=0 + [129036]=12 [129040]=0 [129096]=12 [129104]=0 [129114]=12 [129120]=0 [129160]=12 [129168]=0 [129198]=12 [129280]=0 [129292]=12 [129792]=0 [130048]=12 [131070]=0 [917504]=1 [917536]=17 + [917632]=1 [917760]=17 [918000]=1 +) +_ble_unicode_GraphemeClusterBreak_ranges=( + 0 32 127 160 768 880 1155 1162 1425 1480 1536 1542 1552 1565 1611 1632 1750 1774 1840 1867 1958 1969 2027 2036 2070 2094 2137 2140 2199 2208 2250 2308 + 2325 2366 2369 2377 2385 2392 2404 2424 2436 2453 2483 2486 2497 2510 2622 2627 2635 2638 2709 2750 2753 2766 2810 2820 2837 2881 2894 2901 2904 3014 3022 3073 + 3077 3093 3134 3137 3142 3150 3160 3163 3270 3278 3349 3393 3398 3407 3538 3544 3552 3636 3643 3655 3663 3764 3773 3784 3791 3953 3976 3981 4029 4141 4159 4190 + 4193 4209 4213 4352 4448 4520 4608 4957 4960 5906 5910 5938 5941 6071 6078 6089 6100 6155 6160 6432 6435 6444 6451 6457 6460 6744 6765 6771 6784 6832 6863 6912 + 6917 6964 6974 6978 6981 7019 7028 7074 7086 7146 7151 7156 7204 7212 7224 7376 7401 7616 7680 8232 8239 8288 8304 8400 8433 8596 8602 9193 9204 9208 9211 9723 + 9862 9872 10007 10067 10072 10083 10088 10133 10136 11013 11016 11503 11506 11744 11776 12330 12337 42607 42622 43188 43206 43232 43250 43302 43310 43335 43348 43360 43389 43392 43396 43446 + 43457 43561 43575 43698 43705 44033 55204 55216 55239 55243 55292 55296 56320 57344 65024 65040 65056 65072 65520 65532 66422 66427 68097 68103 68108 68112 68152 68155 68900 68904 68969 68974 + 69372 69376 69446 69457 69506 69510 69688 69703 69759 69763 69808 69811 69822 69888 69891 69927 69941 70067 70070 70084 70089 70096 70188 70191 70200 70368 70371 70379 70465 70478 70502 70509 + 70512 70517 70587 70611 70709 70712 70727 70835 70852 71090 71096 71105 71216 71219 71233 71344 71352 71458 71468 71724 71727 71739 71985 71995 72004 72145 72148 72156 72161 72193 72203 72243 + 72255 72273 72284 72324 72330 72346 72752 72768 72850 72887 73009 73015 73023 73032 73098 73112 73526 73531 73536 73539 78896 78913 78919 78934 90398 90410 90413 90416 92912 92917 92976 92983 + 93543 93547 94033 94088 94095 94099 113824 113828 118528 118599 119141 119146 119149 119155 119163 119180 119210 119214 119362 119365 121344 121399 121403 121453 121499 121520 122880 122923 123184 123191 123628 123632 + 124140 124144 125136 125143 125252 125259 126976 127232 127245 127248 127340 127346 127377 127387 127405 127462 127489 127504 127538 127552 127561 127995 128000 128318 128326 128592 128640 128768 128884 128896 128981 129024 + 129036 129040 129096 129104 129114 129120 129160 129168 129198 129280 129292 129792 130048 131070 917504 917536 917632 917760 918000 921600 +) +_ble_unicode_GraphemeClusterBreak_rule=( + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 1 0 1 2 0 0 0 0 0 0 3 0 0 6 1 1 + 2 0 1 2 1 2 2 2 2 2 2 2 2 2 2 2 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 4 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 1 1 0 1 1 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 1 1 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 1 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 1 1 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 1 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 5 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 6 1 1 + 0 0 1 0 1 2 0 0 0 0 0 0 0 0 0 6 1 1 +) +_ble_unicode_GraphemeClusterBreak_custom[0x1F3FB]=$_ble_unicode_GraphemeClusterBreak_Pictographic +_ble_unicode_GraphemeClusterBreak_custom[0x1F3FC]=$_ble_unicode_GraphemeClusterBreak_Pictographic +_ble_unicode_GraphemeClusterBreak_custom[0x1F3FD]=$_ble_unicode_GraphemeClusterBreak_Pictographic +_ble_unicode_GraphemeClusterBreak_custom[0x1F3FE]=$_ble_unicode_GraphemeClusterBreak_Pictographic +_ble_unicode_GraphemeClusterBreak_custom[0x1F3FF]=$_ble_unicode_GraphemeClusterBreak_Pictographic +_ble_unicode_GraphemeClusterBreak_custom[0xFF9E]=$_ble_unicode_GraphemeClusterBreak_Other +_ble_unicode_GraphemeClusterBreak_custom[0xFF9F]=$_ble_unicode_GraphemeClusterBreak_Other +function ble/unicode/GraphemeCluster/c2break { + local code=$1 + ret=${_ble_unicode_GraphemeClusterBreak_custom[code]} + [[ $ret ]] && return 0 + ret=${_ble_unicode_GraphemeClusterBreak[code]} + [[ $ret ]] && return 0 + ((ret>_ble_unicode_GraphemeClusterBreak_MaxCode)) && { ret=0; return 0; } + local l=0 u=${#_ble_unicode_GraphemeClusterBreak_ranges[@]} m + local L='_ble_unicode_GraphemeClusterBreak_ranges[m=(l+u)/2]<=code?(l=m):(u=m),L[l+1>=u]' + ((l+1/dev/null # suppress locale error #D1440 +ble/unicode/GraphemeCluster/s2break/.initialize +function ble/unicode/GraphemeCluster/s2break/.combine-surrogate { + local code1=$1 code2=$2 s=$3 + if ((0xDC00<=code2&&code2<=0xDFFF)); then + ((c=0x10000+(code1-0xD800)*1024+(code2&0x3FF))) + else + local ret + ble/util/s2bytes "$s" + ble/encoding:UTF-8/b2c "${ret[@]}" + c=$ret + fi +} +if ((_ble_unicode_GraphemeCluster_bomlen==2&&40300<=_ble_bash&&_ble_bash<50000)); then + function ble/unicode/GraphemeCluster/s2break/.wa-bash43bug-uFFFF { + local code=$1 + ((0xD7F8<=code&&code<0xD800)) && ble/util/is-unicode-output && + ret=$_ble_unicode_GraphemeClusterBreak_HighSurrogate + } +else + function ble/unicode/GraphemeCluster/s2break/.wa-bash43bug-uFFFF { ((0)); } +fi +if ((_ble_unicode_GraphemeCluster_ucs4len==2)); then + if ((_ble_bash<50000)); then + function ble/unicode/GraphemeCluster/s2break/.wa-cygwin-LSG { + local code=$1 + ((code==0)) && ble/util/is-unicode-output && + ret=$_ble_unicode_GraphemeClusterBreak_LowSurrogate + } + else + function ble/unicode/GraphemeCluster/s2break/.wa-cygwin-LSG { + local code=$1 + ((0x80<=code&&code<0xC0)) && ble/util/is-unicode-output && + ret=$_ble_unicode_GraphemeClusterBreak_LowSurrogate + } + fi +else + function ble/unicode/GraphemeCluster/s2break/.wa-cygwin-LSG { ((0)); } +fi +function ble/unicode/GraphemeCluster/s2break-left { + ret=0 + local s=$1 N=${#1} i=$2 opts=$3 sh=1 + ((i>0)) && ble/util/s2c "${s:i-1:2}"; local c=$ret code2=$ret # Note2 (上述) + ble/unicode/GraphemeCluster/c2break "$code2"; local break=$ret + ((i-1=0&&ret==_ble_unicode_GraphemeClusterBreak_LowSurrogate)); then + ble/util/s2c "${s:i-2:2}"; local code1=$ret # Note2 (上述) + ble/unicode/GraphemeCluster/c2break "$code1" + ble/unicode/GraphemeCluster/s2break/.wa-bash43bug-uFFFF "$code1" + if ((ret==_ble_unicode_GraphemeClusterBreak_HighSurrogate)); then + ble/unicode/GraphemeCluster/s2break/.combine-surrogate "$code1" "$code2" "${s:i-2:2}" + ble/unicode/GraphemeCluster/c2break "$c" + break=$ret + sh=2 + fi + elif ((i0;j-=shift)); do + ble/unicode/GraphemeCluster/s2break-left "$text" "$j" shift + ((_ble_unicode_GraphemeClusterBreak_isExtend[ret])) || break + done + if ((j==0||ret!=_ble_unicode_GraphemeClusterBreak_Pictographic)); then + ((ret=i)) + return 0 + else + ((i=j-shift,b1=ret)) + return 1 + fi +} +function ble/unicode/GraphemeCluster/find-previous-boundary/.RI { + if [[ :$bleopt_emoji_opts: != *:ri:* ]]; then + ((ret=i)) + return 0 + fi + local j1=$((i-shift)) + local j shift=1 countRI=1 + for ((j=j1;j>0;j-=shift,countRI++)); do + ble/unicode/GraphemeCluster/s2break-left "$text" "$j" shift + ((ret==_ble_unicode_GraphemeClusterBreak_Regional_Indicator)) || break + done + if ((j==j1)); then + ((i=j,b1=_ble_unicode_GraphemeClusterBreak_Regional_Indicator)) + return 1 + else + ((ret=countRI%2==1?j1:i)) + return 0 + fi +} +function ble/unicode/GraphemeCluster/find-previous-boundary/.InCB { + if [[ $bleopt_grapheme_cluster != extended ]] || ((_ble_unicode_c2w_version<17)); then + ret=$i + return 0 + fi + local out=$i j=$i count_linker=0 + local b1=$b1 shift=$shift + while + case $b1 in + ("$_ble_unicode_GraphemeClusterBreak_InCB_Consonant") + if ((count_linker)); then + count_linker=0 + ((out=j-shift)) + fi ;; + ("$_ble_unicode_GraphemeClusterBreak_InCB_Linker") + ((count_linker++)) ;; + ("$_ble_unicode_GraphemeClusterBreak_InCB_Extend"|"$_ble_unicode_GraphemeClusterBreak_ZWJ") ;; + (*) break ;; + esac + ((j-=shift,j>0)) + do + ble/unicode/GraphemeCluster/s2break-left "$text" "$j" shift + b1=$ret + done + if ((out0)); do + local b2=$b1 + ble/unicode/GraphemeCluster/s2break-left "$text" "$i" shift; local b1=$ret + case ${_ble_unicode_GraphemeClusterBreak_rule[b1*_ble_unicode_GraphemeClusterBreak_Count+b2]} in + (0) break ;; + (1) ((i-=shift)) ;; + (2) [[ $bleopt_grapheme_cluster != extended ]] && break; ((i-=shift)) ;; + (3) ble/unicode/GraphemeCluster/find-previous-boundary/.ZWJ && return 0 ;; + (4) ble/unicode/GraphemeCluster/find-previous-boundary/.RI && return 0 ;; + (6) ble/unicode/GraphemeCluster/find-previous-boundary/.InCB && return 0;; + (5) + ((i-=shift)) + ble/unicode/GraphemeCluster/s2break-right "$text" "$i"; b1=$ret ;; + esac + done + fi + ret=$i + return 0 +} +_ble_unicode_GraphemeClusterBreak_isCore=() +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_Other]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_Control]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_Regional_Indicator]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_L]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_V]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_T]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_LV]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_LVT]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_Pictographic]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_HighSurrogate]=1 +_ble_unicode_GraphemeClusterBreak_isCore[_ble_unicode_GraphemeClusterBreak_InCB_Consonant]=1 +_ble_unicode_GraphemeClusterBreak_isExtend=() +_ble_unicode_GraphemeClusterBreak_isExtend[_ble_unicode_GraphemeClusterBreak_Extend]=1 +_ble_unicode_GraphemeClusterBreak_isExtend[_ble_unicode_GraphemeClusterBreak_InCB_Extend]=1 +_ble_unicode_GraphemeClusterBreak_isExtend[_ble_unicode_GraphemeClusterBreak_InCB_Linker]=1 +function ble/unicode/GraphemeCluster/extend-ascii { + extend=0 + [[ $_ble_util_locale_encoding != UTF-8 || ! $bleopt_grapheme_cluster ]] && return 1 + local text=$1 iN=${#1} i=$2 ret shift=1 + for ((;i=iN)); then + c=0 w=0 cs= cb= extend=0 + return 1 + elif ! ble/util/is-unicode-output || [[ ! $bleopt_grapheme_cluster ]]; then + cs=${text:i:1} + ble/util/s2c "$cs"; c=$ret + if [[ $flags != *R* ]] && { + ble/unicode/GraphemeCluster/c2break "$c" + ((ret==_ble_unicode_GraphemeClusterBreak_Control)); }; then + ble/unicode/GraphemeCluster/.get-ascii-rep "$c" + w=${#cs} + else + ble/util/c2w "$c"; w=$ret + fi + extend=0 + return 0 + fi + local b0 b1 b2 c0 c2 shift code + ble/unicode/GraphemeCluster/s2break-right "$text" "$i" code:shift; c0=$code b0=$ret + local coreb= corec= npre=0 vs= ri= InCB_state= + c2=$c0 b2=$b0 + while ((j=17&&InCB_state)) || + break ;; + (5) + ble/unicode/GraphemeCluster/s2break-left "$text" "$((j+shift))" code; c2=$code b2=$ret ;; + esac + done + c=$corec cb=$coreb cs=${text:i:j-i} + ((extend=j-i-1)) + if [[ ! $corec ]]; then + if [[ $flags != *R* ]]; then + ((c=c0,cb=0,corec=0x25CC)) # 基底が存在しない時は点線円 + ble/util/c2s "$corec" + cs=${text:i:npre}$ret${text:i+npre:j-i-npre} + else + local code + ble/unicode/GraphemeCluster/s2break-right "$cs" 0 code + c=$code corec=$code cb=$ret + fi + fi + if ((cb==_ble_unicode_GraphemeClusterBreak_Control)); then + if [[ $flags != *R* ]]; then + ble/unicode/GraphemeCluster/.get-ascii-rep "$c" + w=${#cs} + else + w=0 + fi + else + if [[ $vs == tpvs && :$bleopt_emoji_opts: == *:tpvs:* ]]; then + bleopt_emoji_width= ble/util/c2w "$corec"; w=$ret + elif [[ $vs == epvs && :$bleopt_emoji_opts: == *:epvs:* ]]; then + w=${bleopt_emoji_width:-2} + else + ble/util/c2w "$corec"; w=$ret + fi + fi + return 0 +} +function ble/canvas/attach { + ble/util/c2w:auto/check +} +function ble/canvas/put.draw { + DRAW_BUFF[${#DRAW_BUFF[*]}]=$1 +} +function ble/canvas/put-ind.draw { + local count=${1-1} opts=${2-} x=${3-} ind=$_ble_term_ind + ((count>=1)) || return 0 + [[ :$opts: == *:true-ind:* ]] && ind=$'\eD' + local ret=$ind + if ((count>=1)); then + ble/string#repeat "$ind" "$count" + fi + DRAW_BUFF[${#DRAW_BUFF[*]}]=$ret + [[ $x && $ind != $'\eD' ]] && + ble/canvas/put-hpa.draw "$((x+1))" # tput ind が唯の改行の時がある +} +function ble/canvas/put-ri.draw { + local count=${1-1} + local ret; ble/string#repeat "$_ble_term_ri" "$count" + DRAW_BUFF[${#DRAW_BUFF[*]}]=$ret +} +function ble/canvas/put-il.draw { + local value=${1-1} + ((value>0)) || return 0 + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_il//'%d'/$value} + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 # Note #D1214: 最終行対策 cygwin, linux +} +function ble/canvas/put-dl.draw { + local value=${1-1} + ((value>0)) || return 0 + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 # Note #D1214: 最終行対策 cygwin, linux + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_dl//'%d'/$value} +} +if ((_ble_bash>=40000)) && [[ ( $OSTYPE == cygwin || $OSTYPE == msys ) && $TERM == xterm-256color ]]; then + function ble/canvas/.is-il-workaround-required { + local value=$1 opts=$2 + [[ ! $_ble_term_DA2R ]] || return 1 + ((value==1)) || return 1 + [[ :$opts: == *:vfill:* || :$opts: == *:no-lastline:* ]] && return 1 + [[ :$opts: == *:panel:* ]] && + ! ble/canvas/panel/is-last-line && + return 1 + return 0 + } + function ble/canvas/put-il.draw { + local value=${1-1} opts=$2 + ((value>0)) || return 0 + if ble/canvas/.is-il-workaround-required "$value" "$2"; then + if [[ :$opts: == *:panel:* ]]; then + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 + else + DRAW_BUFF[${#DRAW_BUFF[*]}]=$'\e[S\e[A\e[L\e[B\e[T' + fi + else + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_il//'%d'/$value} + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 # Note #D1214: 最終行対策 cygwin, linux + fi + } + function ble/canvas/put-dl.draw { + local value=${1-1} opts=$2 + ((value>0)) || return 0 + if ble/canvas/.is-il-workaround-required "$value" "$2"; then + if [[ :$opts: == *:panel:* ]]; then + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 + else + DRAW_BUFF[${#DRAW_BUFF[*]}]=$'\e[S\e[A\e[M\e[B\e[T' + fi + else + DRAW_BUFF[${#DRAW_BUFF[*]}]=$_ble_term_el2 # Note #D1214: 最終行対策 cygwin, linux + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_dl//'%d'/$value} + fi + } +fi +function ble/canvas/put-cuu.draw { + local value=${1-1} + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_cuu//'%d'/$value} +} +function ble/canvas/put-cud.draw { + local value=${1-1} + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_cud//'%d'/$value} +} +function ble/canvas/put-cuf.draw { + local value=${1-1} + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_cuf//'%d'/$value} +} +function ble/canvas/put-cub.draw { + local value=${1-1} + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_term_cub//'%d'/$value} +} +function ble/canvas/put-cup.draw { + local l=${1-1} c=${2-1} + local out=$_ble_term_cup + out=${out//'%l'/$l} + out=${out//'%c'/$c} + out=${out//'%y'/$((l-1))} + out=${out//'%x'/$((c-1))} + DRAW_BUFF[${#DRAW_BUFF[*]}]=$out +} +function ble/canvas/put-hpa.draw { + local c=${1-1} + local out=$_ble_term_hpa + out=${out//'%c'/$c} + out=${out//'%x'/$((c-1))} + DRAW_BUFF[${#DRAW_BUFF[*]}]=$out +} +function ble/canvas/put-vpa.draw { + local l=${1-1} + local out=$_ble_term_vpa + out=${out//'%l'/$l} + out=${out//'%y'/$((l-1))} + DRAW_BUFF[${#DRAW_BUFF[*]}]=$out +} +function ble/canvas/put-ech.draw { + local value=${1:-1} esc + if [[ $_ble_term_ech ]]; then + esc=${_ble_term_ech//'%d'/$value} + else + ble/string#reserve-prototype "$value" + esc=${_ble_string_prototype::value}${_ble_term_cub//'%d'/$value} + fi + DRAW_BUFF[${#DRAW_BUFF[*]}]=$esc +} +function ble/canvas/put-spaces.draw { + local value=${1:-1} + ble/string#reserve-prototype "$value" + DRAW_BUFF[${#DRAW_BUFF[*]}]=${_ble_string_prototype::value} +} +function ble/canvas/put-move-x.draw { + local dx=$1 + ((dx)) || return 1 + if ((dx>0)); then + ble/canvas/put-cuf.draw "$dx" + else + ble/canvas/put-cub.draw "$((-dx))" + fi +} +function ble/canvas/put-move-y.draw { + local dy=$1 + ((dy)) || return 1 + if ((dy>0)); then + if [[ $MC_SID == $$ ]]; then + ble/canvas/put-ind.draw "$dy" true-ind + else + ble/canvas/put-cud.draw "$dy" + fi + else + ble/canvas/put-cuu.draw "$((-dy))" + fi +} +function ble/canvas/put-move.draw { + ble/canvas/put-move-x.draw "$1" + ble/canvas/put-move-y.draw "$2" +} +function ble/canvas/flush.draw { + IFS= builtin eval 'ble/util/put "${DRAW_BUFF[*]}"' + DRAW_BUFF=() +} +function ble/canvas/sflush.draw { + local _ble_local_var=ret + [[ $1 == -v ]] && _ble_local_var=$2 + IFS= builtin eval "$_ble_local_var=\"\${DRAW_BUFF[*]}\"" + DRAW_BUFF=() +} +function ble/canvas/bflush.draw { + IFS= builtin eval 'ble/util/buffer "${DRAW_BUFF[*]}"' + DRAW_BUFF=() +} +function ble/canvas/put-clear-lines.draw { + local old=${1:-1} + local new=${2:-$old} + if ((old>=1&&new>=1)); then + ble/canvas/put.draw "$_ble_term_el2" + if ((old==1)); then + ble/canvas/put-il.draw "$((new-old))" "$3" + else + ble/canvas/put-ind.draw 1 '' "$_ble_canvas_x" + if ((old==2&&new>=2)); then + ble/canvas/put.draw "$_ble_term_el2" + ble/canvas/put-il.draw "$((new-2))" "$3" + else + ble/canvas/put-dl.draw "$((old-1))" "$3" + ble/canvas/put-il.draw "$((new-1))" "$3" + fi + ble/canvas/put-cuu.draw 1 + fi + else + ble/canvas/put-dl.draw "$old" "$3" + ble/canvas/put-il.draw "$new" "$3" + fi +} +function ble/canvas/trace/.put-sgr.draw { + local ret g=$1 + if ((g==0)); then + ble/canvas/put.draw "$opt_sgr0" + else + ble/color/g.compose "$opt_g0" "$g" + "$trace_g2sgr" "$g" + ble/canvas/put.draw "$ret" + fi +} +function ble/canvas/trace/.measure-point { + if [[ $flag_bbox ]]; then + ((x0)) || return 0 + if [[ $flag_gbox ]]; then + if [[ ! $gx1 ]]; then + ((gx1=gx2=x,gy1=gy2=y)) + else + ((xx2)) && x2=$x + [[ $flag_gbox ]] && ((x>gx2)) && gx2=$x + if ((x==cols&&!xenl)); then + ((y++,x=0)) + if [[ $flag_bbox ]]; then + ((xy2)) && y2=$y + fi + fi + else + if [[ $type == atomic ]]; then + ((y++,x=w0&&(x1=0))) + ((x2y2)) && y2=$y + fi + if [[ $flag_gbox ]]; then + ((gx1>0&&(gx1=0))) + ((gx2gy2)) && gy2=$y + fi + fi + ((x==0&&(lc=32,lg=0))) + return 0 +} +function ble/canvas/trace/.put-atomic.draw { + local c=$1 w=$2 + if [[ $flag_clip ]]; then + ((cy1<=y&&ycx2)) && value=${value::${#value}-(xR-cx2)} xR=$cx2 + ble/canvas/put-move.draw "$((x-cx))" "$((y-cy))" + ble/canvas/put.draw "$value" + ((cx=xR,cy=y)) + else + ble/canvas/put.draw "$value" + fi + ble/canvas/trace/.implicit-move "$w" +} +function ble/canvas/trace/.process-overflow { + [[ :$opts: == *:truncate:* ]] && i=$iN # stop + if ((y+1==lines)) && [[ :$opts: == *:ellipsis:* ]]; then + local ellipsis=... w=3 wmax=$xlimit + ((w>wmax)) && ellipsis=${ellipsis::wmax} w=$wmax + if ble/util/is-unicode-output; then + local symbol='…' ret + ble/util/s2c "$symbol" + ble/util/c2w "$ret" + ((ret<=wmax)) && ellipsis=$symbol w=$ret + fi + local ox=$x oy=$y + ble/canvas/trace/.goto "$((wmax-w))" "$((lines-1))" + ble/canvas/trace/.put-atomic.draw "$ellipsis" "$w" + ble/canvas/trace/.goto "$ox" "$oy" + fi +} +function ble/canvas/trace/.justify/inc-quote { + [[ $trace_flags == *J* ]] || return 0 + ((trace_sclevel++)) + flag_justify= +} +function ble/canvas/trace/.justify/dec-quote { + [[ $trace_flags == *J* ]] || return 0 + ((--trace_sclevel)) || flag_justify=1 +} +function ble/canvas/trace/.justify/begin-line { + ((jx0=x1=x2=x,jy0=y1=y2=y)) + gx1= gx2= gy1= gy2= + [[ $justify_align == *[cr]* ]] && + ble/canvas/trace/.justify/next-field +} +function ble/canvas/trace/.justify/next-field { + local sep=$1 wmin=0 + local esc; ble/canvas/sflush.draw -v esc + [[ $sep == ' ' ]] && wmin=1 + ble/array#push justify_fields "${sep:-\$}:$wmin:$jx0,$jy0,$x,$y:$x1,$y1,$x2,$y2:$gx1,$gy1,$gx2,$gy2:$esc" + ((x+=wmin,jx0=x1=x2=x,jy0=y1=y2=y)) +} +function ble/canvas/trace/.justify/unpack { + local data=$1 buff + sep=${data::1}; data=${data:2} + wmin=${data%%:*}; data=${data#*:} + ble/string#split buff , "${data%%:*}"; data=${data#*:} + xI=${buff[0]} yI=${buff[1]} xF=${buff[2]} yF=${buff[3]} + ble/string#split buff , "${data%%:*}"; data=${data#*:} + x1=${buff[0]} y1=${buff[1]} x2=${buff[2]} y2=${buff[3]} + ble/string#split buff , "${data%%:*}"; data=${data#*:} + gx1=${buff[0]} gy1=${buff[1]} gx2=${buff[2]} gy2=${buff[3]} + esc=$data +} +function ble/canvas/trace/.justify/end-line { + if [[ $trace_flags == *B* ]]; then + ((yjy2&&(jy2=y))) + fi + ((${#justify_fields[@]}||${#DRAW_BUFF[@]})) || return 0 + ble/canvas/trace/.justify/next-field + [[ $justify_align == *c* ]] && + ble/canvas/trace/.justify/next-field + local i width=0 ispan=0 has_content= + for ((i=0;i<${#justify_fields[@]};i++)); do + local sep wmin xI yI xF yF x1 y1 x2 y2 gx1 gy1 gx2 gy2 esc + ble/canvas/trace/.justify/unpack "${justify_fields[i]}" + ((width+=xF-xI)) + [[ $esc ]] && has_content=1 + ((i+1==${#justify_fields[@]})) && break + ((width+=wmin)) + ((ispan++)) + done + if [[ ! $has_content ]]; then + justify_fields=() + return 0 + fi + local nspan=$ispan + local -a DRAW_BUFF=() + local xlimit=$cols + [[ $_ble_term_xenl$opt_relative ]] || ((xlimit--)) + local span=$((xlimit-width)) + x= y= + local ispan=0 vx=0 spanx=0 + for ((i=0;i<${#justify_fields[@]};i++)); do + local sep wmin xI yI xF yF x1 y1 x2 y2 gx1 gy1 gx2 gy2 esc + ble/canvas/trace/.justify/unpack "${justify_fields[i]}" + if [[ ! $x ]]; then + x=$xI y=$yI + if [[ $justify_align == right ]]; then + ble/canvas/put-move-x.draw "$((cols-1-x))" + ((x=cols-1)) + fi + fi + if [[ $esc ]]; then + local delta=0 + ((vx+x1-xI<0)) && ((delta=-(vx+x1-xI))) + ((vx+x2-xI>xlimit)) && ((delta=xlimit-(vx+x2-xI))) + ble/canvas/put-move-x.draw "$((vx+delta-x))" + ((x=vx+delta)) + ble/canvas/put.draw "$esc" + if [[ $trace_flags == *B* ]]; then + ((x+x1-xIjx2&&(jx2=x+x2-xI))) + ((y+y2-yI>jy2&&(jy2=y+y2-yI))) + fi + if [[ $flag_gbox && $gx1 ]]; then + ((gx1+=x-xI,gx2+=x-xI)) + ((gy1+=y-yI,gy2+=y-yI)) + if [[ ! $jgx1 ]]; then + ((jgx1=gx1,jgy1=gy1,jgx2=gx2,jgy2=gy2)) + else + ((gx1jgx2&&(jgx2=gx2))) + ((gy2>jgy2&&(jgy2=gy2))) + fi + fi + ((x+=xF-xI,y+=yF-yI,vx+=xF-xI)) + fi + ((i+1==${#justify_fields[@]})) && break + local new_spanx=$((span*++ispan/nspan)) + local wfill=$((wmin+new_spanx-spanx)) + ((vx+=wfill,spanx=new_spanx)) + if [[ $sep == ' ' ]]; then + ble/string#reserve-prototype "$wfill" + ble/canvas/put.draw "${_ble_string_prototype::wfill}" + ((x+=wfill)) + fi + done + local ret + ble/canvas/sflush.draw + ble/array#push justify_buff "$ret" + justify_fields=() +} +function ble/canvas/trace/.decsc { + [[ ${trace_decsc[5]} ]] || ble/canvas/trace/.justify/inc-quote + trace_decsc=("$x" "$y" "$g" "$lc" "$lg" active) + if [[ ! $flag_clip ]]; then + [[ :$opts: == *:noscrc:* ]] || + ble/canvas/put.draw "$_ble_term_sc" + fi +} +function ble/canvas/trace/.decrc { + [[ ${trace_decsc[5]} ]] && ble/canvas/trace/.justify/dec-quote + if [[ ! $flag_clip ]]; then + ble/canvas/trace/.put-sgr.draw "${trace_decsc[2]}" # g を明示的に復元。 + if [[ :$opts: == *:noscrc:* ]]; then + ble/canvas/put-move.draw "$((trace_decsc[0]-x))" "$((trace_decsc[1]-y))" + else + ble/canvas/put.draw "$_ble_term_rc" + fi + fi + x=${trace_decsc[0]} + y=${trace_decsc[1]} + g=${trace_decsc[2]} + lc=${trace_decsc[3]} + lg=${trace_decsc[4]} + trace_decsc[5]= +} +function ble/canvas/trace/.scosc { + [[ ${trace_scosc[5]} ]] || ble/canvas/trace/.justify/inc-quote + trace_scosc=("$x" "$y" "$g" "$lc" "$lg" active) + if [[ ! $flag_clip ]]; then + [[ :$opts: == *:noscrc:* ]] || + ble/canvas/put.draw "$_ble_term_sc" + fi +} +function ble/canvas/trace/.scorc { + [[ ${trace_scosc[5]} ]] && ble/canvas/trace/.justify/dec-quote + if [[ ! $flag_clip ]]; then + ble/canvas/trace/.put-sgr.draw "$g" # g は変わらない様に。 + if [[ :$opts: == *:noscrc:* ]]; then + ble/canvas/put-move.draw "$((trace_scosc[0]-x))" "$((trace_scosc[1]-y))" + else + ble/canvas/put.draw "$_ble_term_rc" + fi + fi + x=${trace_scosc[0]} + y=${trace_scosc[1]} + lc=${trace_scosc[3]} + lg=${trace_scosc[4]} + trace_scosc[5]= +} +function ble/canvas/trace/.ps1sc { + ble/canvas/trace/.justify/inc-quote + trace_brack[${#trace_brack[*]}]="$x $y" +} +function ble/canvas/trace/.ps1rc { + local lastIndex=$((${#trace_brack[*]}-1)) + if ((lastIndex>=0)); then + ble/canvas/trace/.justify/dec-quote + local -a scosc + ble/string#split-words scosc "${trace_brack[lastIndex]}" + ((x=scosc[0])) + ((y=scosc[1])) + builtin unset -v "trace_brack[$lastIndex]" + fi +} +function ble/canvas/trace/.NEL { + if [[ $opt_nooverflow ]] && ((y+1>=lines)); then + ble/canvas/trace/.process-overflow + return 1 + fi + [[ $flag_justify ]] && + ble/canvas/trace/.justify/end-line + if [[ ! $flag_clip ]]; then + if [[ $opt_relative ]]; then + ((x)) && ble/canvas/put-cub.draw "$x" + ble/canvas/put-cud.draw 1 + else + ble/canvas/put.draw "$_ble_term_cr" + ble/canvas/put.draw "$_ble_term_nl" + fi + fi + ((y++,x=0,lc=32,lg=0)) + if [[ $flag_bbox ]]; then + ((xy2)) && y2=$y + fi + [[ $flag_justify ]] && + ble/canvas/trace/.justify/begin-line + return 0 +} +function ble/canvas/trace/.SGR { + local param=$1 seq=$2 specs i iN + if [[ ! $param ]]; then + g=0 + [[ $flag_clip ]] || ble/canvas/put.draw "$opt_sgr0" + return 0 + fi + if [[ $opt_terminfo ]]; then + ble/color/read-sgrspec "$param" + else + ble/color/read-sgrspec "$param" ansi + fi + [[ $flag_clip ]] || ble/canvas/trace/.put-sgr.draw "$g" +} +function ble/canvas/trace/.process-csi-sequence { + local seq=$1 seq1=${1:2} rex + local char=${seq1:${#seq1}-1:1} param=${seq1::${#seq1}-1} + if [[ ! ${param//[0-9:;]} ]]; then + case $char in + (m) # SGR + ble/canvas/trace/.SGR "$param" "$seq" + return 0 ;; + ([ABCDEFGIZ\`ade]) + local arg=0 + [[ $param =~ ^[0-9]+$ ]] && ((arg=10#0$param)) + ((arg==0&&(arg=1))) + local ox=$x oy=$y + if [[ $char == A ]]; then + ((y-=arg,y<0&&(y=0))) + ((!flag_clip&&y=lines&&(y=lines-1))) + ((!flag_clip&&y>oy)) && ble/canvas/put-cud.draw "$((y-oy))" + elif [[ $char == [Ca] ]]; then + ((x+=arg,x>=cols&&(x=cols-1))) + ((!flag_clip&&x>ox)) && ble/canvas/put-cuf.draw "$((x-ox))" + elif [[ $char == D ]]; then + ((x-=arg,x<0&&(x=0))) + ((!flag_clip&&x=lines&&(y=lines-1),x=0)) + if [[ ! $flag_clip ]]; then + ((y>oy)) && ble/canvas/put-cud.draw "$((y-oy))" + ble/canvas/put.draw "$_ble_term_cr" + fi + elif [[ $char == F ]]; then + ((y-=arg,y<0&&(y=0),x=0)) + if [[ ! $flag_clip ]]; then + ((y=cols&&(x=cols-1))) + if [[ ! $flag_clip ]]; then + if [[ $opt_relative ]]; then + ble/canvas/put-move-x.draw "$((x-ox))" + else + ble/canvas/put-hpa.draw "$((x+1))" + fi + fi + elif [[ $char == d ]]; then + ((y=arg-1,y<0&&(y=0),y>=lines&&(y=lines-1))) + if [[ ! $flag_clip ]]; then + if [[ $opt_relative ]]; then + ble/canvas/put-move-y.draw "$((y-oy))" + else + ble/canvas/put-vpa.draw "$((y+1))" + fi + fi + elif [[ $char == I ]]; then + local tx + ((tx=(x/it+arg)*it, + tx>=cols&&(tx=cols-1))) + if ((tx>x)); then + [[ $flag_clip ]] || ble/canvas/put-cuf.draw "$((tx-x))" + ((x=tx)) + fi + elif [[ $char == Z ]]; then + local tx + ((tx=((x+it-1)/it-arg)*it, + tx<0&&(tx=0))) + if ((tx=cols&&(dstx=cols-1), + dsty<0&&(dsty=0),dsty>=lines&&(dsty=lines-1))) + ble/canvas/trace/.goto "$dstx" "$dsty" + lc=-1 lg=0 + return 0 ;; + ([su]) # SCOSC SCORC + if [[ $char == s ]]; then + ble/canvas/trace/.scosc + else + ble/canvas/trace/.scorc + fi + return 0 ;; + esac + fi + ble/canvas/put.draw "$seq" +} +function ble/canvas/trace/.process-esc-sequence { + local seq=$1 char=${1:1} + case $char in + (7) # DECSC + ble/canvas/trace/.decsc + return 0 ;; + (8) # DECRC + ble/canvas/trace/.decrc + return 0 ;; + (D) # IND + [[ $opt_nooverflow ]] && ((y+1>=lines)) && return 0 + if [[ $flag_clip || $opt_relative || $flag_justify ]]; then + ((y+1>=lines)) && return 0 + ((y++)) + [[ $flag_clip ]] || + ble/canvas/put-cud.draw 1 + else + ((y++)) + ble/canvas/put-ind.draw 1 '' "$x" + fi + lc=-1 lg=0 + ble/canvas/trace/.measure-point + return 0 ;; + (M) # RI + [[ $opt_nooverflow ]] && ((y==0)) && return 0 + if [[ $flag_clip || $opt_relative || $flag_justify ]]; then + ((y==0)) && return 0 + ((y--)) + [[ $flag_clip ]] || + ble/canvas/put-cuu.draw 1 + else + ((y--)) + ble/canvas/put.draw "$_ble_term_ri" + fi + lc=-1 lg=0 + ble/canvas/trace/.measure-point + return 0 ;; + (E) # NEL + ble/canvas/trace/.NEL + return 0 ;; + esac + ble/canvas/put.draw "$seq" +} +function ble/canvas/trace/.impl { + local text=$1 opts=$2 + local LC_ALL= LC_COLLATE=C + local cols=${COLUMNS:-80} lines=${LINES:-25} + local it=${bleopt_tab_width:-$_ble_term_it} xenl=$_ble_term_xenl + ble/string#reserve-prototype "$it" + local ret rex + ble/util/c2s 156; local st=$ret # œ (ST) + ((${#st}>=2)) && st= + local xinit=$x yinit=$y ginit=$g + local trace_flags= + local opt_nooverflow=; [[ :$opts: == *:truncate:* || :$opts: == *:confine:* ]] && opt_nooverflow=1 + local opt_relative=; [[ :$opts: == *:relative:* ]] && trace_flags=R$trace_flags opt_relative=1 + [[ :$opts: == *:measure-bbox:* ]] && trace_flags=B$trace_flags + [[ :$opts: == *:measure-gbox:* ]] && trace_flags=G$trace_flags + [[ :$opts: == *:left-char:* ]] && trace_flags=L$trace_flags + local opt_terminfo=; [[ :$opts: == *:terminfo:* ]] && opt_terminfo=1 + if ble/string#match ":$opts:" ':(justify(=[^:]+)?|center|right):'; then + trace_flags=J$trace_flags + local jx0=$x jy0=$y + local justify_sep= justify_align= + local -a justify_buff=() + local -a justify_fields=() + case ${BASH_REMATCH[1]} in + (justify*) justify_sep=${BASH_REMATCH[2]:1}${BASH_REMATCH[2]:-' '} ;; + (center) justify_align=c ;; + (right) justify_align=r ;; + esac + fi + if ble/string#match ":$opts:" ':clip=([0-9]*),([0-9]*)([-+])([0-9]*),([0-9]*):'; then + local cx1 cy1 cx2 cy2 cx cy cg + trace_flags=C$trace_flags + cx1=${BASH_REMATCH[1]} cy1=${BASH_REMATCH[2]} + cx2=${BASH_REMATCH[4]} cy2=${BASH_REMATCH[5]} + [[ ${BASH_REMATCH[3]} == + ]] && ((cx2+=cx1,cy2+=cy1)) + ((cx1<=cx2)) || local cx1=$cx2 cx2=$cx1 + ((cy1<=cy2)) || local cy1=$cy2 cy2=$cy1 + ((cx1<0)) && cx1=0 + ((cy1<0)) && cy1=0 + ((cols0)); then + [[ $flag_clip ]] || ble/canvas/put.draw "$s" + ((x--,lc=32,lg=g)) + ble/canvas/trace/.measure-point + fi ;; + ($'\t') # HT + local tx + ((tx=(x+it)/it*it, + tx>=cols&&(tx=cols-1))) + if ((xwmax)) && w=$wmax is_overflow=1 + fi + local t=${s::w} + if [[ $flag_clip || $opt_relative || $flag_justify ]]; then + local tlen=$w len=$((cols-x)) + if ((tlen>len)); then + while ((tlen>len)); do + ble/canvas/trace/.put-ascii.draw "${t::len}" + t=${t:len} + ((x=cols,tlen-=len,len=cols)) + ble/canvas/trace/.NEL + done + w=${#t} + fi + fi + if [[ $flag_lchar ]]; then + local ret + ble/util/s2c "${s:w-1:1}" + lc=$ret lg=$g + fi + ble/canvas/trace/.put-ascii.draw "$t" + ((i+=${#s})) + if local extend; ble/unicode/GraphemeCluster/extend-ascii "$text" "$i"; then + ble/canvas/trace/.put-atomic.draw "${text:i:extend}" 0 + ((i+=extend)) + fi + else + local c w cs cb extend + ble/unicode/GraphemeCluster/match "$text" "$i" R + if [[ $opt_nooverflow ]] && ! ((x+w<=xlimit||y+1cols)); then + if [[ $flag_clip || $opt_relative || $flag_justify ]]; then + ble/canvas/trace/.NEL + else + ble/canvas/trace/.put-ascii.draw "${_ble_string_prototype::cols-x}" + fi + fi + lc=$c lg=$g + ble/canvas/trace/.put-atomic.draw "$cs" "$w" + fi + ((i+=1+extend)) + fi + [[ $is_overflow ]] && ble/canvas/trace/.process-overflow + done + if [[ $trace_flags == *J* ]]; then + if [[ ! $flag_justify ]]; then + [[ ${trace_scosc[5]} ]] && ble/canvas/trace/.scorc + [[ ${trace_decsc[5]} ]] && ble/canvas/trace/.decrc + while [[ ${trace_brack[0]} ]]; do ble/canvas/trace/.ps1rc; done + fi + ble/canvas/trace/.justify/end-line + DRAW_BUFF=("${justify_buff[@]}") + [[ $trace_flags == *B* ]] && + ((x1=jx1,y1=jy1,x2=jx2,y2=jy2)) + [[ $trace_flags == *G* ]] && + gx1=$jgx1 gy1=$jgy1 gx2=$jgx2 gy2=$jgy2 + if [[ $trace_flags == *C* ]]; then + ble/canvas/sflush.draw + x=$xinit y=$yinit g=$ginit + local trace_opts=clip=$cx1,$cy1-$cx2,$cy2 + [[ :$opts: == *:ansi:* ]] && trace_opts=$trace_opts:ansi + ble/canvas/trace/.impl "$ret" "$trace_opts" + cx=$x cy=$y cg=$g + fi + fi + [[ $trace_flags == *B* ]] && ((y2++)) + [[ $trace_flags == *G* ]] && ((gy2++)) + if [[ $trace_flags == *C* ]]; then + x=$cx y=$cy g=$cg + if [[ $trace_flags == *B* ]]; then + ((x1cx2)) && x1=$cx2 + ((x2cx2)) && x2=$cx2 + ((y1cy2)) && y1=$cy2 + ((y2cy2)) && y2=$cy2 + fi + if [[ $trace_flags == *G* ]]; then + if ((gx2<=cx1||cx2<=gx1||gy2<=cy1||cy2<=gy1)); then + gx1= gx2= gy1= gy2= + else + ((gx1cx2)) && gx2=$cx2 + ((gy1cy2)) && gy2=$cy2 + fi + fi + fi +} +function ble/canvas/trace.draw { + ble/canvas/trace/.impl "$@" 2>/dev/null # Note: suppress LC_COLLATE errors #D1205 #D1341 #D1440 +} +function ble/canvas/trace { + local -a DRAW_BUFF=() + ble/canvas/trace/.impl "$@" 2>/dev/null # Note: suppress LC_COLLATE errors #D1205 #D1341 #D1440 + ble/canvas/sflush.draw # -> ret +} +function ble/canvas/trace-text/.put-simple { + local nchar=$1 + ((nchar)) || return 0 + local nput=$((cols*lines-!_ble_term_xenl-(y*cols+x))) + ((nput>0)) || return 1 + ((nput>nchar)) && nput=$nchar + out=$out${2::nput} + ((x+=nput,y+=x/cols,x%=cols)) + ((_ble_term_xenl&&x==0&&(y--,x=cols))) + ((nput==nchar)); return "$?" +} +function ble/canvas/trace-text/.put-atomic { + local w=$1 c=$2 + ((y*cols+x+w<=cols*lines-!_ble_term_xenl)) || return 1 + if ((xlimit)); then + ble/string#reserve-prototype "$((limit-x))" + local pad=${_ble_string_prototype::limit-x} + out=$out$sgr1${pad//?/'#'}$sgr0 + x=$limit + ((y+10)); then + local ret + ble/unicode/GraphemeCluster/find-previous-boundary "$text" "$dbeg"; dbeg=$ret + local pos + ble/string#split-words pos "${_ble_textmap_pos[dbeg]}" + ((x=pos[0])) + ((y=pos[1])) + fi + fi + _ble_textmap_cols=$cols + _ble_textmap_length=$iN + ble/util/assert '((dbeg<0||(dbeg<=dend&&dbeg<=dend0)))' "($dbeg $dend $dend0) <- ($_ble_textmap_dbeg $_ble_textmap_dend $_ble_textmap_dend0)" + ble/array#reserve-prototype "$iN" + local -a old_pos old_ichg + old_pos=("${_ble_textmap_pos[@]:dend0:iN-dend+1}") + old_ichg=("${_ble_textmap_ichg[@]}") + _ble_textmap_pos=( + "${_ble_textmap_pos[@]::dbeg+1}" + "${_ble_array_prototype[@]::dend-dbeg}" + "${_ble_textmap_pos[@]:dend0+1:iN-dend}") + _ble_textmap_glyph=( + "${_ble_textmap_glyph[@]::dbeg}" + "${_ble_array_prototype[@]::dend-dbeg}" + "${_ble_textmap_glyph[@]:dend0:iN-dend}") + _ble_textmap_ichg=() + ble/urange#shift --prefix=_ble_textmap_ "$dbeg" "$dend" "$dend0" + local i extend + for ((i=dbeg;i=cols)); then + cs=' ' w=0 + ble/textmap#update/.wrap + else + local x2 + ((x2=(x/it+1)*it, + x2>=cols&&(x2=cols-1), + w=x2-x, + w!=it&&(changed=1))) + cs=${_ble_string_prototype::w} + fi + elif ((c==10)); then + w=0 + if [[ :$opts: == *:relative:* ]]; then + local pad=$((cols-x)) eraser= + if ((pad)); then + if [[ $_ble_term_ech ]]; then + eraser=${_ble_term_ech//'%d'/$pad} + else + eraser=${_ble_string_prototype::pad} + ((x=cols)) + fi + fi + local move=${_ble_term_cub//'%d'/$x}${_ble_term_cud//'%d'/1} + cs=$eraser$move + changed=1 + else + cs=$_ble_term_el$_ble_term_nl + fi + ((y++,x=0)) + fi + fi + local wrapping=0 + if ((w>0)); then + if ((xcols)); do + ((y++,x-=cols)) + done + if ((x==cols)); then + ble/textmap#update/.wrap + fi + fi + _ble_textmap_glyph[i]=$cs + ((changed)) && ble/array#push _ble_textmap_ichg "$i" + _ble_textmap_pos[i+1]="$x $y $wrapping" + ((i++)) + fi + while ((extend--)); do + _ble_textmap_glyph[i]= + _ble_textmap_pos[++i]="$x $y 0" + done + if ((i>=dend)); then + [[ ${old_pos[i-dend]} == "${_ble_textmap_pos[i]}" ]] && break + if [[ ${old_pos[i-dend]%%[$IFS]*} == "${_ble_textmap_pos[i]%%[$IFS]*}" ]]; then + local -a opos npos pos + opos=(${old_pos[i-dend]}) + npos=(${_ble_textmap_pos[i]}) + local ydelta=$((npos[1]-opos[1])) + while ((i=dend0)&&(ichg+=dend-dend0), + (0<=ichg&&ichg_ble_textmap_endy)); then + (($__ble_var=_ble_textmap_length)) + elif ((__ble_y<_ble_textmap_begy)); then + (($__ble_var=0)) + else + local __ble_l=0 __ble_u=$((_ble_textmap_length+1)) + local m mx my + while ((__ble_l+1<__ble_u)); do + ble/textmap#getxy.cur --prefix=m "$((m=(__ble_l+__ble_u)/2))" + (((__ble_yy||yh==y&&xh>x)); then + index=$end + lx=$x ly=$y + rx=$x ry=$y + elif "$getxy" "$beg"; ((yh0)) || continue + ((count++)) + ((min_delta<0||min_delta>delta)) && min_delta=$delta + done + ((count==0)) && break + if ((count*min_delta<=room)); then + for ((i=0;i0)) || continue + ((heights[i]+=min_delta)) + done + ((room-=count*min_delta)) + else + local delta=$((room/count)) rem=$((room%count)) count=0 + for ((i=0;i0)) || continue + ((heights[i]+=delta)) + ((count++=0;i--)); do + local sub=$((heights[i]-heights[i]*lines/min)) + if ((sub_ble_canvas_panel_height[i])) && + ble/canvas/panel#set-height.draw "$i" "${heights[i]}" + done +} +function ble/canvas/panel/is-last-line { + local ret + ble/arithmetic/sum "${_ble_canvas_panel_height[@]}" + ((_ble_canvas_y==ret-1)) +} +function ble/canvas/panel/goto-bottom-dock.draw { + if [[ ! $_ble_canvas_panel_bottom ]]; then + _ble_canvas_panel_bottom=1 + ble/canvas/excursion-start.draw + ble/canvas/put-cup.draw "$LINES" 0 # 一番下の行に移動 + ble/arithmetic/sum "${_ble_canvas_panel_height[@]}" + ((_ble_canvas_x=0,_ble_canvas_y=ret-1)) + fi +} +function ble/canvas/panel/goto-top-dock.draw { + if [[ $_ble_canvas_panel_bottom ]]; then + _ble_canvas_panel_bottom= + ble/canvas/excursion-end.draw + fi +} +function ble/canvas/panel/goto-vfill.draw { + ble/canvas/panel/has-bottom-dock || return 1 + local ret + ble/canvas/panel/goto-top-dock.draw + ble/arithmetic/sum "${_ble_canvas_panel_height[@]::_ble_canvas_panel_vfill}" + ble/canvas/goto.draw 0 "$ret" sgr0 + return 0 +} +function ble/canvas/panel/save-position { + ret=$_ble_canvas_x:$_ble_canvas_y:$_ble_canvas_panel_bottom + [[ :$2: == *:goto-top-dock:* ]] && + ble/canvas/panel/goto-top-dock.draw +} +function ble/canvas/panel/load-position { + local -a DRAW_BUFF=() + ble/canvas/panel/load-position.draw "$@" + ble/canvas/bflush.draw +} +function ble/canvas/panel/load-position.draw { + local data=$1 + local x=${data%%:*}; data=${data#*:} + local y=${data%%:*}; data=${data#*:} + local bottom=$data + if [[ $bottom ]]; then + ble/canvas/panel/goto-bottom-dock.draw + else + ble/canvas/panel/goto-top-dock.draw + fi + ble/canvas/goto.draw "$x" "$y" +} +function ble/canvas/panel/has-bottom-dock { + local ret; ble/canvas/panel/bottom-dock#height + ((ret)) +} +function ble/canvas/panel/bottom-dock#height { + ret=0 + [[ $_ble_canvas_panel_vfill && $_ble_term_rc ]] || return 0 + ble/arithmetic/sum "${_ble_canvas_panel_height[@]:_ble_canvas_panel_vfill}" +} +function ble/canvas/panel/top-dock#height { + if [[ $_ble_canvas_panel_vfill && $_ble_term_rc ]]; then + ble/arithmetic/sum "${_ble_canvas_panel_height[@]::_ble_canvas_panel_vfill}" + else + ble/arithmetic/sum "${_ble_canvas_panel_height[@]}" + fi +} +function ble/canvas/panel/bottom-dock#invalidate { + [[ $_ble_canvas_panel_vfill && $_ble_term_rc ]] || return 0 + local index n=${#_ble_canvas_panel_class[@]} + for ((index=_ble_canvas_panel_vfill;index=_ble_canvas_panel_vfill)) +} +function ble/canvas/panel#get-origin { + local ret index=$1 prefix= + [[ $2 == --prefix=* ]] && prefix=${2#*=} + ble/arithmetic/sum "${_ble_canvas_panel_height[@]::index}" + ((${prefix}x=0,${prefix}y=ret)) +} +function ble/canvas/panel#goto.draw { + local index=$1 x=${2-0} y=${3-0} opts=$4 ret + if ble/canvas/panel#is-bottom "$index"; then + ble/canvas/panel/goto-bottom-dock.draw + else + ble/canvas/panel/goto-top-dock.draw + fi + ble/arithmetic/sum "${_ble_canvas_panel_height[@]::index}" + ble/canvas/goto.draw "$x" "$((ret+y))" "$opts" +} +function ble/canvas/panel#put.draw { + ble/canvas/put.draw "$2" + ble/canvas/panel#report-cursor-position "$1" "$3" "$4" +} +function ble/canvas/panel#report-cursor-position { + local index=$1 x=${2-0} y=${3-0} ret + ble/arithmetic/sum "${_ble_canvas_panel_height[@]::index}" + ((_ble_canvas_x=x,_ble_canvas_y=ret+y)) +} +function ble/canvas/panel/increase-total-height.draw { + local delta=$1 + ((delta>0)) || return 1 + local ret + ble/canvas/panel/top-dock#height; local top_height=$ret + ble/canvas/panel/bottom-dock#height; local bottom_height=$ret + if ((bottom_height)); then + ble/canvas/panel/goto-top-dock.draw + if [[ $_ble_term_DECSTBM ]]; then + ble/canvas/excursion-start.draw + ble/canvas/put.draw $'\e[1;'$((LINES-bottom_height))'r' + ble/canvas/excursion-end.draw + ble/canvas/goto.draw 0 "$((top_height==0?0:top_height-1))" sgr0 + ble/canvas/put-ind.draw "$((top_height-1+delta-_ble_canvas_y))" + ((_ble_canvas_y=top_height-1+delta)) + ble/canvas/excursion-start.draw + ble/canvas/put.draw "$_ble_term_DECSTBM_reset" + ble/canvas/excursion-end.draw + return 0 + else + ble/canvas/panel/bottom-dock#invalidate + fi + fi + local old_height=$((top_height+bottom_height)) + local new_height=$((old_height+delta)) + ble/canvas/goto.draw 0 "$((top_height==0?0:top_height-1))" sgr0 + ble/canvas/put-ind.draw "$((new_height-1-_ble_canvas_y))"; ((_ble_canvas_y=new_height-1)) + ble/canvas/panel/goto-vfill.draw && + ble/canvas/put-il.draw "$delta" vfill +} +function ble/canvas/panel#set-height.draw { + local index=$1 new_height=$2 opts=$3 + ((new_height<0)) && new_height=0 + local old_height=${_ble_canvas_panel_height[index]} + local delta=$((new_height-old_height)) + if ((delta==0)); then + if [[ :$opts: == *:clear:* ]]; then + ble/canvas/panel#clear.draw "$index" + return "$?" + else + return 1 + fi + elif ((delta>0)); then + ble/canvas/panel/increase-total-height.draw "$delta" + ble/canvas/panel/goto-vfill.draw && + ble/canvas/put-dl.draw "$delta" vfill + ((_ble_canvas_panel_height[index]=new_height)) + case :$opts: in + (*:clear:*) + ble/canvas/panel#goto.draw "$index" 0 0 sgr0 + ble/canvas/put-clear-lines.draw "$old_height" "$new_height" panel ;; + (*:shift:*) # 先頭に行挿入 + ble/canvas/panel#goto.draw "$index" 0 0 sgr0 + ble/canvas/put-il.draw "$delta" panel ;; + (*) # 末尾に行挿入 + ble/canvas/panel#goto.draw "$index" 0 "$old_height" sgr0 + ble/canvas/put-il.draw "$delta" panel ;; + esac + else + ((delta=-delta)) + case :$opts: in + (*:clear:*) + ble/canvas/panel#goto.draw "$index" 0 0 sgr0 + ble/canvas/put-clear-lines.draw "$old_height" "$new_height" panel ;; + (*:shift:*) # 先頭を削除 + ble/canvas/panel#goto.draw "$index" 0 0 sgr0 + ble/canvas/put-dl.draw "$delta" panel ;; + (*) # 末尾を削除 + ble/canvas/panel#goto.draw "$index" 0 "$new_height" sgr0 + ble/canvas/put-dl.draw "$delta" panel ;; + esac + ((_ble_canvas_panel_height[index]=new_height)) + ble/canvas/panel/goto-vfill.draw && + ble/canvas/put-il.draw "$delta" vfill + fi + ble/function#try "${_ble_canvas_panel_class[index]}#panel::onHeightChange" "$index" + return 0 +} +function ble/canvas/panel#increase-height.draw { + local index=$1 delta=$2 opts=$3 + ble/canvas/panel#set-height.draw "$index" "$((_ble_canvas_panel_height[index]+delta))" "$opts" +} +function ble/canvas/panel#set-height-and-clear.draw { + local index=$1 new_height=$2 + ble/canvas/panel#set-height.draw "$index" "$new_height" clear +} +function ble/canvas/panel#clear.draw { + local index=$1 + local height=${_ble_canvas_panel_height[index]} + if ((height)); then + ble/canvas/panel#goto.draw "$index" 0 0 sgr0 + ble/canvas/put-clear-lines.draw "$height" + fi +} +function ble/canvas/panel#clear-after.draw { + local index=$1 x=$2 y=$3 + local height=${_ble_canvas_panel_height[index]} + ((yLINES)) && tmargin=$LINES + ((tmargin>0)) || return 0 + local ret + ble/canvas/panel/save-position; local pos=$ret + ble/canvas/panel/goto-top-dock.draw + ble/canvas/panel/top-dock#height; local top_height=$ret + ble/canvas/panel/bottom-dock#height; local bottom_height=$ret + if ((bottom_height)); then + if [[ $_ble_term_DECSTBM ]]; then + ble/canvas/excursion-start.draw + ble/canvas/put.draw $'\e[1;'$((LINES-bottom_height))'r' + ble/canvas/excursion-end.draw + ble/canvas/goto.draw 0 0 sgr0 + if [[ $_ble_term_ri ]]; then + ble/canvas/put-ri.draw "$tmargin" + ble/canvas/put-cud.draw "$tmargin" + else + ble/canvas/put-ind.draw "$((top_height-1+tmargin))" + ble/canvas/put-cuu.draw "$((top_height-1+tmargin))" + ble/canvas/excursion-start.draw + ble/canvas/put-cup.draw 1 1 + ble/canvas/put-il.draw "$tmargin" no-lastline + ble/canvas/excursion-end.draw + fi + ble/canvas/excursion-start.draw + ble/canvas/put.draw "$_ble_term_DECSTBM_reset" + ble/canvas/excursion-end.draw + ble/canvas/panel/load-position.draw "$pos" + return 0 + else + ble/canvas/panel/bottom-dock#invalidate + fi + fi + ble/canvas/goto.draw 0 0 sgr0 + if [[ $_ble_term_ri ]]; then + ble/canvas/put-ri.draw "$tmargin" + ble/canvas/put-cud.draw "$tmargin" + else + local total_height=$((top_height+bottom_height)) + ble/canvas/put-ind.draw "$((total_height-1+tmargin))" + ble/canvas/put-cuu.draw "$((total_height-1+tmargin))" + if [[ $_ble_term_rc ]]; then + ble/canvas/excursion-start.draw + ble/canvas/put-cup.draw 1 1 + ble/canvas/put-il.draw "$tmargin" no-lastline + ble/canvas/excursion-end.draw + else + ble/canvas/put-il.draw "$tmargin" no-lastline + fi + ble/canvas/put-cud.draw "$tmargin" + fi + ble/canvas/panel/load-position.draw "$pos" +} +bleopt/declare -v history_limit_length 10000 +_ble_history=() +_ble_history_edit=() +_ble_history_dirt=() +_ble_history_index=0 +_ble_history_count= +function ble/builtin/history/is-empty { + ! ble/util/assign.has-output 'builtin history 1' +} +if ((_ble_bash>=50000)); then + function ble/builtin/history/.check-timestamp-sigsegv { return 0; } +else + function ble/builtin/history/.check-timestamp-sigsegv { + local stat=$1 + ((stat)) || return 0 + local ret=11 + ble/builtin/trap/sig#resolve SIGSEGV + ((stat==128+ret)) || return 0 + local msg="bash: SIGSEGV: suspicious timestamp in HISTFILE" + local histfile=${HISTFILE-} + if [[ -s $histfile ]]; then + msg="$msg='$histfile'" + local rex_broken_timestamp='^#[0-9]\{12\}' + ble/util/assign line 'ble/bin/grep -an "$rex_broken_timestamp" "$histfile"' + ble/string#split line : "$line" + [[ $line =~ ^[0-9]+$ ]] && msg="$msg (line $line)" + fi + if [[ ${_ble_edit_io_fname2-} ]]; then + ble/util/print $'\n'"$msg" >> "$_ble_edit_io_fname2" + else + ble/util/print "$msg" >&2 + fi + } +fi +if ((_ble_bash<40000)); then + function ble/builtin/history/.dump.proc { + local LC_ALL= LC_MESSAGES=C 2>/dev/null + builtin history "${args[@]}" + ble/util/unlocal LC_ALL LC_MESSAGES 2>/dev/null + } + function ble/builtin/history/.dump { + local -a args; args=("$@") + ble/util/conditional-sync \ + ble/builtin/history/.dump.proc \ + 'builtin true' 100 progressive-weight:timeout=3000:SIGKILL + local ext=$? + if ((ext==142)); then + printf 'ble.sh: timeout: builtin history %s' "$*" >&"$_ble_util_fd_tui_stderr" + local ret=11 + ble/builtin/trap/sig#resolve SIGSEGV + ((ext=128+ret)) + fi + ble/builtin/history/.check-timestamp-sigsegv "$ext" + return "$ext" + } +else + function ble/builtin/history/.dump { + local LC_ALL= LC_MESSAGES=C 2>/dev/null + builtin history "$@" + ble/util/unlocal LC_ALL LC_MESSAGES 2>/dev/null + } +fi +if ((_ble_bash>=50200)); then + function ble/builtin/history/.get-min { + if ((${_ble_trap_sig-0}==_ble_builtin_trap_EXIT)); then + ble/string#split-words min "$(builtin history | ble/bin/sed -n '1{p;q;}')" # subshell + else + ble/util/assign-words min 'builtin history | ble/bin/sed -n "1{p;q;}"' + fi + min=${min/'*'} + } +elif ((_ble_bash>=40000)); then + function ble/builtin/history/.get-min { + ble/util/assign-words min 'builtin history | ble/bin/sed -n "1{p;q;}"' + min=${min/'*'} + } +else + function ble/builtin/history/.get-min { + ble/util/assign-words min 'ble/builtin/history/.dump | ble/bin/sed -n "1{p;q;}"' + min=${min/'*'} + } +fi +function ble/builtin/history/.get-max { + ble/util/assign-words max 'builtin history 1' + max=${max/'*'} +} +_ble_history_load_done= +function ble/history:bash/clear-background-load { + blehook/invoke history_reset_background +} +if ((_ble_bash>=40000)); then + _ble_history_load_resume=0 + _ble_history_load_bgpid= + function ble/history:bash/load/.background-initialize { + if ble/builtin/history/is-empty; then + builtin history -n + fi + local HISTTIMEFORMAT=__ble_ext__ + local -x INDEX_FILE=$history_indfile + local -x opt_source= opt_null= + if [[ $load_strategy == source ]]; then + opt_source=1 + elif [[ $load_strategy == mapfile ]]; then + opt_null=1 + fi + if [[ ! $_ble_util_writearray_rawbytes ]]; then + local IFS=$_ble_term_IFS __ble_tmp; __ble_tmp=('\'{2,3}{0..7}{0..7}) + builtin eval "local _ble_util_writearray_rawbytes=\$'${__ble_tmp[*]}'" + fi + local -x __ble_rawbytes=$_ble_util_writearray_rawbytes # used by _ble_bin_awk_libES + local -x fname_stderr=${_ble_edit_io_fname2:-} + local -x invalid_timestamp_msg='invalid timestamp' + local histfile=${HISTFILE:-$HOME/.bash_history} + [[ -s $histfile ]] && + invalid_timestamp_msg=$invalid_timestamp_msg". Please check your history file ($histfile)." + local apos=\' + ble/builtin/history/.dump ${arg_count:+"$arg_count"} | ble/bin/awk -v apos="$apos" -v arg_offset="$arg_offset" -v _ble_bash="$_ble_bash" ' + '"$_ble_bin_awk_libES"' + BEGIN { + es_initialize(); + INDEX_FILE = ENVIRON["INDEX_FILE"]; + opt_null = ENVIRON["opt_null"]; + opt_source = ENVIRON["opt_source"]; + if (!opt_null && !opt_source) + printf("") > INDEX_FILE; # create file + fname_stderr = ENVIRON["fname_stderr"]; + fname_stderr_count = 0; + invalid_timestamp_msg = ENVIRON["invalid_timestamp_msg"]; + n = 0; + hindex = arg_offset; + } + function flush_line() { + if (n < 1) return; + if (opt_null) { + if (t ~ /^eval -- \$'"$apos"'([^'"$apos"'\\]|\\.)*'"$apos"'$/) + t = es_unescape(substr(t, 11, length(t) - 11)); # disable=#D1440 (\c? is unsed) + printf("%s%c", t, 0); + } else if (opt_source) { + if (t ~ /^eval -- \$'"$apos"'([^'"$apos"'\\]|\\.)*'"$apos"'$/) + t = es_unescape(substr(t, 11, length(t) - 11)); # disable=#D1440 (\c? is unsed) + gsub(/'"$apos"'/, "'"$apos"'\\'"$apos$apos"'", t); + print "_ble_history[" hindex "]=" apos t apos; + } else { + if (n == 1) { + if (t ~ /^eval -- \$'"$apos"'([^'"$apos"'\\]|\\.)*'"$apos"'$/) + print hindex > INDEX_FILE; + } else { + gsub(/['"$apos"'\\]/, "\\\\&", t); + gsub(/\n/, "\\n", t); + print hindex > INDEX_FILE; + t = "eval -- $" apos t apos; + } + print t; + } + hindex++; + n = 0; + t = ""; + } + function check_invalid_timestamp(line) { + if (line ~ /^ *[0-9]+\*? +.+: invalid timestamp/ && fname_stderr != "") { + sub(/^ *0*/, "bash: history !", line); + sub(/: invalid timestamp.*$/, ": " invalid_timestamp_msg, line); + if (fname_stderr_count++ == 0) + print "" >> fname_stderr; + print line >> fname_stderr; + } + } + { + check_invalid_timestamp($0); + if (sub(/^ *[0-9]+\*? +(__ble_ext__|\?\?|.+: invalid timestamp)/, "", $0)) + flush_line(); + t = ++n == 1 ? $0 : t "\n" $0; + } + END { flush_line(); } + ' >| "$history_tmpfile.part" + ble/builtin/history/.check-timestamp-sigsegv "${PIPESTATUS[0]}" + ble/bin/mv -f "$history_tmpfile.part" "$history_tmpfile" + } + function ble/history:bash/load { + local opts=$1 + local opt_async=; [[ :$opts: == *:async:* ]] && opt_async=1 + local load_strategy=mapfile + if [[ $OSTYPE == cygwin* || $OSTYPE == msys* ]]; then + load_strategy=source + elif ((_ble_bash<50200)); then + load_strategy=nlfix + fi + local arg_count= arg_offset=0 ret + [[ :$opts: == *:append:* ]] && arg_offset=${#_ble_history[@]} + ble/opts#extract-last-optarg "$opts" count && arg_count=$ret + local history_tmpfile=$_ble_base_run/$$.history.load + local history_indfile=$_ble_base_run/$$.history.multiline-index + [[ $opt_async || :$opts: == *:init:* ]] || _ble_history_load_resume=0 + [[ ! $opt_async ]] && ((_ble_history_load_resume<6)) && + blehook/invoke history_message "loading history ..." + while ((1)); do + case $_ble_history_load_resume in + (0) # 履歴ファイル生成を Background で開始 + if [[ $_ble_history_load_bgpid ]]; then + builtin kill -9 "$_ble_history_load_bgpid" &>/dev/null + _ble_history_load_bgpid= + fi + >| "$history_tmpfile" + if [[ $opt_async ]]; then + _ble_history_load_bgpid=$(ble/util/nohup 'ble/history:bash/load/.background-initialize' print-bgpid) + function ble/history:bash/load/.background-initialize-completed { + local history_tmpfile=$_ble_base_run/$$.history.load + [[ -s $history_tmpfile ]] || ! builtin kill -0 "$_ble_history_load_bgpid" + } &>/dev/null + ((_ble_history_load_resume++)) + else + ble/history:bash/load/.background-initialize + ((_ble_history_load_resume+=3)) + fi ;; + (1) if [[ $opt_async ]] && ble/util/is-running-in-idle; then + ble/util/idle.wait-condition ble/history:bash/load/.background-initialize-completed + ((_ble_history_load_resume++)) + return 147 + fi + ((_ble_history_load_resume++)) ;; + (2) while ! ble/history:bash/load/.background-initialize-completed; do + ble/util/msleep 50 + [[ $opt_async ]] && ! ble/util/idle/IS_IDLE && return 148 + done + ((_ble_history_load_resume++)) ;; + (3) _ble_history_load_bgpid= + ((arg_offset==0)) && _ble_history=() + if [[ $load_strategy == source ]]; then + source -- "$history_tmpfile" + elif [[ $load_strategy == nlfix ]]; then + builtin mapfile -O "$arg_offset" -t _ble_history < "$history_tmpfile" + else + builtin mapfile -O "$arg_offset" -t -d '' _ble_history < "$history_tmpfile" + fi + ble/builtin/history/erasedups/update-base + ((_ble_history_load_resume++)) ;; + (4) ((arg_offset==0)) && _ble_history_edit=() + if [[ $load_strategy == source ]]; then + _ble_history_edit=("${_ble_history[@]}") + elif [[ $load_strategy == nlfix ]]; then + builtin mapfile -O "$arg_offset" -t _ble_history_edit < "$history_tmpfile" + else + builtin mapfile -O "$arg_offset" -t -d '' _ble_history_edit < "$history_tmpfile" + fi + >| "$history_tmpfile" + if [[ $load_strategy != nlfix ]]; then + ((_ble_history_load_resume+=3)) + continue + else + ((_ble_history_load_resume++)) + fi ;; + (5) local -a indices_to_fix + ble/util/mapfile indices_to_fix < "$history_indfile" + local i rex='^eval -- \$'\''([^\'\'']|\\.)*'\''$' + for i in "${indices_to_fix[@]}"; do + [[ ${_ble_history[i]} =~ $rex ]] && + builtin eval "_ble_history[i]=${_ble_history[i]:8}" + done + ((_ble_history_load_resume++)) ;; + (6) local -a indices_to_fix + [[ ${indices_to_fix+set} ]] || + ble/util/mapfile indices_to_fix < "$history_indfile" + local i + for i in "${indices_to_fix[@]}"; do + [[ ${_ble_history_edit[i]} =~ $rex ]] && + builtin eval "_ble_history_edit[i]=${_ble_history_edit[i]:8}" + done + ((_ble_history_load_resume++)) ;; + (7) [[ $opt_async ]] || blehook/invoke history_message + ((_ble_history_load_resume++)) + return 0 ;; + (*) return 1 ;; + esac + [[ $opt_async ]] && ! ble/util/idle/IS_IDLE && return 148 + done + } + blehook history_reset_background!=_ble_history_load_resume=0 +else + function ble/history:bash/load/.generate-source { + if ble/builtin/history/is-empty; then + builtin history -n + fi + local HISTTIMEFORMAT=__ble_ext__ + local apos="'" + ble/builtin/history/.dump ${arg_count:+"$arg_count"} | ble/bin/awk -v apos="'" ' + BEGIN { n = ""; } + /^ *[0-9]+\*? +(__ble_ext__|\?\?)#[0-9]/ { next; } + /^ *[0-9]+\*? +(__ble_ext__|\?\?|.+: invalid timestamp)/ { + if (n != "") { + n = ""; + print " " apos t apos; + } + n = $1; t = ""; + sub(/^ *[0-9]+\*? +(__ble_ext__|\?\?|.+: invalid timestamp)/, "", $0); + } + { + line = $0; + if (line ~ /^eval -- \$'"$apos"'([^'"$apos"'\\]|\\.)*'"$apos"'$/) + line = apos substr(line, 9) apos; + else + gsub(apos, apos "\\" apos apos, line); + gsub(/\001/, "'"$apos"'${_ble_term_SOH}'"$apos"'", line); + gsub(/\177/, "'"$apos"'${_ble_term_DEL}'"$apos"'", line); + gsub(/\015/, "'"$apos"'${_ble_term_CR}'"$apos"'", line); + t = t != "" ? t "\n" line : line; + } + END { + if (n != "") { + n = ""; + print " " apos t apos; + } + } + ' + } + function ble/history:bash/load { + local opts=$1 + local opt_append= + [[ :$opts: == *:append:* ]] && opt_append=1 + local arg_count= ret + ble/opts#extract-last-optarg "$opts" count && arg_count=$ret + blehook/invoke history_message "loading history..." + local result=$(ble/history:bash/load/.generate-source) # subshell + local IFS=$_ble_term_IFS + if [[ $opt_append ]]; then + if ((_ble_bash>=30100)); then + builtin eval -- "_ble_history+=($result)" + builtin eval -- "_ble_history_edit+=($result)" + else + local -a A; builtin eval -- "A=($result)" + _ble_history=("${_ble_history[@]}" "${A[@]}") + _ble_history_edit=("${_ble_history[@]}" "${A[@]}") + fi + else + builtin eval -- "_ble_history=($result)" + _ble_history_edit=("${_ble_history[@]}") + fi + ble/builtin/history/erasedups/update-base + ble/util/unlocal IFS + blehook/invoke history_message + } +fi +function ble/history:bash/initialize { + [[ $_ble_history_load_done ]] && return 0 + ble/history:bash/load "init:$@"; local ext=$? + ((ext)) && return "$ext" + local old_count=$_ble_history_count new_count=${#_ble_history[@]} + _ble_history_load_done=1 + _ble_history_count=$new_count + _ble_history_index=$_ble_history_count + ble/history/.update-position + local delta=$((new_count-old_count)) + ((delta>0)) && blehook/invoke history_change insert "$old_count" "$delta" +} +if ((_ble_bash>=30100)); then + _ble_history_mlfix_done= + _ble_history_mlfix_resume=0 + _ble_history_mlfix_bgpid= + function ble/history:bash/resolve-multiline/.awk { + local ret + ble/util/time + local -x epoch=$ret + local -x reason=$1 + local apos=\' + ble/bin/awk -v apos="$apos" -v _ble_bash="$_ble_bash" ' + BEGIN { + q = apos; + Q = apos "\\" apos apos; + reason = ENVIRON["reason"]; + is_resolve = reason == "resolve"; + TMPBASE = ENVIRON["tmpfile_base"]; + filename_source = TMPBASE ".part"; + if (is_resolve) + print "builtin history -c" > filename_source + entry_nline = 0; + entry_text = ""; + entry_time = ""; + if (_ble_bash >= 40400) + entry_time = ENVIRON["epoch"]; + command_count = 0; + multiline_count = 0; + modification_count = 0; + read_section_count = 0; + } + function write_flush(_, i, filename_section, t, c) { + if (command_count == 0) return; + if (command_count >= 2 || entry_time) { + filename_section = TMPBASE "." read_section_count++ ".part"; + for (i = 0; i < command_count; i++) { + t = command_time[i]; + c = command_text[i]; + if (t) print "#" t > filename_section; + print c > filename_section; + } + print "HISTTIMEFORMAT=%s builtin history -r " filename_section > filename_source; + } else { + for (i = 0; i < command_count; i++) { + c = command_text[i]; + gsub(/'"$apos"'/, Q, c); + print "builtin history -s -- " q c q > filename_source; + } + } + command_count = 0; + } + function write_complex(value) { + write_flush(); + print "builtin history -s -- " value > filename_source; + } + function register_command(cmd) { + command_time[command_count] = entry_time; + command_text[command_count] = cmd; + command_count++; + } + function is_escaped_command(cmd) { + return cmd ~ /^eval -- \$'"$apos"'([^'"$apos"'\\]|\\[\\'"$apos"'nt])*'"$apos"'$/; + } + function unescape_command(cmd) { + cmd = substr(cmd, 11, length(cmd) - 11); + gsub(/\\\\/, "\\q", cmd); + gsub(/\\n/, "\n", cmd); + gsub(/\\t/, "\t", cmd); + gsub(/\\'"$apos"'/, "'"$apos"'", cmd); + gsub(/\\q/, "\\", cmd); + return cmd; + } + function register_escaped_command(cmd) { + multiline_count++; + modification_count++; + if (_ble_bash >= 40400) { + register_command(unescape_command(cmd)); + } else { + write_complex(substr(cmd, 9)); + } + } + function register_multiline_command(cmd) { + multiline_count++; + if (_ble_bash >= 40040) { + register_command(cmd); + } else { + gsub(/'"$apos"'/, Q, cmd); + write_complex(q cmd q); + } + } + function flush_entry() { + if (entry_nline < 1) return; + if (is_escaped_command(entry_text)) { + register_escaped_command(entry_text) + } else if (entry_nline > 1) { + register_multiline_command(entry_text); + } else { + register_command(entry_text); + } + entry_nline = 0; + entry_text = ""; + } + function save_timestamp(line) { + if (is_resolve) { + if (line ~ /^ *[0-9]+\*? +__ble_time_[0-9]*__/) { + sub(/^ *[0-9]+\*? +__ble_time_/, "", line); + sub(/__.*$/, "", line); + entry_time = line; + } + } else { + if (line ~ /^#[0-9]/) { + sub(/^#/, "", line); + sub(/[^0-9].*$/, "", line); + entry_time = line; + } + } + } + { + if (is_resolve) { + save_timestamp($0); + if (sub(/^ *[0-9]+\*? +(__ble_time_[0-9]*__|\?\?|.+: invalid timestamp)/, "", $0)) + flush_entry(); + entry_text = ++entry_nline == 1 ? $0 : entry_text "\n" $0; + } else { + if ($0 ~ /^#[0-9]/) { + save_timestamp($0); + next; + } else { + flush_entry(); + entry_text = $0; + entry_nline = 1; + } + } + } + END { + flush_entry(); + write_flush(); + if (is_resolve) + print "builtin history -a /dev/null" > filename_source + print "multiline_count=" multiline_count; + print "modification_count=" modification_count; + } + ' + } + function ble/history:bash/resolve-multiline/.cleanup { + local file + for file in "$tmpfile_base".*; do >| "$file"; done + } + function ble/history:bash/resolve-multiline/.worker { + local HISTTIMEFORMAT=__ble_time_%s__ + local -x tmpfile_base=$_ble_base_run/$$.history.mlfix + local multiline_count=0 modification_count=0 + builtin eval -- "$(ble/builtin/history/.dump | ble/history:bash/resolve-multiline/.awk resolve 2>/dev/null)" + if ((modification_count)); then + ble/bin/mv -f "$tmpfile_base.part" "$tmpfile_base.sh" + else + ble/util/print : >| "$tmpfile_base.sh" + fi + } + function ble/history:bash/resolve-multiline/.is-HISTSIZE-unlimited { + [[ ${HISTSIZE+set} ]] || return 1 + ble/string#match "$HISTSIZE" '^[[:space:]]([-+]?[0-9]+)[[:space:]]*$' || return 0 + local histsize=$((BASH_REMATCH[1])) + ((_ble_bash>=40300&&(histize&0x10000000))) + } + function ble/history:bash/resolve-multiline/.load { + local tmpfile_base=$_ble_base_run/$$.history.mlfix + ble/history:bash/resolve-multiline/.is-HISTSIZE-unlimited || local HISTSIZE= + local HISTCONTROL= HISTIGNORE= + source -- "$tmpfile_base.sh" + ble/history:bash/resolve-multiline/.cleanup + } + function ble/history:bash/resolve-multiline.impl { + local opts=$1 + local opt_async=; [[ :$opts: == *:async:* ]] && opt_async=1 + local history_tmpfile=$_ble_base_run/$$.history.mlfix.sh + [[ $opt_async || :$opts: == *:init:* ]] || _ble_history_mlfix_resume=0 + [[ ! $opt_async ]] && ((_ble_history_mlfix_resume<=4)) && + blehook/invoke history_message "resolving multiline history ..." + while ((1)); do + case $_ble_history_mlfix_resume in + (0) if [[ $opt_async ]] && ble/builtin/history/is-empty; then + ble/util/idle.wait-user-input + ((_ble_history_mlfix_resume++)) + return 147 + fi + ((_ble_history_mlfix_resume++)) ;; + (1) # 履歴ファイル生成を Background で開始 + if [[ $_ble_history_mlfix_bgpid ]]; then + builtin kill -9 "$_ble_history_mlfix_bgpid" &>/dev/null + _ble_history_mlfix_bgpid= + fi + >| "$history_tmpfile" + if [[ $opt_async ]]; then + _ble_history_mlfix_bgpid=$(ble/util/nohup 'ble/history:bash/resolve-multiline/.worker' print-bgpid) + function ble/history:bash/resolve-multiline/.worker-completed { + local history_tmpfile=$_ble_base_run/$$.history.mlfix.sh + [[ -s $history_tmpfile ]] || ! builtin kill -0 "$_ble_history_mlfix_bgpid" + } &>/dev/null + ((_ble_history_mlfix_resume++)) + else + ble/history:bash/resolve-multiline/.worker + ((_ble_history_mlfix_resume+=3)) + fi ;; + (2) if [[ $opt_async ]] && ble/util/is-running-in-idle; then + ble/util/idle.wait-condition ble/history:bash/resolve-multiline/.worker-completed + ((_ble_history_mlfix_resume++)) + return 147 + fi + ((_ble_history_mlfix_resume++)) ;; + (3) while ! ble/history:bash/resolve-multiline/.worker-completed; do + ble/util/msleep 50 + [[ $opt_async ]] && ! ble/util/idle/IS_IDLE && return 148 + done + ((_ble_history_mlfix_resume++)) ;; + (4) _ble_history_mlfix_bgpid= + ble/history:bash/resolve-multiline/.load + [[ $opt_async ]] || blehook/invoke history_message + ((_ble_history_mlfix_resume++)) + return 0 ;; + (*) return 1 ;; + esac + [[ $opt_async ]] && ! ble/util/idle/IS_IDLE && return 148 + done + } + function ble/history:bash/resolve-multiline { + [[ $_ble_history_mlfix_done ]] && return 0 + if [[ $1 == sync ]]; then + ((_ble_bash>=40000)) && [[ $BASHPID != $$ ]] && return 0 + ble/builtin/history/is-empty && return 0 + fi + ble/history:bash/resolve-multiline.impl "$@"; local ext=$? + ((ext)) && return "$ext" + _ble_history_mlfix_done=1 + return 0 + } + ((_ble_bash>=40000)) && + ble/util/idle.push 'ble/history:bash/resolve-multiline async' + blehook history_reset_background!=_ble_history_mlfix_resume=0 + function ble/history:bash/resolve-multiline/readfile { + local filename=$1 + local -x tmpfile_base=$_ble_base_run/$$.history.read + ble/history:bash/resolve-multiline/.awk read < "$filename" &>/dev/null + source -- "$tmpfile_base.part" + ble/history:bash/resolve-multiline/.cleanup + } +else + function ble/history:bash/resolve-multiline/readfile { builtin history -r "$filename"; } + function ble/history:bash/resolve-multiline { return 0; } +fi +function ble/history:bash/unload.hook { + ble/util/is-running-in-subshell && return 0 + if shopt -q histappend &>/dev/null; then + ble/builtin/history -a + else + ble/builtin/history -w + fi +} +blehook unload!=ble/history:bash/unload.hook +function ble/history:bash/reset { + if ((_ble_bash>=40000)); then + _ble_history_load_done= + ble/history:bash/clear-background-load + ble/util/idle.push 'ble/history:bash/initialize async' + elif ((_ble_bash>=30100)) && [[ $bleopt_history_lazyload ]]; then + _ble_history_load_done= + else + ble/history:bash/initialize + fi +} +function ble/builtin/history/.touch-histfile { + local touch=$_ble_base_run/$$.history.touch + >| "$touch" +} +if [[ ! ${_ble_builtin_history_initialized+set} ]]; then + _ble_builtin_history_initialized= + _ble_builtin_history_histnew_count=0 + _ble_builtin_history_histapp_count=0 + _ble_builtin_history_wskip=0 + _ble_builtin_history_prevmax=0 + builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_builtin_history_rskip_dict}" + function ble/builtin/history/.get-rskip { + local file=$1 ret + ble/gdict#get _ble_builtin_history_rskip_dict "$file" + rskip=$ret + } + function ble/builtin/history/.set-rskip { + local file=$1 + ble/gdict#set _ble_builtin_history_rskip_dict "$file" "$2" + } + function ble/builtin/history/.add-rskip { + local file=$1 ret + ble/gdict#get _ble_builtin_history_rskip_dict "$file" + ((ret+=$2)) + ble/gdict#set _ble_builtin_history_rskip_dict "$file" "$ret" + } +fi +function ble/builtin/history/.initialize { + [[ $_ble_builtin_history_initialized ]] && return 0 + local line; ble/util/assign line 'builtin history 1' + [[ ! $_ble_decode_hook_count && ! $line && :$1: == *:skip0:* ]] && return 1 + _ble_builtin_history_initialized=1 + local histnew=$_ble_base_run/$$.history.new + >| "$histnew" + if [[ $line ]]; then + local histini=$_ble_base_run/$$.history.ini + local histapp=$_ble_base_run/$$.history.app + HISTTIMEFORMAT=1 builtin history -a "$histini" + if [[ -s $histini ]]; then + ble/bin/sed '/^#\([0-9].*\)/{s// 0 __ble_time_\1__/;N;s/\n//;}' "$histini" >> "$histapp" + >| "$histini" + fi + else + ble/builtin/history/option:r + fi + local histfile=${HISTFILE-} rskip=0 + [[ -e $histfile ]] && ble/util/assign rskip 'ble/bin/wc -l "$histfile" 2>/dev/null' + ble/string#split-words rskip "$rskip" + local min; ble/builtin/history/.get-min + local max; ble/builtin/history/.get-max + ((max&&max-min+1=50000&&beg=beg;i--)); do + builtin history -d "$i" + done + fi +} +function ble/builtin/history/.check-uncontrolled-change { + [[ $_ble_decode_bind_state == none ]] && return 0 + local filename=${1-} opts=${2-} prevmax=$_ble_builtin_history_prevmax + local max; ble/builtin/history/.get-max + if ((max!=prevmax)); then + if [[ $filename && :$opts: == *:append:* ]] && ((_ble_builtin_history_wskip0)) || return 0 + if [[ ! $_ble_history_load_done ]]; then + ble/history:bash/clear-background-load + _ble_history_count= + return 0 + fi + if ((_ble_bash>=40000&&delta>=10000)); then + ble/history:bash/reset + return 0 + fi + ble/history:bash/load append:count=$delta + local ocount=$_ble_history_count ncount=${#_ble_history[@]} + ((_ble_history_index==_ble_history_count)) && _ble_history_index=$ncount + _ble_history_count=$ncount + ble/history/.update-position + blehook/invoke history_change insert "$ocount" "$delta" +} +function ble/builtin/history/.read { + local file=$1 skip=${2:-0} fetch=$3 + local -x histnew=$_ble_base_run/$$.history.new + if [[ -s $file ]]; then + local awk_script=' + BEGIN { histnew = ENVIRON["histnew"]; count = 0; } + NR <= skip { next; } + { print $0 >> histnew; count++; } + END { + print "ble/builtin/history/.set-rskip \"$file\" " NR; + print "((_ble_builtin_history_histnew_count+=" count "))"; + }' + ble/util/eval-stdout 'ble/bin/awk -v skip="$skip" "$awk_script" "$file"' + else + ble/builtin/history/.set-rskip "$file" 0 + fi + if [[ ! $fetch && -s $histnew ]]; then + local nline=$_ble_builtin_history_histnew_count + ble/history:bash/resolve-multiline/readfile "$histnew" + >| "$histnew" + _ble_builtin_history_histnew_count=0 + ble/builtin/history/.load-recent-entries "$nline" + local max; ble/builtin/history/.get-max + _ble_builtin_history_wskip=$max + _ble_builtin_history_prevmax=$max + fi +} +function ble/builtin/history/.write { + local -x file=$1 skip=${2:-0} opts=$3 + local -x histapp=$_ble_base_run/$$.history.app + declare -p HISTTIMEFORMAT &>/dev/null + local -x flag_timestamp=$(($?==0)) + local min; ble/builtin/history/.get-min + local max; ble/builtin/history/.get-max + ((skip0)); then + local HISTTIMEFORMAT=__ble_time_%s__ + if [[ :$opts: == *:append:* ]]; then + ble/builtin/history/.dump "$delta" >> "$histapp" + ((_ble_builtin_history_histapp_count+=delta)) + else + ble/builtin/history/.dump "$delta" >| "$histapp" + _ble_builtin_history_histapp_count=$delta + fi + fi + if [[ ! -e $file ]]; then + (umask 077; >| "$file") + elif [[ :$opts: != *:append:* ]]; then + >| "$file" + fi + if [[ :$opts: != *:fetch:* && -s $histapp ]]; then + local apos=\' + < "$histapp" ble/bin/awk ' + BEGIN { + file = ENVIRON["file"]; + flag_timestamp = ENVIRON["flag_timestamp"]; + timestamp = ""; + mode = 0; + } + function flush_line() { + if (!mode) return; + mode = 0; + if (text ~ /\n/) { + gsub(/['"$apos"'\\]/, "\\\\&", text); + gsub(/\n/, "\\n", text); + gsub(/\t/, "\\t", text); + text = "eval -- $'"$apos"'" text "'"$apos"'" + } + if (timestamp != "") + print timestamp >> file; + print text >> file; + } + function extract_timestamp(line) { + if (!sub(/^ *[0-9]+\*? +__ble_time_/, "", line)) return ""; + if (!sub(/__.*$/, "", line)) return ""; + if (!(line ~ /^[0-9]+$/)) return ""; + return "#" line; + } + /^ *[0-9]+\*? +(__ble_time_[0-9]*__|\?\?|.+: invalid timestamp)?/ { + flush_line(); + mode = 1; + text = ""; + if (flag_timestamp) + timestamp = extract_timestamp($0); + sub(/^ *[0-9]+\*? +(__ble_time_[0-9]*__|\?\?|.+: invalid timestamp)?/, "", $0); + } + { text = text != "" ? text "\n" $0 : $0; } + END { flush_line(); } + ' + ble/builtin/history/.add-rskip "$file" "$_ble_builtin_history_histapp_count" + >| "$histapp" + _ble_builtin_history_histapp_count=0 + fi + _ble_builtin_history_wskip=$max + _ble_builtin_history_prevmax=$max +} +function ble/builtin/history/array#delete-hindex { + local array_name=$1; shift + local script=' + local -a out=() + local i shift=0 + for i in "${!NAME[@]}"; do + local delete= + while (($#)); do + if [[ $1 == *-* ]]; then + local b=${1%-*} e=${1#*-} + ((imax&&(beg=max)))) + ((end<0)) && ((end+=max+1)); ((endmax&&(end=max)))) + ((beg<=end)) || return 0 + ble/builtin/history/.delete-range "$beg" "$end" + if ((_ble_builtin_history_wskip>=end)); then + ((_ble_builtin_history_wskip-=end-beg+1)) + elif ((_ble_builtin_history_wskip>beg-1)); then + ((_ble_builtin_history_wskip=beg-1)) + fi + if [[ $_ble_decode_bind_state != none ]]; then + if [[ $_ble_history_load_done ]]; then + local N=${#_ble_history[@]} + local b=$((beg-1+N-max)) e=$((end+N-max)) + blehook/invoke history_change delete "$b-$e" + if ((_ble_history_index>=e)); then + ((_ble_history_index-=e-b)) + elif ((_ble_history_index>=b)); then + _ble_history_index=$b + fi + _ble_history=("${_ble_history[@]::b}" "${_ble_history[@]:e}") + _ble_history_edit=("${_ble_history_edit[@]::b}" "${_ble_history_edit[@]:e}") + _ble_history_count=${#_ble_history[@]} + else + ble/history:bash/clear-background-load + _ble_history_count= + fi + ble/history/.update-position + fi + local max; ble/builtin/history/.get-max + _ble_builtin_history_prevmax=$max +} +function ble/builtin/history/.get-histfile { + histfile=${1:-${HISTFILE-}} + if [[ ! $histfile ]]; then + local opt=-a + [[ ${FUNCNAME[1]} == *:[!:] ]] && opt=-${FUNCNAME[1]##*:} + if [[ ${1+set} ]]; then + ble/util/print "ble/builtin/history $opt: the history filename is empty." >&2 + else + ble/util/print "ble/builtin/history $opt: the history file is not specified." >&2 + fi + return 1 + fi +} +function ble/builtin/history/option:a { + ble/builtin/history/.initialize skip0 || return "$?" + local histfile; ble/builtin/history/.get-histfile "$@" || return "$?" + ble/builtin/history/.check-uncontrolled-change "$histfile" append + local rskip; ble/builtin/history/.get-rskip "$histfile" + ble/builtin/history/.write "$histfile" "$_ble_builtin_history_wskip" append:fetch + [[ -r $histfile ]] && ble/builtin/history/.read "$histfile" "$rskip" fetch + ble/builtin/history/.write "$histfile" "$_ble_builtin_history_wskip" append + builtin history -a /dev/null # Bash 終了時に書き込まない +} +function ble/builtin/history/option:n { + local histfile; ble/builtin/history/.get-histfile "$@" || return "$?" + if [[ $histfile == ${HISTFILE-} ]]; then + local touch=$_ble_base_run/$$.history.touch + [[ $touch -nt ${HISTFILE-} ]] && return 0 + >| "$touch" + fi + ble/builtin/history/.initialize + local rskip; ble/builtin/history/.get-rskip "$histfile" + ble/builtin/history/.read "$histfile" "$rskip" +} +function ble/builtin/history/option:w { + ble/builtin/history/.initialize skip0 || return "$?" + local histfile; ble/builtin/history/.get-histfile "$@" || return "$?" + local rskip; ble/builtin/history/.get-rskip "$histfile" + [[ -r $histfile ]] && ble/builtin/history/.read "$histfile" "$rskip" fetch + ble/builtin/history/.write "$histfile" 0 + builtin history -a /dev/null # Bash 終了時に書き込まない +} +function ble/builtin/history/option:r { + local histfile; ble/builtin/history/.get-histfile "$@" || return "$?" + ble/builtin/history/.initialize + ble/builtin/history/.read "$histfile" 0 +} +function ble/builtin/history/option:p { + ((_ble_bash>=40000)) || ble/builtin/history/is-empty || + ble/history:bash/resolve-multiline sync + local line1= line2= + ble/util/assign line1 'HISTTIMEFORMAT= builtin history 1' + builtin history -p -- '' &>/dev/null + ble/util/assign line2 'HISTTIMEFORMAT= builtin history 1' + if [[ $line1 != "$line2" ]]; then + local rex_head='^[[:blank:]]*[0-9]+\*?[[:blank:]]*' + [[ $line1 =~ $rex_head ]] && + line1=${line1:${#BASH_REMATCH}} + if ((_ble_bash<30100)); then + local tmp=$_ble_base_run/$$.history.tmp + printf '%s\n' "$line1" "$line1" >| "$tmp" + builtin history -r "$tmp" + else + builtin history -s -- "$line1" + builtin history -s -- "$line1" + fi + fi + builtin history -p -- "$@" +} +bleopt/declare -v history_erasedups_limit 0 +: "${_ble_history_erasedups_base=}" +function ble/builtin/history/erasedups/update-base { + if [[ ! ${_ble_history_erasedups_base:-} ]]; then + _ble_history_erasedups_base=${#_ble_history[@]} + else + local value=${#_ble_history[@]} + ((value<_ble_history_erasedups_base&&(_ble_history_erasedups_base=value))) + fi +} +function ble/builtin/history/erasedups/.impl-for { + local cmd=$1 + delete_indices=() + shift_histindex_next=0 + shift_wskip=0 + local i + for ((i=0;i| "$itmp1" & local pid1=$! + ble/util/writearray "${writearray_options[@]}" _ble_history_edit >| "$itmp2" + wait "$pid1" ) + local -x erasedups_cmd=$cmd + local -x erasedups_out1=$otmp1 + local -x erasedups_out2=$otmp2 + local -x erasedups_histindex_next=$HISTINDEX_NEXT + local -x erasedups_wskip=$_ble_builtin_history_wskip + local awk_script=' + '"$_ble_bin_awk_libES"' + '"$_ble_bin_awk_libNLFIX"' + BEGIN { + NLFIX_READ = ENVIRON["erasedups_nlfix_read"] != ""; + cmd = ENVIRON["erasedups_cmd"]; + out1 = ENVIRON["erasedups_out1"]; + out2 = ENVIRON["erasedups_out2"]; + histindex_next = ENVIRON["erasedups_histindex_next"]; + wskip = ENVIRON["erasedups_wskip"]; + if (NLFIX_READ) + es_initialize(); + else + RS = "\0"; + NLFIX_WRITE = _ble_bash < 50200; + if (NLFIX_WRITE) nlfix_begin(); + hist_index = 0; + edit_index = 0; + delete_count = 0; + shift_histindex_next = 0; + shift_wskip = 0; + } + function process_hist(elem) { + if (hist_index < N - 1 && elem == cmd) { + delete_indices[delete_count++] = hist_index; + delete_table[hist_index] = 1; + if (hist_index < wskip ) shift_wskip++; + if (hist_index < histindex_next) shift_histindex_next++; + } else { + if (NLFIX_WRITE) + nlfix_push(elem, out1); + else + printf("%s%c", elem, 0) > out1; + } + hist_index++; + } + function process_edit(elem) { + if (delete_count == 0) exit; + if (NLFIX_WRITE) { + if (edit_index == 0) { + nlfix_end(out1); + nlfix_begin(); + } + if (!delete_table[edit_index++]) + nlfix_push(elem, out2); + } else { + if (!delete_table[edit_index++]) + printf("%s%c", elem, 0) > out2; + } + } + mode == "edit" { + if (NLFIX_READ) { + edit[edit_index++] = $0; + } else { + process_edit($0); + } + next; + } + { + if (NLFIX_READ) + hist[hist_index++] = $0; + else + process_hist($0); + } + END { + if (NLFIX_READ) { + n = split(hist[hist_index - 1], indices) + for (i = 1; i <= n; i++) { + elem = hist[indices[i]]; + if (elem ~ /^\$'\''.*'\''/) + hist[indices[i]] = es_unescape(substr(elem, 3, length(elem) - 3)); # disable=#D1440 (\c? is unsed) + } + n = hist_index - 1; + hist_index = 0; + for (i = 0; i < n; i++) + process_hist(hist[i]); + n = split(edit[edit_index - 1], indices) + for (i = 1; i <= n; i++) { + elem = edit[indices[i]]; + if (elem ~ /^\$'\''.*'\''/) + edit[indices[i]] = es_unescape(substr(elem, 3, length(elem) - 3)); # disable=#D1440 (\c? is unsed) + } + n = edit_index - 1; + edit_index = 0; + for (i = 0; i < n; i++) + process_edit(edit[i]); + } + if (NLFIX_WRITE) nlfix_end(out2); + line = "delete_indices=(" + for (i = 0; i < delete_count; i++) { + if (i != 0) line = line " "; + line = line delete_indices[i]; + } + line = line ")"; + print line; + print "shift_wskip=" shift_wskip; + print "shift_histindex_next=" shift_histindex_next; + } + ' + local awk_result + ble/util/assign awk_result '"$awk" -v _ble_bash="$_ble_bash" -v N="$N" "$awk_script" "$itmp1" mode=edit "$itmp2"' + builtin eval -- "$awk_result" + if ((${#delete_indices[@]})); then + if ((_ble_bash<50200)); then + ble/util/readarray --nlfix _ble_history < "$otmp1" + ble/util/readarray --nlfix _ble_history_edit < "$otmp2" + else + mapfile -d '' -t _ble_history < "$otmp1" + mapfile -d '' -t _ble_history_edit < "$otmp2" + fi + fi + _ble_local_tmpfile=$itmp2 ble/util/assign/rmtmp + _ble_local_tmpfile=$itmp1 ble/util/assign/rmtmp + _ble_local_tmpfile=$otmp2 ble/util/assign/rmtmp + _ble_local_tmpfile=$otmp1 ble/util/assign/rmtmp +} +function ble/builtin/history/erasedups/.impl-ranged { + local cmd=$1 beg=$2 + delete_indices=() + shift_histindex_next=0 + shift_wskip=0 + ble/path#remove HISTCONTROL erasedups + HISTCONTROL=$HISTCONTROL:ignoredups + local i j=$beg + for ((i=beg;i=0;i--)); do + builtin history -d "$((delete_indices[i]-max_index+max))" + done + fi +} +function ble/builtin/history/erasedups { + local cmd=$1 + local beg=0 N=${#_ble_history[@]} + if [[ $bleopt_history_erasedups_limit ]]; then + local limit=$((bleopt_history_erasedups_limit)) + if ((limit<=0)); then + ((beg=_ble_history_erasedups_base+limit)) + else + ((beg=N-1-limit)) + fi + ((beg<0)) && beg=0 + fi + local delete_indices shift_histindex_next shift_wskip + if ((beg>=N)); then + ble/path#remove HISTCONTROL erasedups + return 0 + elif ((beg>0)); then + ble/builtin/history/erasedups/.impl-ranged "$cmd" "$beg" + else + if ((_ble_bash>=40000&&N>=20000)); then + ble/builtin/history/erasedups/.impl-awk "$cmd" + else + ble/builtin/history/erasedups/.impl-for "$cmd" + fi + fi + if ((${#delete_indices[@]})); then + blehook/invoke history_change delete "${delete_indices[@]}" + ((_ble_builtin_history_wskip-=shift_wskip)) + [[ ${HISTINDEX_NEXT+set} ]] && ((HISTINDEX_NEXT-=shift_histindex_next)) + else + ((N)) && [[ ${_ble_history[N-1]} == "$cmd" ]] && return 9 + fi +} +function ble/builtin/history/option:s { + ble/builtin/history/.initialize + if [[ $_ble_decode_bind_state == none ]]; then + builtin history -s -- "$@" + return 0 + fi + local cmd=$1 + if [[ $HISTIGNORE ]]; then + local pats pat + ble/string#split pats : "$HISTIGNORE" + for pat in "${pats[@]}"; do + [[ $cmd == $pat ]] && return 0 + done + local HISTIGNORE= + fi + local HISTCONTROL=$HISTCONTROL + if [[ $HISTCONTROL ]]; then + [[ :$HISTCONTROL: == *:ignoreboth:* ]] && + HISTCONTROL=$HISTCONTROL:ignorespace:ignoredups + if [[ :$HISTCONTROL: == *:ignorespace:* ]]; then + [[ $cmd == [' ']* ]] && return 0 + fi + if [[ :$HISTCONTROL: == *:strip:* ]]; then + local ret + ble/string#rtrim "$cmd" + ble/string#match "$ret" $'^[ \t]*(\n([ \t]*\n)*)?' + cmd=${ret:${#BASH_REMATCH}} + [[ $BASH_REMATCH == *$'\n'* && $cmd == *$'\n'* ]] && cmd=$'\n'$cmd + fi + fi + local use_bash300wa= + if [[ $_ble_history_load_done ]]; then + if [[ $HISTCONTROL ]]; then + if [[ :$HISTCONTROL: == *:ignoredups:* ]]; then + local lastIndex=$((${#_ble_history[@]}-1)) + ((lastIndex>=0)) && [[ $cmd == "${_ble_history[lastIndex]}" ]] && return 0 + fi + if [[ :$HISTCONTROL: == *:erasedups:* ]]; then + ble/builtin/history/erasedups "$cmd" + (($?==9)) && return 0 + fi + fi + local topIndex=${#_ble_history[@]} + _ble_history[topIndex]=$cmd + _ble_history_edit[topIndex]=$cmd + _ble_history_count=$((topIndex+1)) + _ble_history_index=$_ble_history_count + ((_ble_bash<30100)) && use_bash300wa=1 + else + if [[ $HISTCONTROL ]]; then + _ble_history_count= + else + [[ $_ble_history_count ]] && + ((_ble_history_count++)) + fi + fi + ble/history/.update-position + if [[ $use_bash300wa ]]; then + if [[ $cmd == *$'\n'* ]]; then + ble/util/sprintf cmd 'eval -- %q' "$cmd" + fi + local tmp=$_ble_base_run/$$.history.tmp + [[ ${HISTFILE-} && ! $bleopt_history_share ]] && + ble/util/print "$cmd" >> "${HISTFILE-}" + ble/util/print "$cmd" >| "$tmp" + builtin history -r "$tmp" + else + ble/history:bash/clear-background-load + builtin history -s -- "$cmd" + fi + local max; ble/builtin/history/.get-max + _ble_builtin_history_prevmax=$max +} +function ble/builtin/history { + local set shopt; ble/base/.adjust-bash-options set shopt + local opt_d= flag_error= + local opt_c= opt_p= opt_s= + local opt_a= flags= + while [[ $1 == -* ]]; do + local arg=$1; shift + [[ $arg == -- ]] && break + if [[ $arg == --help ]]; then + flags=h$flags + continue + fi + local i n=${#arg} + for ((i=1;i&2 + flag_error=1 + elif ((i+1&2 + flag_error=1 + elif ((i+1&2 + flag_error=1 ;; + esac + done + done + if [[ $flag_error ]]; then + builtin history --usage 2>&1 1>/dev/null | ble/bin/grep ^history >&2 + ble/base/.restore-bash-options set shopt + return 2 + fi + if [[ $flags == *h* ]]; then + builtin history --help + local ext=$? + ble/base/.restore-bash-options set shopt + return "$ext" + fi + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/adjust-BASH_REMATCH + local flag_processed= + if [[ $opt_c ]]; then + ble/builtin/history/option:c + flag_processed=1 + fi + if [[ $opt_s ]]; then + local IFS=$_ble_term_IFS + ble/builtin/history/option:s "$*" + flag_processed=1 + elif [[ $opt_d ]]; then + ble/builtin/history/option:d "$opt_d" + flag_processed=1 + elif [[ $opt_a ]]; then + ble/builtin/history/option:"$opt_a" "$@" + flag_processed=1 + fi + if [[ $flag_processed ]]; then + ble/base/.restore-bash-options set shopt + return 0 + fi + if [[ $opt_p ]]; then + ble/builtin/history/option:p "$@" + else + builtin history "$@" + fi; local ext=$? + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/restore-BASH_REMATCH + ble/base/.restore-bash-options set shopt + return "$ext" +} +function history { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/history "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_history_prefix= +function ble/history/set-prefix { + _ble_history_prefix=$1 + ble/history/.update-position +} +_ble_history_COUNT= +_ble_history_INDEX= +function ble/history/.update-position { + if [[ $_ble_history_prefix ]]; then + builtin eval -- "_ble_history_COUNT=\${#${_ble_history_prefix}_history[@]}" + ((_ble_history_INDEX=${_ble_history_prefix}_history_index)) + else + if [[ ! $_ble_history_load_done ]]; then + if [[ ! $_ble_history_count ]]; then + local min max + ble/builtin/history/.get-min + ble/builtin/history/.get-max + ((_ble_history_count=max-min+1)) + fi + _ble_history_index=$_ble_history_count + fi + _ble_history_COUNT=$_ble_history_count + _ble_history_INDEX=$_ble_history_index + fi +} +function ble/history/update-position { + [[ $_ble_history_prefix$_ble_history_load_done ]] || + ble/history/.update-position +} +function ble/history/onleave.fire { + blehook/invoke history_leave "$@" +} +function ble/history/initialize { + [[ ! $_ble_history_prefix ]] && + ble/history:bash/initialize +} +function ble/history/get-count { + local _ble_local_var=count + [[ $1 == -v ]] && { _ble_local_var=$2; shift 2; } + ble/history/.update-position + (($_ble_local_var=_ble_history_COUNT)) +} +function ble/history/get-index { + local _ble_local_var=index + [[ $1 == -v ]] && { _ble_local_var=$2; shift 2; } + ble/history/.update-position + (($_ble_local_var=_ble_history_INDEX)) +} +function ble/history/set-index { + _ble_history_INDEX=$1 + ((${_ble_history_prefix:-_ble}_history_index=_ble_history_INDEX)) +} +function ble/history/get-entry { + local _ble_local_var=entry + [[ $1 == -v ]] && { _ble_local_var=$2; shift 2; } + if [[ $_ble_history_prefix$_ble_history_load_done ]]; then + builtin eval -- "$_ble_local_var=\${${_ble_history_prefix:-_ble}_history[\$1]}" + else + builtin eval -- "$_ble_local_var=" + fi +} +function ble/history/get-edited-entry { + local _ble_local_var=entry + [[ $1 == -v ]] && { _ble_local_var=$2; shift 2; } + if [[ $_ble_history_prefix$_ble_history_load_done ]]; then + builtin eval -- "$_ble_local_var=\${${_ble_history_prefix:-_ble}_history_edit[\$1]}" + else + builtin eval -- "$_ble_local_var=\$_ble_edit_str" + fi +} +function ble/history/set-edited-entry { + ble/history/initialize + local index=$1 str=$2 + local code=' + if [[ ! ${PREFIX_history_edit[index]+set} || ${PREFIX_history_edit[index]} != "$str" ]]; then + PREFIX_history_edit[index]=$str + PREFIX_history_dirt[index]=1 + fi' + builtin eval -- "${code//PREFIX/${_ble_history_prefix:-_ble}}" +} +function ble/history/revert-edits { + if [[ $_ble_history_prefix ]]; then + local code=' + local index + for index in "${!PREFIX_history_dirt[@]}"; do + PREFIX_history_edit[index]=${PREFIX_history[index]} + done + PREFIX_history_dirt=() + local topIndex=${#PREFIX_history[@]} + _ble_history_COUNT=$topIndex + _ble_history_INDEX=$topIndex' + builtin eval -- "${code//PREFIX/$_ble_history_prefix}" + else + if [[ $_ble_history_load_done ]]; then + _ble_history_index=${#_ble_history[@]} + ble/history/.update-position + local index + for index in "${!_ble_history_dirt[@]}"; do + _ble_history_edit[index]=${_ble_history[index]} + done + _ble_history_dirt=() + ble-edit/undo/clear-all + fi + fi +} +function ble/history/.add-command-history { + [[ -o history ]] || ((_ble_bash<30200)) || return 1 + [[ $MC_SID == $$ && $_ble_edit_LINENO -le 2 && ( $1 == *PROMPT_COMMAND=* || $1 == *PS1=* ) ]] && return 1 + if [[ $bleopt_history_share ]]; then + ble/builtin/history/option:n + ble/builtin/history/option:s "$1" + ble/builtin/history/option:a + ble/builtin/history/.touch-histfile + else + ble/builtin/history/option:s "$1" + fi +} +function ble/history/add { + local command=$1 + ((bleopt_history_limit_length>0&&${#command}>bleopt_history_limit_length)) && return 1 + ble/history/revert-edits + if [[ $_ble_history_prefix ]]; then + local code=' + local topIndex=${#PREFIX_history[@]} + PREFIX_history[topIndex]=$command + PREFIX_history_edit[topIndex]=$command + PREFIX_history_index=$((++topIndex)) + _ble_history_COUNT=$topIndex + _ble_history_INDEX=$topIndex' + builtin eval -- "${code//PREFIX/$_ble_history_prefix}" + else + blehook/invoke ADDHISTORY "$command" && + ble/history/.add-command-history "$command" + fi +} +function ble/history/.read-isearch-options { + local opts=$1 + search_type=fixed + case :$opts: in + (*:regex:*) search_type=regex ;; + (*:glob:*) search_type=glob ;; + (*:head:*) search_type=head ;; + (*:tail:*) search_type=tail ;; + (*:condition:*) search_type=condition ;; + (*:predicate:*) search_type=predicate ;; + esac + [[ :$opts: != *:stop_check:* ]]; has_stop_check=$? + [[ :$opts: != *:progress:* ]]; has_progress=$? + [[ :$opts: != *:backward:* ]]; has_backward=$? +} +function ble/history/isearch-backward-blockwise { + local opts=$1 + local search_type has_stop_check has_progress has_backward + ble/history/.read-isearch-options "$opts" + ble/history/initialize + if [[ $_ble_history_prefix ]]; then + local -a _ble_history_edit + builtin eval "_ble_history_edit=(\"\${${_ble_history_prefix}_history_edit[@]}\")" + fi + local isearch_block=1000 # 十分高速なのでこれぐらい大きくてOK + local isearch_quantum=$((isearch_block*2)) # 倍数である必要有り + local irest block j i=$index + index= + local flag_icase=; [[ :$opts: == *:ignore-case:* ]] && flag_icase=1 + local flag_cycled= range_min range_max + while ((1)); do + if ((i<=start)); then + range_min=0 range_max=$start + else + flag_cycled=1 + range_min=$((start+1)) range_max=$i + fi + while ((i>=range_min)); do + ((block=range_max-i, + block<5&&(block=5), + block>i+1-range_min&&(block=i+1-range_min), + irest=isearch_block-isearch_time%isearch_block, + block>irest&&(block=irest))) + [[ $flag_icase ]] && shopt -s nocasematch + case $search_type in + (regex) for ((j=i-block;++j<=i;)); do + [[ ${_ble_history_edit[j]} =~ $needle ]] && index=$j + done ;; + (glob) for ((j=i-block;++j<=i;)); do + [[ ${_ble_history_edit[j]} == $needle ]] && index=$j + done ;; + (head) for ((j=i-block;++j<=i;)); do + [[ ${_ble_history_edit[j]} == "$needle"* ]] && index=$j + done ;; + (tail) for ((j=i-block;++j<=i;)); do + [[ ${_ble_history_edit[j]} == *"$needle" ]] && index=$j + done ;; + (condition) builtin eval "function ble-edit/isearch/.search-block.proc { + local LINE INDEX + for ((j=i-block;++j<=i;)); do + LINE=\${_ble_history_edit[j]} INDEX=\$j + { $needle; } && index=\$j + done + }" + ble-edit/isearch/.search-block.proc ;; + (predicate) for ((j=i-block;++j<=i;)); do + "$needle" "${_ble_history_edit[j]}" "$j" && index=$j + done ;; + (*) for ((j=i-block;++j<=i;)); do + [[ ${_ble_history_edit[j]} == *"$needle"* ]] && index=$j + done ;; + esac + [[ $flag_icase ]] && shopt -u nocasematch + ((isearch_time+=block)) + [[ $index ]] && return 0 + ((i-=block)) + if ((has_stop_check&&isearch_time%isearch_block==0)) && ble/decode/has-input; then + index=$i + return 148 + elif ((has_progress&&isearch_time%isearch_quantum==0)); then + "$isearch_progress_callback" "$i" + fi + done + if [[ ! $flag_cycled && :$opts: == *:cyclic:* ]]; then + ((i=${#_ble_history_edit[@]}-1)) + ((start=start)); then + expr_cond="index<${#_ble_history_edit[@]}" expr_incr='index++' + else + expr_cond="indexstart)) || return 1 + else + ((index=0)) + ((index&2 + return 1 + fi +} +function ble/edit/performs-on-graphical-line { + [[ $bleopt_edit_line_type == graphical ]] || return 1 + ble/textmap#is-up-to-date && return 0 + ((bleopt_edit_forced_textmap)) || return 1 + ble/widget/.update-textmap + return 0 +} +bleopt/declare -n info_display top +function bleopt/check:info_display { + case $value in + (top) + [[ $_ble_canvas_panel_vfill == 4 ]] && return 0 + _ble_canvas_panel_vfill=4 + [[ $_ble_attached ]] && ble/canvas/panel/clear + return 0 ;; + (bottom) + [[ $_ble_canvas_panel_vfill == 2 ]] && return 0 + _ble_canvas_panel_vfill=2 + [[ $_ble_attached ]] && ble/canvas/panel/clear + return 0 ;; + (*) + ble/util/print "bleopt: Invalid value for 'info_display': $value" + return 1 ;; + esac +} +bleopt/declare -v prompt_ps1_final '' +bleopt/declare -v prompt_ps1_transient '' +bleopt/declare -v prompt_rps1 '' +bleopt/declare -v prompt_rps1_final '' +bleopt/declare -v prompt_rps1_transient '' +bleopt/declare -v prompt_xterm_title '' +bleopt/declare -v prompt_screen_title '' +bleopt/declare -v prompt_term_status '' +bleopt/declare -o rps1 prompt_rps1 +bleopt/declare -o rps1_transient prompt_rps1_transient +bleopt/declare -v prompt_eol_mark $'\e[94m[ble: EOF]\e[m' +bleopt/declare -v prompt_ruler '' +bleopt/declare -v prompt_status_line '' +bleopt/declare -n prompt_status_align $'justify=\r' +ble/color/defface prompt_status_line fg=231,bg=240 +bleopt/declare -v prompt_command_changes_layout '' +function bleopt/check:prompt_status_align { + case $value in + (left|right|center|justify|justify=?*) + ble/prompt/unit#clear _ble_prompt_status hash + return 0 ;; + (*) + ble/util/print "bleopt prompt_status_align: unsupported value: '$value'" >&2 + return 1 ;; + esac +} +bleopt/declare -n internal_exec_type gexec +function bleopt/check:internal_exec_type { + if ! ble/is-function "ble-edit/exec:$value/process"; then + ble/util/print "bleopt: Invalid value internal_exec_type='$value'. A function 'ble-edit/exec:$value/process' is not defined." >&2 + return 1 + fi +} +bleopt/declare -v internal_exec_int_trace '' +bleopt/declare -v internal_suppress_bash_output 1 +bleopt/declare -n internal_ignoreeof_trap 'Use "exit" to leave the shell.' +bleopt/declare -v allow_exit_with_jobs '' +bleopt/declare -v history_share '' +bleopt/declare -v accept_line_threshold 5 +bleopt/declare -v exec_restore_pipestatus '' +bleopt/declare -v edit_marker $'\e[94m[ble: %s]\e[m' +bleopt/declare -v edit_marker_error $'\e[91m[ble: %s]\e[m' +function ble/edit/marker#get { + local msg=$1 opts=${2-} + ret=$msg + if [[ :$opts: != *:bare:* ]]; then + if [[ :$opts: == *:error:* ]]; then + ble/util/sprintf ret "$bleopt_edit_marker_error" "$ret" + else + ble/util/sprintf ret "$bleopt_edit_marker" "$ret" + fi + fi + if [[ ! $ret && $msg && :$opts: == *:non-empty:* ]]; then + if [[ :$opts: == *:error:* ]]; then + ret=$'\e[91m[ble: '$msg$']\e[m' + else + ret=$'\e[94m[ble: '$msg$']\e[m' + fi + fi + [[ $ret ]] +} +function ble/edit/marker#instantiate { + ble/edit/marker#get "$@" + if [[ $ret ]]; then + ret=${ret%$'\e[m'}$'\e[m' + x=0 y=0 g=0 LINES=1 ble/canvas/trace "$ret" confine:truncate + fi + [[ $ret ]] +} +function ble/edit/marker#declare-config { + local name=$1 value=$2 opts=$3 + if [[ :$opts: == *:error:* ]]; then + value=$'\e[91m[ble: '$value$']\e[m' + else + value=$'\e[94m[ble: '$value$']\e[m' + fi + bleopt/declare -v "$name" "$value" +} +function ble/edit/marker#get-config { + bleopt/default "$1" + local default_value=$ret + local current_ref=bleopt_$1 + local current_value=${!current_ref} + ret=$current_value + if [[ $current_value == "$default_value" ]]; then + if ble/string#match "$current_value" $'^\e\[94m\[ble: (.*)]\e\[m$'; then + ble/util/sprintf ret "$bleopt_edit_marker" "${BASH_REMATCH[1]}" + elif ble/string#match "$current_value" $'^\e\[91m\[ble: (.*)\]\e\[m$'; then + ble/util/sprintf ret "$bleopt_edit_marker_error" "${BASH_REMATCH[1]}" + fi + fi + [[ $ret ]] +} +function ble/edit/marker#instantiate-config { + ble/edit/marker#get-config "$1" && + ret=${ret%$'\e[m'}$'\e[m' && + x=0 y=0 g=0 LINES=1 ble/canvas/trace "$ret" confine:truncate + [[ $ret ]] +} +ble/edit/marker#declare-config exec_errexit_mark 'exit %d' error +ble/edit/marker#declare-config exec_elapsed_mark 'elapsed %s (CPU %s%%)' +bleopt/declare -v exec_elapsed_enabled 'usr+sys>=10000' +ble/edit/marker#declare-config exec_exit_mark 'exit' +bleopt/declare -v line_limit_length 10000 +bleopt/declare -v line_limit_type none +_ble_app_render_mode=panel +_ble_app_winsize=() +function ble/application/.set-up-render-mode { + [[ $1 == "$_ble_app_render_mode" ]] && return 0 + case $1 in + (panel) + ble/term/leave-altscr + ble/canvas/panel/invalidate ;; + (forms:*) + ble/term/enter-altscr + ble/util/buffer "$_ble_term_clear" + ble/util/buffer $'\e[H' + _ble_canvas_x=0 _ble_canvas_y=0 ;; + (*) + ble/util/print "ble/edit: unrecognized render mode '$1'." + return 1 ;; + esac +} +function ble/application/push-render-mode { + ble/application/.set-up-render-mode "$1" || return 1 + ble/array#unshift _ble_app_render_mode "$1" +} +function ble/application/pop-render-mode { + [[ ${_ble_app_render_mode[1]} ]] || return 1 + ble/application/.set-up-render-mode "${_ble_app_render_mode[1]}" + ble/array#shift _ble_app_render_mode +} +function ble/application/render { + if [[ $_ble_app_onwinch_Deferred ]]; then + ble/application/onwinch + return "$?" + fi + local _ble_app_onwinch_Suppress=1 + { + local render=$_ble_app_render_mode + case $render in + (panel) + local _ble_prompt_update=owner + ble/prompt/update + ble/canvas/panel/render ;; + (forms:*) + ble/forms/render "${render#*:}" ;; # NYI + esac + _ble_app_winsize=("$COLUMNS" "$LINES") + ble/util/buffer.flush + } + ble/util/unlocal _ble_app_onwinch_Suppress + if [[ $_ble_app_onwinch_Deferred ]]; then + ble/application/onwinch + fi +} +blehook idle_after_task!=ble/application/render +function ble/application/onwinch/panel.process-redraw-here { + local old_w=${_ble_app_winsize[0]} + local -a DRAW_BUFF=() + if ((COLUMNS>old_w)); then + ble/canvas/panel/goto-top-dock.draw + local i npanel=${#_ble_canvas_panel_class[@]} + local y0=0 + local nchar=0 + for ((i=0;i=y0)) && + ((nchar+=(_ble_canvas_y-y0)*(old_w-1)*_ble_canvas_x)) + local new_y_min=$(((nchar-1)/COLUMNS)) + ((_ble_canvas_y>new_y_min)) && + _ble_canvas_y=$new_y_min + fi + ble/canvas/panel#goto.draw 0 0 0 + ble/canvas/bflush.draw + return 0 +} +_ble_app_onwinch_Suppress= +_ble_app_onwinch_Deferred= +function ble/application/onwinch { + if [[ $_ble_app_onwinch_Suppress || $_ble_decode_hook_Processing == body || $_ble_decode_hook_Processing == prologue ]]; then + _ble_app_onwinch_Deferred=1 + return 0 + fi + local _ble_app_onwinch_Suppress=1 + _ble_app_onwinch_Deferred= + _ble_textmap_cols= + local old_size= i + for ((i=0;i<20;i++)); do + (ble/util/msleep 50) + if ble/util/is-running-in-subshell || ((50200<=_ble_bash&&_ble_bash<50300)); then + ble/term/update-winsize + fi + ble/util/joblist.check ignore-volatile-jobs + local size=$LINES:$COLUMNS + [[ $size == "$old_size" ]] && break + old_size=$size + local render=$_ble_app_render_mode + case $render in + (panel) + case $bleopt_canvas_winch_action in + (clear) + _ble_prompt_trim_opwd= + ble/util/buffer "$_ble_term_clear" ;; + (redraw-here) + ble/application/onwinch/panel.process-redraw-here ;; + (redraw-prev) + local -a DRAW_BUFF=() + ble/canvas/panel#goto.draw 0 0 0 + ble/canvas/bflush.draw ;; + (redraw-safe) ;; + esac + ble/canvas/panel/invalidate height ;; + (forms:*) + ble/forms/invalidate "${render#*:}" ;; # NYI + esac + ble/application/render + done + ble/util/unlocal _ble_app_onwinch_Suppress + if [[ $_ble_app_onwinch_Deferred ]]; then + ble/application/onwinch + fi +} +_ble_canvas_panel_focus=0 +_ble_canvas_panel_class=(ble/textarea ble/textarea ble/edit/info ble/edit/visible-bell ble/prompt/status) +_ble_canvas_panel_height=(1 0 0 0 0) +_ble_canvas_panel_vfill=4 +_ble_edit_command_layout_level=0 +function ble/edit/enter-command-layout { + ((_ble_edit_command_layout_level++==0)) || return 0 + ble/edit/info#collapse "$_ble_edit_info_panel" + ble/edit/visible-bell#collapse + ble/prompt/status#collapse +} +function ble/edit/leave-command-layout { + ((_ble_edit_command_layout_level>0&& + --_ble_edit_command_layout_level==0)) || return 0 + blehook/invoke info_reveal + ble/edit/info/default +} +function ble/edit/clear-command-layout { + ((_ble_edit_command_layout_level>0)) || return 0 + _ble_edit_command_layout_level=1 + ble/edit/leave-command-layout +} +function ble/edit/is-command-layout { + ((_ble_edit_command_layout_level>0)) +} +_ble_prompt_status_panel=4 +_ble_prompt_status_dirty= +_ble_prompt_status_data=() +_ble_prompt_status_bbox=() +function ble/prompt/status#panel::invalidate { + _ble_prompt_status_dirty=1 +} +function ble/prompt/status#panel::render { + [[ $_ble_prompt_status_dirty ]] || return 0 + _ble_prompt_status_dirty= + local index=$1 + local height; ble/prompt/status#panel::getHeight "$index" + [[ ${height#*:} == 1 ]] || return 0 + local -a DRAW_BUFF=() + height=$3 + if ((height!=1)); then + ble/canvas/panel/reallocate-height.draw + ble/canvas/bflush.draw + height=${_ble_canvas_panel_height[index]} + ((height==0)) && return 0 + fi + local esc=${_ble_prompt_status_data[10]} + if [[ $esc ]]; then + local prox=${_ble_prompt_status_data[11]} + local proy=${_ble_prompt_status_data[12]} + ble/canvas/panel#goto.draw "$_ble_prompt_status_panel" + ble/canvas/panel#put.draw "$_ble_prompt_status_panel" "$esc" "$prox" "$proy" + else + ble/canvas/panel#clear.draw "$_ble_prompt_status_panel" + fi + ble/canvas/bflush.draw +} +function ble/prompt/status#panel::getHeight { + if ble/edit/is-command-layout || [[ ! ${_ble_prompt_status_data[10]} ]]; then + height=0:0 + else + height=0:1 + fi +} +function ble/prompt/status#panel::onHeightChange { + ble/prompt/status#panel::invalidate +} +function ble/prompt/status#collapse { + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$_ble_prompt_status_panel" 0 + ble/canvas/bflush.draw +} +_ble_edit_vbell_panel=3 +_ble_edit_vbell_state=('' '' 0) +function ble/edit/visible-bell#panel::getHeight { + if [[ ${_ble_edit_vbell_state[0]} ]]; then + height=0:1 + else + height=0:0 + fi +} +function ble/edit/visible-bell#panel::invalidate { + (($1!=_ble_edit_vbell_panel)) && return 0 + _ble_edit_vbell_state[2]=1 +} +function ble/edit/visible-bell#panel::render { + (($1!=_ble_edit_vbell_panel)) && return 0 + ble/edit/is-command-layout && return 0 + ((_ble_edit_vbell_state[2]==1)) || return 0 + local message=${_ble_edit_vbell_state[0]} + local -a DRAW_BUFF=() + if [[ ! $message ]]; then + ble/canvas/panel#set-height.draw "$_ble_edit_vbell_panel" 0 + else + ble/canvas/panel/reallocate-height.draw + local panel_height=${_ble_canvas_panel_height[$1]} + if ((panel_height>=1)); then + local ret + ble/canvas/panel/save-position; local pos=$ret + ble/canvas/put.draw "$_ble_term_sgr0" + ble/canvas/panel#clear.draw "$_ble_edit_vbell_panel" + ble/canvas/panel#goto.draw "$_ble_edit_vbell_panel" + local lines=1 cols=${COLUMNS:-80} + ((_ble_term_xenl||COLUMNS--)) + if ((cols!=_ble_edit_vbell_state[5])); then + local x=0 y=0 ret= sgr0= sgr1= + ble/canvas/trace-text "$message" nonewline:external-sgr + _ble_edit_vbell_state[4]=$ret + _ble_edit_vbell_state[5]=$cols + _ble_edit_vbell_state[6]=$x + fi + local sgr=${_ble_edit_vbell_state[3]} + local esc=${_ble_edit_vbell_state[4]} + local esc_w=${_ble_edit_vbell_state[6]} + local margin=$((cols-esc_w)) + case :$bleopt_vbell_align: in + (*:left:*) margin=0;; + (*:center:*) ((margin/=2)) ;; + (*:right:*) ;; + esac + ble/canvas/put.draw "$_ble_term_cr" + ((margin>0)) && ble/canvas/put-cuf.draw "$margin" + ble/canvas/put.draw "$sgr$esc" + ((_ble_canvas_x=margin+esc_w)) + ble/canvas/panel/load-position.draw "$pos" + fi + fi + ble/canvas/bflush.draw + _ble_edit_vbell_state[2]=0 +} +function ble/edit/visible-bell#collapse { + if ble/is-function ble/util/idle.push; then + ble/util/idle.cancel ble/edit/visible-bell/.async-1.idle + ble/util/idle.cancel ble/edit/visible-bell/.async-2.idle + fi + _ble_edit_vbell_state=('' '' 0) + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$_ble_edit_vbell_panel" 0 + ble/canvas/bflush.draw +} +function ble/edit/visible-bell/.show { + [[ ${_ble_edit_vbell_state[0]} ]] || return 0 + local ret + ble/color/face2sgr "$1"; local sgr=$ret + if [[ $sgr != "${_ble_edit_vbell_state[2]}" ]]; then + _ble_edit_vbell_state[2]=1 # invalidate + _ble_edit_vbell_state[3]=$sgr + fi + ble/edit/visible-bell#panel::render "$_ble_edit_vbell_panel" + ble/util/buffer.flush +} +function ble/edit/visible-bell/.clear { + ble/edit/visible-bell#collapse + ble/util/buffer.flush +} +function ble/edit/visible-bell { + [[ $_ble_attached ]] || return 1 + ble/util/is-running-in-subshell && return 1 + ble/is-function ble/util/idle.push || return 1 + ble/util/is-running-in-idle && return 1 + local message=$1 opts=$2 + if [[ ! $message ]]; then + ble/edit/visible-bell/.clear + return 0 + fi + ble/util/idle.cancel ble/edit/visible-bell/.async-1.idle + ble/util/idle.cancel ble/edit/visible-bell/.async-2.idle + _ble_edit_vbell_state=("$message" "$opts" 1) + ble/edit/visible-bell/.show vbell_flash + ble/util/idle.push --sleep=50 ble/edit/visible-bell/.async-1.idle + return 0 +} +function ble/edit/visible-bell/.async-1.idle { + ble/edit/visible-bell/.show vbell + if [[ :${_ble_edit_vbell_state[1]}: != *:persistent:* ]]; then + local msec=$((bleopt_vbell_duration)) + ble/util/idle.push --sleep="$msec" ble/edit/visible-bell/.async-2.idle + fi + return 0 +} +function ble/edit/visible-bell/.async-2.idle { + ble/edit/visible-bell/.clear + return 0 +} +_ble_prompt_hash= +_ble_prompt_version=0 +function ble/prompt/.escape-control-characters { + ret=$1 + local ctrl=$'\001-\037\177' + case $_ble_util_locale_encoding in + (UTF-8) ctrl=$ctrl$'\302\200-\302\237' ;; + (C) ctrl=$ctrl$'\200-\237' ;; + esac + local LC_ALL= LC_COLLATE=C glob_ctrl=[$ctrl] + [[ $ret == *$glob_ctrl* ]] || return 0 + local out= head tail=$ret cs + while head=${tail%%$glob_ctrl*}; [[ $head != "$tail" ]]; do + ble/util/s2c "${tail:${#head}:1}" + ble/unicode/GraphemeCluster/.get-ascii-rep "$ret" # -> cs + out=$out$head$'\e[9807m'$cs$'\e[9807m' + tail=${tail#*$glob_ctrl} + done + ret=$out$tail +} +ble/function#suppress-stderr ble/prompt/.escape-control-characters # LC_COLLATE +function ble/prompt/.initialize-constant { + local _ble_local_ps=$1 + local _ble_local_defeval=$2 + local _ble_local_opts=$3 + if ((_ble_bash>=40400)); then + ret=${_ble_local_ps@P} + else + builtin eval -- "$_ble_local_defeval" + fi + if [[ $_ble_local_opts == *:escape:* ]]; then + if ((_ble_bash>=50200)); then + if [[ $ret == *\^['A'-'Z[\]^_?']* ]]; then + builtin eval -- "$_ble_local_defeval" + ble/prompt/.escape-control-characters "$ret" + elif [[ $ret == *$'\t'* ]]; then + ble/prompt/.escape-control-characters "$ret" + fi + else + ble/prompt/.escape-control-characters "$_ble_prompt_const_s" + fi + fi +} +function ble/prompt/initialize { + local ret + ble/prompt/.initialize-constant '\H' 'ret=${HOSTNAME:-$_ble_base_env_HOSTNAME}' escape + _ble_prompt_const_H=$ret + if local rex='^[0-9]+(\.[0-9]){3}$'; [[ $_ble_prompt_const_H =~ $rex ]]; then + _ble_prompt_const_h=$_ble_prompt_const_H + else + _ble_prompt_const_h=${_ble_prompt_const_H%%.*} + fi + ble/prompt/.initialize-constant '\l' 'ble/util/assign ret "ble/bin/tty 2>/dev/null";ret=${ret##*/}' + _ble_prompt_const_l=$ret + ble/prompt/.initialize-constant '\s' 'ret=${0##*/}' escape + _ble_prompt_const_s=$ret + ble/prompt/.initialize-constant '\u' 'ret=${USER:-$_ble_base_env_USER}' escape + _ble_prompt_const_u=$ret + ble/util/sprintf _ble_prompt_const_v '%d.%d' "${BASH_VERSINFO[0]}" "${BASH_VERSINFO[1]}" + ble/util/sprintf _ble_prompt_const_V '%d.%d.%d' "${BASH_VERSINFO[0]}" "${BASH_VERSINFO[1]}" "${BASH_VERSINFO[2]}" + if [[ $EUID -eq 0 ]]; then + _ble_prompt_const_root='#' + else + _ble_prompt_const_root='$' + fi + if [[ $OSTYPE == cygwin* ]]; then + local windir=/cygdrive/c/Windows + if [[ $WINDIR == [a-zA-Z]:\\* ]]; then + local bsl='\' sl=/ + local c=${WINDIR::1} path=${WINDIR:3} + if ble/string#isupper "$c"; then + if ((_ble_bash>=40000)); then + c=${c,?} + else + local ret + ble/util/s2c "$c" + ble/util/c2s "$((ret+32))" + c=$ret + fi + fi + windir=/cygdrive/$c/${path//"$bsl"/"$sl"} + fi + if [[ -e $windir && -w $windir ]]; then + _ble_prompt_const_root='#' + fi + elif [[ $OSTYPE == msys* ]]; then + if ble/bin#has id getent; then + local id getent + ble/util/assign id 'id -G' + ble/util/assign getent 'getent -w group S-1-16-12288' + ble/string#split getent : "$getent" + [[ " $id " == *" ${getent[1]} "* ]] && + _ble_prompt_const_root='#' + fi + fi +} +function ble/prompt/unit#update { + local unit=$1 + local prompt_unit_changed= + local prompt_unit_expired= + local ohashref=${unit}_data[1]; ohashref=${!ohashref-} + if [[ ! $ohashref ]]; then + prompt_unit_expired=1 + else + ble/prompt/unit#update/.update-dependencies "$ohashref" + local ohash=${unit}_data[2]; ohash=${!ohash} + builtin eval -- "local nhash=\"$ohashref\"" 2>/dev/null + [[ $nhash != "$ohash" ]] && prompt_unit_expired=1 + fi + if [[ $prompt_unit_expired ]]; then + local prompt_unit=$unit + local prompt_hashref_dep= # プロンプト間依存性 + local prompt_hashref_var= # 変数に対する依存性 + ble/prompt/unit:"$unit"/update "$unit" && + ((prompt_unit_changed=1,${unit}_data[0]++)) + local hashref=${prompt_hashref_base-'$_ble_prompt_version'}:$prompt_hashref_dep:$prompt_hashref_var + builtin eval -- "${unit}_data[1]=\$hashref" + builtin eval -- "${unit}_data[2]=\"$hashref\"" 2>/dev/null + ble/util/unlocal prompt_unit prompt_hashref_dep + fi + if [[ $prompt_unit ]]; then + local ref1='$'$unit'_data' + [[ ,$prompt_hashref_dep, != *,"$ref1",* ]] && + prompt_hashref_dep=$prompt_hashref_dep${prompt_hashref_dep:+,}$ref1 + fi + [[ $prompt_unit_changed ]] +} +function ble/prompt/unit#update/.update-dependencies { + local ohashref=$1 + local otree=${ohashref#*:}; otree=${otree%%:*} + if [[ $otree ]]; then + ble/string#split otree , "$otree" + if [[ ! $ble_prompt_unit_processing ]]; then + local ble_prompt_unit_processing=1 + "${_ble_util_set_declare[@]//NAME/ble_prompt_unit_mark}" # WA #D1570 checked + elif ble/set#contains ble_prompt_unit_mark "$unit"; then + ble/util/print "ble/prompt: FATAL: detected cyclic dependency ($unit required by $ble_prompt_unit_parent)" >&"$_ble_util_fd_tui_stderr" + return 1 + fi + local ble_prompt_unit_parent=$unit + ble/set#add ble_prompt_unit_mark "$unit" + local prompt_unit= # 依存関係の登録はしない + local child + for child in "${otree[@]}"; do + [[ $child == '$'?*'_data' ]] || continue + child=${child:1:${#child}-6} + ble/is-function ble/prompt/unit:"$child"/update && + ble/prompt/unit#update "$child" + done + ble/set#remove ble_prompt_unit_mark "$unit" + fi +} +function ble/prompt/unit#clear { + local prefix=$1 + builtin eval -- "${prefix}_data[2]=" +} +function ble/prompt/unit/assign { + local var=$1 value=$2 + [[ $value == "${!var}" ]] && return 1 + prompt_unit_changed=1 + builtin eval -- "$var=\$value" +} +function ble/prompt/unit/add-hash { + [[ $prompt_unit && ,$prompt_hashref_var, != *,"$1",* ]] && + prompt_hashref_var=$prompt_hashref_var${prompt_hashref_var:+,}$1 + return 0 +} +_ble_prompt_ps1_dirty= +_ble_prompt_ps1_data=(0 '' '' 0 0 0 32 0 '' '') +_ble_prompt_ps1_bbox=() +_ble_prompt_rps1_dirty= +_ble_prompt_rps1_data=() +_ble_prompt_rps1_gbox=() +_ble_prompt_rps1_shown= +_ble_prompt_xterm_title_dirty= +_ble_prompt_xterm_title_data=() +_ble_prompt_screen_title_dirty= +_ble_prompt_screen_title_data=() +_ble_prompt_term_status_dirty= +_ble_prompt_term_status_data=() +function ble/prompt/print { + local ret=$1 + [[ $prompt_noesc ]] || + ble/string#escape-characters "$ret" '\$"`' + ble/canvas/put.draw "$ret" +} +function ble/prompt/process-prompt-string { + local ps1=$1 + local i=0 iN=${#ps1} + local rex_letters='^[^\]+|\\$' + while ((i=0)) && ble/widget/.update-textmap + local fmt=${1:-'(%s,%s)'} pos + ble/prompt/unit/add-hash '${_ble_textmap_pos[_ble_edit_ind]}' + ble/string#split-words pos "${_ble_textmap_pos[_ble_edit_ind]}" + ble/util/sprintf pos "$fmt" "$((pos[1]+1))" "$((pos[0]+1))" + ble/prompt/print "$pos" +} +function ble/prompt/backslash:row { + ((_ble_textmap_dbeg>=0)) && ble/widget/.update-textmap + local pos + ble/prompt/unit/add-hash '${_ble_textmap_pos[_ble_edit_ind]}' + ble/string#split-words pos "${_ble_textmap_pos[_ble_edit_ind]}" + ble/prompt/print "$((pos[1]+1))" +} +function ble/prompt/backslash:column { + ((_ble_textmap_dbeg>=0)) && ble/widget/.update-textmap + local pos + ble/prompt/unit/add-hash '${_ble_textmap_pos[_ble_edit_ind]}' + ble/string#split-words pos "${_ble_textmap_pos[_ble_edit_ind]}" + ble/prompt/print "$((pos[0]+1))" +} +function ble/prompt/backslash:point { + ble/prompt/unit/add-hash '$_ble_edit_ind' + ble/prompt/print "$_ble_edit_ind" +} +function ble/prompt/backslash:mark { + ble/prompt/unit/add-hash '$_ble_edit_mark' + ble/prompt/print "$_ble_edit_mark" +} +function ble/prompt/backslash:history-index { + ble/prompt/unit/add-hash '$_ble_history_INDEX' + ble/canvas/put.draw "$((_ble_history_INDEX+1))" +} +function ble/prompt/backslash:history-percentile { + ble/prompt/unit/add-hash '$_ble_history_INDEX' + ble/prompt/unit/add-hash '$_ble_history_COUNT' + local index=$_ble_history_INDEX + local count=$_ble_history_COUNT + ((count||count++)) + ble/canvas/put.draw "$((index*100/count))%" +} +function ble/prompt/.update-working-directory { + [[ $prompt_cache_wd ]] && return 0 + if [[ ! ${PWD//'/'} ]]; then + prompt_cache_wd=$PWD + return 0 + fi + local head= body=${PWD%/} + if [[ $body == "$HOME" ]]; then + prompt_cache_wd='~' + return 0 + elif [[ $body == "$HOME"/* ]]; then + head='~/' + body=${body#"$HOME"/} + fi + if [[ $PROMPT_DIRTRIM ]]; then + local dirtrim=$((PROMPT_DIRTRIM)) + local pat='[^/]' + local count=${body//$pat} + if ((${#count}>=dirtrim)); then + local ret + ble/string#repeat '/*' "$dirtrim" + local omit=${body%$ret} + ((${#omit}>3)) && + body=...${body:${#omit}} + fi + fi + prompt_cache_wd=$head$body +} +function ble/prompt/.escape/check-double-quotation { + if [[ $tail == '"'* ]]; then + if [[ ! $nest ]]; then + out=$out'\"' + tail=${tail:1} + else + out=$out'"' + tail=${tail:1} + nest=\"$nest + ble/prompt/.escape/update-rex_skip + fi + return 0 + else + return 1 + fi +} +function ble/prompt/.escape/check-command-substitution { + if [[ $tail == '$('* ]]; then + out=$out'$(' + tail=${tail:2} + nest=')'$nest + ble/prompt/.escape/update-rex_skip + return 0 + else + return 1 + fi +} +function ble/prompt/.escape/check-parameter-expansion { + if [[ $tail == '${'* ]]; then + out=$out'${' + tail=${tail:2} + nest='}'$nest + ble/prompt/.escape/update-rex_skip + return 0 + else + return 1 + fi +} +function ble/prompt/.escape/check-incomplete-quotation { + if [[ $tail == '`'* ]]; then + local rex='^`([^\`]|\\.)*\\$' + [[ $tail =~ $rex ]] && tail=$tail'\' + out=$out$tail'`' + tail= + return 0 + elif [[ $nest == ['})']* && $tail == \'* ]]; then + out=$out$tail$q + tail= + return 0 + elif [[ $nest == ['})']* && $tail == \$\'* ]]; then + local rex='^\$'$q'([^\'$q']|\\.)*\\$' + [[ $tail =~ $rex ]] && tail=$tail'\' + out=$out$tail$q + tail= + return 0 + elif [[ $tail == '\' ]]; then + out=$out'\\' + tail= + return 0 + else + return 1 + fi +} +function ble/prompt/.escape/update-rex_skip { + if [[ $nest == \)* ]]; then + rex_skip=$rex_skip_paren + elif [[ $nest == \}* ]]; then + rex_skip=$rex_skip_brace + else + rex_skip=$rex_skip_dquot + fi +} +function ble/prompt/.escape { + local tail=$1 out= nest= + local q=\' + local rex_bq='`([^\`]|\\.)*`' + local rex_sq=$q'[^'$q']*'$q'|\$'$q'([^\'$q']|\\.)*'$q + local rex_skip + local rex_skip_dquot='^([^\"$`]|'$rex_bq'|\\.)+' + local rex_skip_brace='^([^\"$`'$q'}]|'$rex_bq'|'$rex_sq'|\\.)+' + local rex_skip_paren='^([^\"$`'$q'()]|'$rex_bq'|'$rex_sq'|\\.)+' + ble/prompt/.escape/update-rex_skip + while [[ $tail ]]; do + if [[ $tail =~ $rex_skip ]]; then + out=$out$BASH_REMATCH + tail=${tail:${#BASH_REMATCH}} + elif [[ $nest == ['})"']* && $tail == "${nest::1}"* ]]; then + out=$out${nest::1} + tail=${tail:1} + nest=${nest:1} + ble/prompt/.escape/update-rex_skip + elif [[ $nest == \)* && $tail == \(* ]]; then + out=$out'(' + tail=${tail:1} + nest=')'$nest + elif ble/prompt/.escape/check-double-quotation; then + continue + elif ble/prompt/.escape/check-command-substitution; then + continue + elif ble/prompt/.escape/check-parameter-expansion; then + continue + elif ble/prompt/.escape/check-incomplete-quotation; then + continue + else + out=$out${tail::1} + tail=${tail:1} + fi + done + ret=$out$nest +} +function ble/prompt/.get-keymap-for-current-mode { + ble/prompt/unit/add-hash '$_ble_decode_keymap,${_ble_decode_keymap_stack[*]}' + ble/decode/keymap/get-major-keymap +} +function ble/prompt/.uses-builtin-prompt-expansion { + ((_ble_bash>=40400)) || return 1 + local ps=$1 + local chars_safe_esc='][0-7aenrdtAT@DhHjlsuvV!$\wW' + [[ ( $OSTYPE == cygwin || $OSTYPE == msys ) && $_ble_prompt_const_root == '#' ]] && + chars_safe_esc=${chars_safe_esc//'$'} # Note: cygwin では ble.sh 独自の方法で \$ を処理する。 + [[ $ps == *'\'[!"$chars_safe_esc"]* ]] && return 1 + local glob_ctrl=$'[\001-\037\177]' + [[ $ps == *'\'[wW]* && $PWD == *$glob_ctrl* ]] && return 1 + [[ $ps == *'\s'* && $_ble_prompt_const_s == *$'\e'* ]] && return 1 + [[ $ps == *'\u'* && $_ble_prompt_const_u == *$'\e'* ]] && return 1 + [[ $ps == *'\h'* && $_ble_prompt_const_h == *$'\e'* ]] && return 1 + [[ $ps == *'\H'* && $_ble_prompt_const_H == *$'\e'* ]] && return 1 + return 0 +} +function ble/prompt/.instantiate { + trace_hash= esc= x=0 y=0 g=0 lc=32 lg=0 + local ps=$1 opts=$2 x0=$3 y0=$4 g0=$5 lc0=$6 lg0=$7 esc0=$8 trace_hash0=$9 + [[ ! $ps ]] && return 0 + local expanded= + if ble/prompt/.uses-builtin-prompt-expansion "$ps"; then + [[ $ps == *'\'[wW]* ]] && ble/prompt/unit/add-hash '$PWD' + ble-edit/exec/eval-with-setexit 'expanded=${ps@P}' pipestatus + else + local prompt_noesc= + shopt -q promptvars &>/dev/null || prompt_noesc=1 + local -a DRAW_BUFF=() + ble/prompt/process-prompt-string "$ps" + local processed; ble/canvas/sflush.draw -v processed + if [[ ! $prompt_noesc ]]; then + local ret + ble/prompt/.escape "$processed"; local escaped=$ret + expanded=${trace_hash0#*:} # Note: これは次行が失敗した時の既定値 + ble-edit/exec/eval-with-setexit "expanded=\"$escaped\"" pipestatus + else + expanded=$processed + fi + fi + if [[ :$opts: == *:show-mode-in-prompt:* ]]; then + if ble/util/rlvar#test show-mode-in-prompt; then + local keymap; ble/prompt/.get-keymap-for-current-mode + local ret= + case $keymap in + (vi_imap) ble/util/rlvar#read vi-ins-mode-string '(ins)' ;; # Note: bash-4.3 では '+' + (vi_[noxs]map) ble/util/rlvar#read vi-cmd-mode-string '(cmd)' ;; # Note: bash-4.3 では ':' + (emacs) ble/util/rlvar#read emacs-mode-string '@' ;; + esac + [[ $ret ]] && expanded=$ret$expanded + fi + fi + if [[ :$opts: == *:no-trace:* ]]; then + x=0 y=0 g=0 lc=32 lg=0 + esc=$expanded + elif + local ret g0=0 + if ble/string#match ":$opts:" ':g0=([^:]+):'; then + ((g0=BASH_REMATCH[1])) + elif ble/string#match ":$opts:" ':face0=([^:]+):'; then + ble/color/face2g "${BASH_REMATCH[1]}" && g0=$ret + fi + local rows=${prompt_rows:-${LINES:-25}} + local cols=${prompt_cols:-${COLUMNS:-80}} + local color=$_ble_color_g2sgr_version + local bleopt=$bleopt_char_width_mode,$bleopt_char_width_version,$bleopt_emoji_version,$bleopt_emoji_opts + trace_hash=$opts#$rows,$cols,$color,$g0#$bleopt#$expanded + [[ $trace_hash != "$trace_hash0" ]] + then + local trace_opts=$opts:prompt + [[ $bleopt_internal_suppress_bash_output ]] || trace_opts=$trace_opts:left-char + x=0 y=0 g=0 lc=32 lg=0 + local ret + LINES=$rows COLUMNS=$cols ble/canvas/trace "$expanded" "$trace_opts"; local traced=$ret + ((lc<0&&(lc=0))) + esc=$traced + return 0 + else + x=$x0 y=$y0 g=$g0 lc=$lc0 lg=$lg0 + esc=$esc0 + return 2 + fi +} +function ble/prompt/unit:{section}/clear { + local prefix=$1 type=${2:-hash:draw} + [[ :$type: == *:hash:* ]] && + builtin eval -- "${prefix}_data[2]=" + [[ :$type: == *:tail:* ]] && + builtin eval -- "${prefix}_data=(\"\${${prefix}_data[@]::10}\")" + [[ :$type: == *:draw:* ]] && + builtin eval -- "${prefix}_dirty=1" + [[ :$type: == *:all:* ]] && + builtin eval -- "${prefix}_data=(\"\${${prefix}_data[0]}\")" + return 0 +} +function ble/prompt/unit:{section}/get { + local ref=${1}_data[8]; ret=${!ref} +} +function ble/prompt/unit:{section}/update { + local prefix=$1 ps=$2 opts=$3 + local -a vars; vars=(data dirty) + [[ :$opts: == *:measure-bbox:* ]] && ble/array#push vars bbox + [[ :$opts: == *:measure-gbox:* ]] && ble/array#push vars gbox + local "${vars[@]/%/=}" # WA #D1570 checked + ble/util/restore-vars "${prefix}_" "${vars[@]}" + local has_changed= + if [[ $prompt_unit_expired ]]; then + local original_esc=${data[8]}:${data[9]}:${data[10]} # esc:trace_hash:tailor + if [[ $ps ]]; then + [[ :$opts: == *:measure-bbox:* ]] && + local x1=${bbox[0]} y1=${bbox[1]} x2=${bbox[2]} y2=${bbox[3]} + [[ :$opts: == *:measure-gbox:* ]] && + local gx1=${gbox[0]} gy1=${gbox[1]} gx2=${gbox[2]} gy2=${gbox[3]} + local trace_hash esc x y g lc lg + ble/prompt/.instantiate "$ps" "$opts" "${data[@]:3:7}" + data=("${data[0]:-0}" '' '' "$x" "$y" "$g" "$lc" "$lg" "$esc" "$trace_hash" "${data[@]:10}") + [[ :$opts: == *:measure-bbox:* ]] && + bbox=("$x1" "$y1" "$x2" "$y2") + [[ :$opts: == *:measure-gbox:* ]] && + gbox=("$gx1" "$gy1" "$gx2" "$gy2") + else + data=("${data[0]:-0}" '' '' 0 0 0 32 0 '' '' "${data[@]:10}") + [[ :$opts: == *:measure-bbox:* ]] && bbox=() + [[ :$opts: == *:measure-gbox:* ]] && gbox=() + fi + [[ ${data[8]}:${data[9]}:${data[10]} != "$original_esc" ]] && has_changed=1 + fi + [[ $has_changed ]] && ((dirty=1)) + ble/util/save-vars "${prefix}_" "${vars[@]}" + [[ $has_changed ]] +} +function ble/prompt/unit:_ble_prompt_ps1/update { + ble/prompt/unit/add-hash '$prompt_ps1' + ble/prompt/unit:{section}/update _ble_prompt_ps1 "$prompt_ps1" show-mode-in-prompt:measure-bbox +} +function ble/prompt/unit:_ble_prompt_rps1/update { + ble/prompt/unit/add-hash '$prompt_rps1' + ble/prompt/unit/add-hash '$_ble_prompt_ps1_data' + local cols=${COLUMNS-80} + local ps1x=${_ble_prompt_ps1_data[3]} + local ps1y=${_ble_prompt_ps1_data[4]} + local prompt_rows=$((ps1y+1)) prompt_cols=$cols + ble/prompt/unit:{section}/update _ble_prompt_rps1 "$prompt_rps1" confine:relative:right:measure-gbox || return 1 + local esc=${_ble_prompt_rps1_data[8]} width= + if [[ $esc ]]; then + ((width=_ble_prompt_rps1_gbox[2]-_ble_prompt_rps1_gbox[0])) + ((width&&20+width0)); then + ((x+=xshift)) + ble/canvas/put-cuf.draw "$xshift" + fi + ble/canvas/put.draw "$esc" + ble/canvas/sflush.draw -v esc + _ble_prompt_status_data[10]=$esc + _ble_prompt_status_data[11]=$x + _ble_prompt_status_data[12]=$y + else + _ble_prompt_status_data[10]= + _ble_prompt_status_data[11]= + _ble_prompt_status_data[12]= + fi + return 0 +} +if ble/is-function ble/util/idle.push; then + _ble_prompt_timeout_task= + _ble_prompt_timeout_lineno= + function ble/prompt/timeout/process { + ble/util/idle.suspend # exit に失敗した時の為 task を suspend にする + ble/edit/marker#instantiate 'auto-logout' non-empty + local msg="$ret timed out waiting for input" + ble/widget/.internal-print-command ' + ble/util/print "$msg" + _ble_builtin_exit_processing=1 ble/builtin/exit 0' pre-flush + return 1 # exit に失敗した時 + } >&"$_ble_util_fd_tui_stdout" 2>&"$_ble_util_fd_tui_stderr" + function ble/prompt/timeout/check { + [[ $_ble_edit_lineno == "$_ble_prompt_timeout_lineno" ]] && return 0 + _ble_prompt_timeout_lineno=$_ble_edit_lineno + if [[ ${TMOUT:-} =~ ^[0-9]+ ]] && ((BASH_REMATCH>0)); then + if [[ ! $_ble_prompt_timeout_task ]]; then + ble/util/idle.push -Z 'ble/prompt/timeout/process' + _ble_prompt_timeout_task=$_ble_util_idle_lasttask + fi + ble/util/idle#sleep "$_ble_prompt_timeout_task" "$((BASH_REMATCH*1000))" + elif [[ $_ble_prompt_timeout_task ]]; then + ble/util/idle#suspend "$_ble_prompt_timeout_task" + fi + } +else + function ble/prompt/timeout/check { return 0; } +fi +function ble/prompt/update/.has-prompt_command { + [[ ${_ble_edit_PROMPT_COMMAND[*]} == *[!$_ble_term_IFS]* ]] +} +function ble/prompt/update/.eval-prompt_command { + ((${#PROMPT_COMMAND[@]})) || return 0 + local _ble_local_command _ble_edit_exec_TRAPDEBUG_adjusted=1 + ble-edit/exec:gexec/.TRAPDEBUG/restore filter + for _ble_local_command in "${PROMPT_COMMAND[@]}"; do + [[ $_ble_local_command ]] || continue + ble-edit/exec/eval-with-setexit "$_ble_local_command" pipestatus:DEBUG + done + _ble_edit_exec_gexec__TRAPDEBUG_adjust +} +_ble_prompt_update= +_ble_prompt_update_dirty= +_ble_prompt_rps1_enabled= +function ble/prompt/update { + local opts=:$1: dirty= + local count; ble/history/get-count + local version=$COLUMNS:$_ble_edit_lineno:$count + if [[ :$opts: == *:check-dirty:* && $_ble_prompt_update == owner ]]; then + if [[ $_ble_prompt_update_dirty && :$opts: != *:leave:* && $_ble_prompt_hash == "$version" ]]; then + [[ $_ble_prompt_update_dirty == dirty ]]; local ext=$? + _ble_prompt_update_dirty=done + return "$ext" + fi + fi + ble/prompt/timeout/check + _ble_prompt_rps1_enabled= + if ((_ble_textarea_panel==0)); then # 補助プロンプトに対しては PROMPT_COMMAND は実行しない + if [[ ${_ble_prompt_hash%:*} != "${version%:*}" && $opts != *:leave:* ]]; then + ble-edit/exec:gexec/invoke-hook-with-setexit internal_PRECMD + if ble/prompt/update/.has-prompt_command || blehook/has-hook PRECMD; then + if [[ $bleopt_prompt_command_changes_layout ]]; then + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + local -a DRAW_BUFF=() + ble/canvas/panel#goto.draw 0 0 0 sgr0 + ble/canvas/bflush.draw + ble/util/buffer.flush + fi + ((_ble_edit_attached)) && ble-edit/restore-PS1 + ble-edit/exec:gexec/invoke-hook-with-setexit PRECMD + ble/prompt/update/.eval-prompt_command + ((_ble_edit_attached)) && ble-edit/adjust-PS1 + if [[ $bleopt_prompt_command_changes_layout ]]; then + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout + fi + fi + fi + fi + local prompt_opts= + local prompt_ps1=$_ble_edit_PS1 + local prompt_rps1=$bleopt_prompt_rps1 + if [[ $opts == *:leave:* ]]; then + local ps1f=$bleopt_prompt_ps1_final + local rps1f=$bleopt_prompt_rps1_final + local ps1t=$bleopt_prompt_ps1_transient + [[ :$ps1t: == *:trim:* || :$ps1t: == *:same-dir:* && $PWD != $_ble_prompt_trim_opwd ]] && ps1t= + if [[ $ps1f || $rps1f || $ps1t ]]; then + prompt_opts=$prompt_opts:leave-rewrite + [[ $ps1f || $ps1t ]] && prompt_ps1=$ps1f + [[ $rps1f ]] && prompt_rps1=$rps1f + ble/textarea#invalidate + fi + fi + if [[ :$prompt_opts: == *:leave-rewrite:* || $_ble_prompt_hash != "$version" ]]; then + _ble_prompt_hash=$version + ((_ble_prompt_version++)) + fi + ble/history/update-position + local prompt_hashref_base='$_ble_prompt_version' + local prompt_rows=${LINES:-25} + local prompt_cols=${COLUMNS:-80} + local "${_ble_prompt_cache_vars[@]/%/=}" # WA #D1570 checked + local ble_prompt_unit_processing=1 + "${_ble_util_set_declare[@]//NAME/ble_prompt_unit_mark}" # disable=#D1570 + local prompt_unit= + ble/prompt/unit#update _ble_prompt_ps1 && dirty=1 + if [[ _ble_textarea_panel -ne 0 || $ble_attach_first_prompt || $MC_SID == $$ ]]; then + [[ $dirty ]] + return "$?" + fi + if [[ :$opts: == *:leave:* && ! $rps1f && $bleopt_prompt_rps1_transient ]]; then + [[ ${_ble_prompt_rps1_data[10]} ]] && dirty=1 _ble_prompt_rps1_enabled=erase + else + [[ $prompt_rps1 || ${_ble_prompt_rps1_data[10]} ]] && + ble/prompt/unit#update _ble_prompt_rps1 && dirty=1 + [[ ${_ble_prompt_rps1_data[10]} ]] && _ble_prompt_rps1_enabled=1 + fi + case ${_ble_term_TERM:-$TERM:-} in + (sun*|minix*|eterm*) ;; # black list + (*) + [[ $bleopt_prompt_xterm_title || ${_ble_prompt_xterm_title_data[10]} ]] && + ble/prompt/unit#update _ble_prompt_xterm_title && dirty=1 ;; + esac + case ${_ble_term_TERM:-$TERM:-} in + (screen:*|tmux:*|contra:*|screen.*|screen-*) + [[ $bleopt_prompt_screen_title || ${_ble_prompt_screen_title_data[10]} ]] && + ble/prompt/unit#update _ble_prompt_screen_title && dirty=1 ;; + esac + if [[ $_ble_term_tsl && $_ble_term_fsl ]]; then + [[ $bleopt_prompt_term_status || ${_ble_prompt_term_status_data[10]} ]] && + ble/prompt/unit#update _ble_prompt_term_status && dirty=1 + fi + [[ $bleopt_prompt_status_line || ${_ble_prompt_status_data[10]} ]] && + ble/prompt/unit#update _ble_prompt_status && dirty=1 + [[ $dirty ]] && _ble_prompt_update_dirty=dirty + [[ $dirty ]] +} +function ble/prompt/clear { + _ble_prompt_hash= + ble/textarea#invalidate +} +_ble_prompt_ruler=('' '' 0) +function ble/prompt/print-ruler.draw { + [[ $bleopt_prompt_ruler ]] || return 0 + local command=$1 opts=$2 cols=$COLUMNS + local rex_eval_prefix='(([!{]|time|if|then|elif|while|until|do|exec|eval|command|env|nice|nohup|xargs|sudo)[[:blank:]]+)?' + local rex_clear_command='(tput[[:blank:]]+)?(clear|reset)' + local rex=$'(^|[\n;&|(])[[:blank:]]*'$rex_eval_prefix$rex_clear_command'([ \t\n;&|)]|$)' + [[ $command =~ $rex ]] && return 0 + if [[ :$opts: == *:keep-info:* ]]; then + ble/canvas/panel#increase-height.draw "$_ble_textarea_panel" 1 + ble/canvas/panel#goto.draw "$_ble_textarea_panel" 0 0 + ((_ble_canvas_panel_height[_ble_textarea_panel]--)) + fi + if [[ $bleopt_prompt_ruler == empty-line ]]; then + ble/canvas/put.draw $'\n' + else + if [[ $bleopt_prompt_ruler != "${_ble_prompt_ruler[0]}" ]]; then + if [[ $bleopt_prompt_ruler ]]; then + local ret= x=0 y=0 g=0 x1=0 x2=0 y1=0 y2=0 + LINES=1 COLUMNS=$cols ble/canvas/trace "$bleopt_prompt_ruler" truncate:measure-bbox + _ble_prompt_ruler=("$bleopt_prompt_ruler" "$ret" "$x2") + if ((!_ble_prompt_ruler[2])); then + _ble_prompt_ruler[1]=${_ble_prompt_ruler[1]}' ' + ((_ble_prompt_ruler[2]++)) + fi + else + _ble_prompt_ruler=('' '' 0) + fi + fi + local w=${_ble_prompt_ruler[2]} + local repeat=$((cols/w)) + ble/string#repeat "${_ble_prompt_ruler[1]}" "$repeat" + ble/canvas/put.draw "$ret" + ble/string#repeat ' ' "$((cols-repeat*w))" + ble/canvas/put.draw "$ret" + ((_ble_term_xenl)) && ble/canvas/put.draw $'\n' + fi +} +function ble/prompt/print-ruler.buff { + local -a DRAW_BUFF=() + ble/prompt/print-ruler.draw "$@" + ble/canvas/bflush.draw +} +function ble/edit/info/.initialize-size { + local ret + ble/canvas/panel/layout/.get-available-height "$_ble_edit_info_panel" + cols=${COLUMNS-80} lines=$ret +} +_ble_edit_info_panel=2 +_ble_edit_info=(0 0 "") +_ble_edit_info_invalidated= +function ble/edit/info#panel::getHeight { + (($1!=_ble_edit_info_panel)) && return 0 + if ble/edit/is-command-layout || [[ ! ${_ble_edit_info[2]} ]]; then + height=0:0 + else + height=1:$((_ble_edit_info[1]+1)) + fi +} +function ble/edit/info#panel::invalidate { + (($1!=_ble_edit_info_panel)) && return 0 + _ble_edit_info_invalidated=1 +} +function ble/edit/info#panel::render { + (($1!=_ble_edit_info_panel)) && return 0 + ble/edit/is-command-layout && return 0 + [[ $_ble_edit_info_invalidated ]] || return 0 + local x=${_ble_edit_info[0]} y=${_ble_edit_info[1]} content=${_ble_edit_info[2]} + local -a DRAW_BUFF=() + if [[ ! $content ]]; then + ble/canvas/panel#set-height.draw "$_ble_edit_info_panel" 0 + else + ble/canvas/panel/reallocate-height.draw + if ((y<_ble_canvas_panel_height[$1])); then + ble/canvas/panel#clear.draw "$_ble_edit_info_panel" + ble/canvas/panel#goto.draw "$_ble_edit_info_panel" + ble/canvas/put.draw "$content" + ((_ble_canvas_y+=y,_ble_canvas_x=x)) + else + _ble_edit_info=(0 0 "") + ble/canvas/panel#set-height.draw "$_ble_edit_info_panel" 0 + fi + fi + ble/canvas/bflush.draw + _ble_edit_info_invalidated= +} +function ble/edit/info#collapse { + local panel=${1-$_ble_prompt_info_panel} + ((panel!=_ble_edit_info_panel)) && return 0 + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$panel" 0 + ble/canvas/bflush.draw + _ble_edit_info_invalidated=1 +} +function ble/edit/info/.construct-content { + local cols lines + ble/edit/info/.initialize-size + x=0 y=0 content= + local type=$1 text=$2 + case $1 in + (clear) ;; + (ansi|esc) + local trace_opts=truncate + [[ $bleopt_info_display == bottom ]] && trace_opts=$trace_opts:noscrc + [[ $1 == esc ]] && trace_opts=$trace_opts:terminfo + local ret= g=0 + LINES=$lines ble/canvas/trace "$text" "$trace_opts" + content=$ret ;; + (text) + local ret + ble/canvas/trace-text "$text" + content=$ret ;; + (store) + x=$2 y=$3 content=$4 + ((y&2 ;; + esac +} +function ble/edit/info/.rendering-enabled { + [[ $_ble_attached || -t $_ble_util_fd_tui_stderr ]] || return 1 + [[ $_ble_app_render_mode == panel ]] +} +function ble/edit/info/.render-content { + local x=$1 y=$2 content=$3 opts=$4 + if [[ $content != "${_ble_edit_info[2]}" ]]; then + _ble_edit_info=("$x" "$y" "$content") + _ble_edit_info_invalidated=1 + fi + [[ :$opts: == *:defer:* ]] && return 0 + ble/edit/info/.rendering-enabled || return 0 + ble/edit/info#panel::render "$_ble_edit_info_panel" +} +_ble_edit_info_default=(0 0 "") +_ble_edit_info_scene=default +function ble/edit/info/show { + local type=$1 text=$2 + if [[ $text ]]; then + local x y content= + ble/edit/info/.construct-content "$@" + ble/edit/info/.render-content "$x" "$y" "$content" + ble/util/buffer.flush + _ble_edit_info_scene=show + else + ble/edit/info/default + fi +} +function ble/edit/info/set-default { + local type=$1 text=$2 + local x y content + ble/edit/info/.construct-content "$type" "$text" + _ble_edit_info_default=("$x" "$y" "$content") + [[ $_ble_edit_info_scene == default ]] && + ble/edit/info/.render-content "${_ble_edit_info_default[@]}" defer +} +function ble/edit/info/default { + _ble_edit_info_scene=default + if (($#)); then + ble/edit/info/set-default "$@" + else + ble/edit/info/.render-content "${_ble_edit_info_default[@]}" defer + fi + return 0 +} +function ble/edit/info/clear { + _ble_edit_info_scene=clear + ble/edit/info/.render-content 0 0 "" +} +function ble/edit/info/immediate-clear { + if ble/edit/info/.rendering-enabled; then + local ret; ble/canvas/panel/save-position; local pos=$ret + ble/edit/info/clear + ble/canvas/panel/load-position "$pos" + ble/util/buffer.flush + else + ble/edit/info/clear + fi +} +function ble/edit/info/immediate-show { + if ble/edit/info/.rendering-enabled; then + local ret; ble/canvas/panel/save-position; local pos=$ret + ble/edit/info/show "$@" + ble/canvas/panel/load-position "$pos" + ble/util/buffer.flush + else + ble/edit/info/show "$@" + fi +} +function ble/edit/info/immediate-default { + if ble/edit/info/.rendering-enabled; then + local ret; ble/canvas/panel/save-position; local pos=$ret + ble/edit/info/default + ble/edit/info/.render-content "${_ble_edit_info_default[@]}" + ble/canvas/panel/load-position "$pos" + ble/util/buffer.flush + else + ble/edit/info/default + fi +} +_ble_edit_VARNAMES=( + _ble_edit_str + _ble_edit_ind + _ble_edit_mark + _ble_edit_mark_active + _ble_edit_overwrite_mode + _ble_edit_line_disabled + _ble_edit_arg + _ble_edit_dirty_draw_beg + _ble_edit_dirty_draw_end + _ble_edit_dirty_draw_end0 + _ble_edit_dirty_syntax_beg + _ble_edit_dirty_syntax_end + _ble_edit_dirty_syntax_end0 + _ble_edit_dirty_observer + _ble_edit_kill_index + _ble_edit_kill_ring + _ble_edit_kill_type) +_ble_edit_str= +_ble_edit_ind=0 +_ble_edit_mark=0 +_ble_edit_mark_active= +_ble_edit_overwrite_mode= +_ble_edit_line_disabled= +_ble_edit_arg= +_ble_edit_kill_index=0 +_ble_edit_kill_ring=() +_ble_edit_kill_type=() +function ble-edit/content/replace { + local beg=$1 end=$2 + local ins=$3 reason=${4:-edit} + _ble_edit_str="${_ble_edit_str::beg}""$ins""${_ble_edit_str:end}" + ble-edit/content/.update-dirty-range "$beg" "$((beg+${#ins}))" "$end" "$reason" + ble/util/assert \ + '((0<=_ble_edit_dirty_syntax_beg&&_ble_edit_dirty_syntax_end<=${#_ble_edit_str}))' \ + "0 <= beg=$_ble_edit_dirty_syntax_beg <= end=$_ble_edit_dirty_syntax_end <= len=${#_ble_edit_str}; beg=$beg, end=$end, ins(${#ins})=$ins" || + { + _ble_edit_dirty_syntax_beg=0 + _ble_edit_dirty_syntax_end=${#_ble_edit_str} + _ble_edit_dirty_syntax_end0=0 + local olen=$((${#_ble_edit_str}-${#ins}+end-beg)) + ((olen<0&&(olen=0), + _ble_edit_ind>olen&&(_ble_edit_ind=olen), + _ble_edit_mark>olen&&(_ble_edit_mark=olen))) + } +} +function ble-edit/content/reset { + local str=$1 reason=${2:-edit} + local beg=0 end=${#str} end0=${#_ble_edit_str} + _ble_edit_str=$str + ble-edit/content/.update-dirty-range "$beg" "$end" "$end0" "$reason" + ble/util/assert \ + '((0<=_ble_edit_dirty_syntax_beg&&_ble_edit_dirty_syntax_end<=${#_ble_edit_str}))' \ + "0 <= beg=$_ble_edit_dirty_syntax_beg <= end=$_ble_edit_dirty_syntax_end <= len=${#_ble_edit_str}; str(${#str})=$str" || + { + _ble_edit_dirty_syntax_beg=0 + _ble_edit_dirty_syntax_end=${#_ble_edit_str} + _ble_edit_dirty_syntax_end0=0 + } +} +function ble-edit/content/reset-and-check-dirty { + local str=$1 reason=${2:-edit} + [[ $_ble_edit_str == "$str" ]] && return 0 + local ret pref suff + ble/string#common-prefix "$_ble_edit_str" "$str"; pref=$ret + local dmin=${#pref} + ble/string#common-suffix "${_ble_edit_str:dmin}" "${str:dmin}"; suff=$ret + local dmax0=$((${#_ble_edit_str}-${#suff})) dmax=$((${#str}-${#suff})) + _ble_edit_str=$str + ble-edit/content/.update-dirty-range "$dmin" "$dmax" "$dmax0" "$reason" +} +function ble-edit/content/replace-limited { + insert=$3 + if [[ $bleopt_line_limit_type == discard ]]; then + local ibeg=$1 iend=$2 opts=:$4: + local limit=$((bleopt_line_limit_length)) + if ((limit)); then + local inslimit=$((limit-${#_ble_edit_str}+(iend-ibeg))) + ((inslimitinslimit)) && insert=${insert::inslimit} + if [[ ! $insert ]] && ((ibeg==iend)); then + [[ $opts == *:nobell:* ]] || + ble/widget/.bell "ble: reached line_limit_length=$limit" + return 1 + fi + fi + fi + ble-edit/content/replace "$1" "$2" "$insert" +} +function ble-edit/content/check-limit { + local opts=:${1:-truncate:editor}: + if [[ $opts == *:${bleopt_line_limit_type:-none}:* ]]; then + local limit=$((bleopt_line_limit_length)) + if ((limit>0&&${#_ble_edit_str}>limit)); then + local ble_edit_line_limit=$limit + ble-decode-key "$_ble_decode_KCODE_LINE_LIMIT" + fi + fi +} +function ble/widget/__line_limit__ { + local editor=ble/widget/${1:-edit-and-execute-command.impl} + local limit=$ble_edit_line_limit + case ${bleopt_line_limit_type:-none} in + (editor) + local content=$_ble_edit_str + ble-edit/content/reset "# reached line_limit_length=$limit" + _ble_edit_ind=0 _ble_edit_mark=0 + "$editor" "$content" + (($?==127)) && + ble-edit/content/reset "${content::limit}" + return 1 ;; + (truncate|*) + ble-edit/content/replace "$limit" "${#_ble_edit_str}" '' + ((_ble_edit_ind>limit&&(_ble_edit_ind=limit))) + ((_ble_edit_mark>limit&&(_ble_edit_mark=limit))) + return 1 ;; + esac + return 0 +} +_ble_edit_dirty_draw_beg=-1 +_ble_edit_dirty_draw_end=-1 +_ble_edit_dirty_draw_end0=-1 +_ble_edit_dirty_syntax_beg=0 +_ble_edit_dirty_syntax_end=0 +_ble_edit_dirty_syntax_end0=1 +_ble_edit_dirty_observer=() +function ble-edit/content/.update-dirty-range { + ble/dirty-range#update --prefix=_ble_edit_dirty_draw_ "${@:1:3}" + ble/dirty-range#update --prefix=_ble_edit_dirty_syntax_ "${@:1:3}" + ble/textmap#update-dirty-range "${@:1:3}" + local obs + for obs in "${_ble_edit_dirty_observer[@]}"; do "$obs" "$@"; done +} +function ble-edit/content/update-syntax { + if ble/util/import/is-loaded "$_ble_base/lib/core-syntax.sh"; then + local beg end end0 + ble/dirty-range#load --prefix=_ble_edit_dirty_syntax_ + if ((beg>=0)); then + ble/dirty-range#clear --prefix=_ble_edit_dirty_syntax_ + ble/syntax/parse "$_ble_edit_str" '' "$beg" "$end" "$end0" + fi + fi +} +function ble-edit/content/eolp { + local pos=${1:-$_ble_edit_ind} + ((pos==${#_ble_edit_str})) || [[ ${_ble_edit_str:pos:1} == $'\n' ]] +} +function ble-edit/content/bolp { + local pos=${1:-$_ble_edit_ind} + ((pos<=0)) || [[ ${_ble_edit_str:pos-1:1} == $'\n' ]] +} +function ble-edit/content/find-logical-eol { + local index=${1:-$_ble_edit_ind} offset=${2:-0} + if ((offset>0)); then + local text=${_ble_edit_str:index} + local rex=$'^([^\n]*\n){0,'$((offset-1))$'}([^\n]*\n)?[^\n]*' + [[ $text =~ $rex ]] + ((ret=index+${#BASH_REMATCH})) + [[ ${BASH_REMATCH[2]} ]] + elif ((offset<0)); then + local text=${_ble_edit_str::index} + local rex=$'(\n[^\n]*){0,'$((-offset-1))$'}(\n[^\n]*)?$' + [[ $text =~ $rex ]] + if [[ $BASH_REMATCH ]]; then + ((ret=index-${#BASH_REMATCH})) + [[ ${BASH_REMATCH[2]} ]] + else + ble-edit/content/find-logical-eol "$index" 0 + return 1 + fi + else + local text=${_ble_edit_str:index} + text=${text%%$'\n'*} + ((ret=index+${#text})) + return 0 + fi +} +function ble-edit/content/find-logical-bol { + local index=${1:-$_ble_edit_ind} offset=${2:-0} + if ((offset>0)); then + local rex=$'^([^\n]*\n){0,'$((offset-1))$'}([^\n]*\n)?' + [[ ${_ble_edit_str:index} =~ $rex ]] + if [[ $BASH_REMATCH ]]; then + ((ret=index+${#BASH_REMATCH})) + [[ ${BASH_REMATCH[2]} ]] + else + ble-edit/content/find-logical-bol "$index" 0 + return 1 + fi + elif ((offset<0)); then + ble-edit/content/find-logical-eol "$index" "$offset"; local ext=$? + ble-edit/content/find-logical-bol "$ret" 0 + return "$ext" + else + local text=${_ble_edit_str::index} + text=${text##*$'\n'} + ((ret=index-${#text})) + return 0 + fi +} +function ble-edit/content/find-non-space { + local bol=$1 + local rex=$'^[ \t]*'; [[ ${_ble_edit_str:bol} =~ $rex ]] + ret=$((bol+${#BASH_REMATCH})) +} +function ble-edit/content/is-single-line { + [[ $_ble_edit_str != *$'\n'* ]] +} +function ble-edit/content/get-arg { + local default_value=$1 + local value=$_ble_edit_arg + _ble_edit_arg= + if [[ $value == +* ]]; then + if [[ $value == + ]]; then + arg=4 + return 0 + fi + value=${value#+} + fi + if [[ $value == -* ]]; then + if [[ $value == - ]]; then + arg=-1 + else + arg=$((-10#0${value#-})) + fi + else + if [[ $value ]]; then + arg=$((10#0$value)) + else + arg=$default_value + fi + fi +} +function ble-edit/content/clear-arg { + _ble_edit_arg= +} +function ble-edit/content/toggle-arg { + if [[ $_ble_edit_arg == + ]]; then + _ble_edit_arg= + elif [[ $_ble_edit_arg && $_ble_edit_arg != +* ]]; then + _ble_edit_arg=+$_ble_edit_arg + else + _ble_edit_arg=+ + fi +} +function ble/keymap:generic/get-arg { + if [[ $_ble_decode_keymap == vi_[noxs]map ]]; then + local ARG FLAG REG + ble/keymap:vi/get-arg "$1" + arg=$ARG + else + ble-edit/content/get-arg "$1" + fi +} +function ble/keymap:generic/clear-arg { + if [[ $_ble_decode_keymap == vi_[noxs]map ]]; then + ble/keymap:vi/clear-arg + else + ble-edit/content/clear-arg + fi +} +function ble/widget/append-arg-or { + ble/function#try ble/widget/complete/.select-menu-with-arg "${2-}" && return 0 + local n=${#KEYS[@]}; ((n&&n--)) + local code=$((KEYS[n]&_ble_decode_MaskChar)) + ((code==0)) && return 1 + local ret; ble/util/c2s "$code"; local ch=$ret + if + if [[ $_ble_edit_arg == + ]]; then + [[ $ch == [-0-9] ]] && _ble_edit_arg= + elif [[ $_ble_edit_arg == +* ]]; then + builtin false + elif [[ $_ble_edit_arg ]]; then + [[ $ch == [0-9] ]] + else + ((KEYS[n]&_ble_decode_MaskFlag)) + fi + then + ble/decode/widget/skip-lastwidget + _ble_edit_arg=$_ble_edit_arg$ch + else + ble/widget/"$1" + fi +} +function ble/widget/append-arg { + ble/widget/append-arg-or self-insert "$@" +} +function ble/widget/universal-arg { + ble/decode/widget/skip-lastwidget + ble-edit/content/toggle-arg +} +function ble-edit/content/prepend-kill-ring { + _ble_edit_kill_index=0 + local otext=${_ble_edit_kill_ring[0]-} ntext=$1 + local otype=${_ble_edit_kill_type[0]-} ntype=$2 + if [[ $otype == L || $ntype == L ]]; then + ntext=${ntext%$'\n'}$'\n' + otext=${otext%$'\n'}$'\n' + _ble_edit_kill_ring[0]=$ntext$otext + _ble_edit_kill_type[0]=L + elif [[ $otype == B:* ]]; then + if [[ $ntype != B:* ]]; then + ntext=${ntext%$'\n'}$'\n' + local ret; ble/string#count-char "$ntext" $'\n' + ble/string#repeat '0 ' "$ret" + ntype=B:${ret%' '} + fi + _ble_edit_kill_ring[0]=$ntext$otext + _ble_edit_kill_type[0]="B:${ntype#B:} ${otype#B:}" + else + _ble_edit_kill_ring[0]=$ntext$otext + _ble_edit_kill_type[0]=$otype + fi +} +function ble-edit/content/append-kill-ring { + _ble_edit_kill_index=0 + local otext=${_ble_edit_kill_ring[0]-} ntext=$1 + local otype=${_ble_edit_kill_type[0]-} ntype=$2 + if [[ $otype == L || $ntype == L ]]; then + ntext=${ntext%$'\n'}$'\n' + otext=${otext%$'\n'}$'\n' + _ble_edit_kill_ring[0]=$otext$ntext + _ble_edit_kill_type[0]=L + elif [[ $otype == B:* ]]; then + if [[ $ntype != B:* ]]; then + ntext=${ntext%$'\n'}$'\n' + local ret; ble/string#count-char "$ntext" $'\n' + ble/string#repeat '0 ' "$ret" + ntype=B:${ret%' '} + fi + _ble_edit_kill_ring[0]=$otext$ntext + _ble_edit_kill_type[0]="B:${otype#B:} ${ntype#B:}" + else + _ble_edit_kill_ring[0]=$otext$ntext + _ble_edit_kill_type[0]=$otype + fi +} +function ble-edit/content/push-kill-ring { + if ((${#_ble_edit_kill_ring[@]})) && [[ ${LASTWIDGET#ble/widget/} == kill-* || ${LASTWIDGET#ble/widget/} == copy-* ]]; then + local proc= + local name; ble/string#split-words name "${WIDGET#ble/widget/}" + if [[ $3 == backward || $name == kill-backward-* || $name == copy-backward-* ]]; then + proc=ble-edit/content/prepend-kill-ring + elif [[ $3 == forward || $name == kill-forward-* || $name == copy-forward-* ]]; then + proc=ble-edit/content/append-kill-ring + elif [[ $name == kill-region* || $name == copy-region* ]]; then + proc= + elif [[ $3 == [0-9]*:[0-9]* ]] && ((${3##*:}<=_ble_edit_ind)); then + proc=ble-edit/content/prepend-kill-ring + else + proc=ble-edit/content/append-kill-ring + fi + if [[ $proc ]]; then + "$proc" "$1" "$2" + return "$?" + fi + fi + _ble_edit_kill_index=0 + ble/array#unshift _ble_edit_kill_ring "$1" + ble/array#unshift _ble_edit_kill_type "$2" +} +_ble_edit_PS1_adjusted= +_ble_edit_PS1='\s-\v\$ ' +_ble_edit_PROMPT_COMMAND= +function ble-edit/adjust-PS1 { + [[ $_ble_edit_PS1_adjusted ]] && return 0 + _ble_edit_PS1_adjusted=1 + _ble_edit_PS1=$PS1 + if [[ $bleopt_internal_suppress_bash_output ]]; then + PS1='[ble: press RET to continue]' + else + PS1= + fi + if ble/is-array PROMPT_COMMAND; then + ble/idict#copy _ble_edit_PROMPT_COMMAND PROMPT_COMMAND + else + ble/variable#copy-state PROMPT_COMMAND _ble_edit_PROMPT_COMMAND + fi + builtin unset -v PROMPT_COMMAND +} +function ble-edit/restore-PS1 { + [[ $_ble_edit_PS1_adjusted ]] || return 1 + _ble_edit_PS1_adjusted= + PS1=$_ble_edit_PS1 + if ble/is-array _ble_edit_PROMPT_COMMAND; then + ble/idict#copy PROMPT_COMMAND _ble_edit_PROMPT_COMMAND + else + ble/variable#copy-state _ble_edit_PROMPT_COMMAND PROMPT_COMMAND + fi +} +_ble_edit_IGNOREEOF_adjusted= +_ble_edit_IGNOREEOF= +function ble-edit/adjust-IGNOREEOF { + [[ $_ble_edit_IGNOREEOF_adjusted ]] && return 0 + _ble_edit_IGNOREEOF_adjusted=1 + if [[ ${IGNOREEOF+set} ]]; then + _ble_edit_IGNOREEOF=$IGNOREEOF + else + builtin unset -v _ble_edit_IGNOREEOF + fi + if ((_ble_bash>=40000)); then + builtin unset -v IGNOREEOF + else + IGNOREEOF=9999 + fi +} +function ble-edit/restore-IGNOREEOF { + [[ $_ble_edit_IGNOREEOF_adjusted ]] || return 1 + _ble_edit_IGNOREEOF_adjusted= + if [[ ${_ble_edit_IGNOREEOF+set} ]]; then + IGNOREEOF=$_ble_edit_IGNOREEOF + else + builtin unset -v IGNOREEOF + fi +} +_ble_edit_READLINE=() +function ble-edit/adjust-READLINE { + [[ $_ble_edit_READLINE ]] && return 0 + _ble_edit_READLINE=1 + ble/variable#copy-state READLINE_LINE '_ble_edit_READLINE[1]' + ble/variable#copy-state READLINE_POINT '_ble_edit_READLINE[2]' + ble/variable#copy-state READLINE_MARK '_ble_edit_READLINE[3]' +} +function ble-edit/restore-READLINE { + [[ $_ble_edit_READLINE ]] || return 0 + _ble_edit_READLINE= + ble/variable#copy-state '_ble_edit_READLINE[1]' READLINE_LINE + ble/variable#copy-state '_ble_edit_READLINE[2]' READLINE_POINT + ble/variable#copy-state '_ble_edit_READLINE[3]' READLINE_MARK +} +function ble-edit/eval-IGNOREEOF { + local value= + if [[ $_ble_edit_IGNOREEOF_adjusted ]]; then + value=${_ble_edit_IGNOREEOF-0} + else + value=${IGNOREEOF-0} + fi + if [[ $value && ! ${value//[0-9]} ]]; then + ret=$((10#0$value)) + else + ret=10 + fi +} +function ble/variable#load-user-state/variable:PS1 { + __ble_var_set=${_ble_edit_PS1+set} + __ble_var_val=("${_ble_edit_exec_PS1[@]}") + ble/variable#get-attr -v __ble_var_att PS1 +} +function ble/variable#load-user-state/variable:PROMPT_COMMAND { + if ble/is-array _ble_edit_PROMPT_COMMAND; then + __ble_var_set=set + ble/idict#copy __ble_var_val _ble_edit_PROMPT_COMMAND + else + __ble_var_set=${_ble_edit_PROMPT_COMMAND+set} + ble/variable#copy-state _ble_edit_PROMPT_COMMAND __ble_var_val + fi + ble/variable#get-attr -v __ble_var_att _ble_edit_PROMPT_COMMAND +} +function ble/variable#load-user-state/variable:IGNOREEOF { + __ble_var_set=${_ble_edit_IGNOREEOF+set} + __ble_var_val=${_ble_edit_IGNOREEOF-} + ble/variable#get-attr -v __ble_var_att _ble_edit_exec_IGNOREEOF +} +bleopt/declare -n canvas_winch_action redraw-here +function ble-edit/attach/TRAPWINCH { + ((_ble_edit_attached)) && [[ $_ble_term_state == internal ]] && + ! ble/edit/is-command-layout && ! ble/util/is-running-in-subshell || + return 0 + ble/application/onwinch 2>&"$_ble_util_fd_tui_stderr" +} +_ble_edit_attached=0 +function ble-edit/attach/.attach { + ((_ble_edit_attached)) && return 0 + _ble_edit_attached=1 + if [[ ! ${_ble_edit_LINENO+set} ]]; then + _ble_edit_LINENO=${BASH_LINENO[${#BASH_LINENO[@]}-1]} + ((_ble_edit_LINENO<0)) && _ble_edit_LINENO=0 + ((_ble_edit_CMD<=_ble_edit_LINENO+1)) && ((_ble_edit_CMD=_ble_edit_LINENO+1)) + fi + ble/builtin/trap/install-hook WINCH readline + blehook internal_WINCH!=ble-edit/attach/TRAPWINCH + ble-edit/adjust-PS1 + ble-edit/adjust-READLINE + ble-edit/adjust-IGNOREEOF + [[ $bleopt_internal_exec_type == exec ]] && _ble_edit_IFS=$IFS +} +function ble-edit/attach/.detach { + ((!_ble_edit_attached)) && return 0 + ble-edit/restore-PS1 + ble-edit/restore-READLINE + ble-edit/restore-IGNOREEOF + [[ $bleopt_internal_exec_type == exec ]] && IFS=$_ble_edit_IFS + _ble_edit_attached=0 +} +_ble_textarea_VARNAMES=( + _ble_textarea_buffer + _ble_textarea_bufferName + _ble_textarea_cur + _ble_textarea_panel + _ble_textarea_scroll + _ble_textarea_scroll_new + _ble_textarea_gendx + _ble_textarea_gendy + _ble_textarea_invalidated + _ble_textarea_version + _ble_textarea_caret_state + _ble_textarea_cache + _ble_textarea_render_defer) +_ble_textarea_local_VARNAMES=() +function ble/textarea#panel::getHeight { + if [[ $1 == "$_ble_textarea_panel" ]]; then + local min=$((_ble_prompt_ps1_data[4]+1)) max=$((_ble_textmap_endy+1)) + ((min=_ble_app_winsize[0])) && return 1 + local height=${_ble_canvas_panel_height[ipanel]} + local proy=${_ble_prompt_ps1_data[4]} + local newline= reflow= offset= + if ((y<=proy)); then + ((newline=y,reflow=0,offset=x)) + elif ((y=6&&rnline>rheight+2?2:1)) + local smin smax + ((smin=rcy-rheight+margin, + smin>nline-height&&(smin=nline-height), + smax=rcy-margin, + smax<0&&(smax=0))) + if ((scroll>smax)); then + scroll=$smax + elif ((scrollwmax&&(umax=wmax))) + else + scroll= + if ! ble/util/assert '((height==nline))'; then + ble/canvas/panel#set-height.draw "$_ble_textarea_panel" "$nline" + height=$nline + fi + fi +} +function ble/textarea#render/.perform-scroll { + local new_scroll=$1 + if ((new_scroll!=_ble_textarea_scroll)); then + local scry=$((begy+1)) + local scrh=$((height-scry)) + local fmin fmax index + if ((_ble_textarea_scroll>new_scroll)); then + local shift=$((_ble_textarea_scroll-new_scroll)) + local draw_shift=$((shift=0)); then + dirty=1 + elif [[ $_ble_textarea_invalidated ]]; then + dirty=1 + elif [[ $_ble_textarea_caret_state != "$caret_state" ]]; then + dirty=1 + elif [[ $_ble_textarea_scroll != "$_ble_textarea_scroll_new" ]]; then + dirty=1 + elif [[ :$opts: == *:leave:* || :$opts: == *:update:* ]]; then + dirty=1 + fi + if [[ ! $dirty ]]; then + ble/textarea#focus + return 0 + fi + local cols=${COLUMNS-80} + local subprompt_enabled= + ((_ble_textarea_panel==0)) && subprompt_enabled=1 + local rps1_enabled=$_ble_prompt_rps1_enabled + local rps1_width=${_ble_prompt_rps1_data[11]} + if [[ $rps1_enabled ]]; then + ((cols-=rps1_width+1,_ble_term_xenl||cols--)) + if [[ $rps1_enabled == erase ]]; then + ble/textarea#render/.erase-rprompt + rps1_enabled= + fi + fi + local text=$_ble_edit_str index=$_ble_edit_ind + local iN=${#text} + ((index<0?(index=0):(index>iN&&(index=iN)))) + local umin=-1 umax=-1 + local x=${_ble_prompt_ps1_data[3]} + local y=${_ble_prompt_ps1_data[4]} + local render_opts= + [[ $rps1_enabled ]] && render_opts=relative + COLUMNS=$cols ble/textmap#update "$text" "$render_opts" # [ref] x y + ble/urange#update "$_ble_textmap_umin" "$_ble_textmap_umax" # [ref] umin umax + ble/urange#clear --prefix=_ble_textmap_ + if [[ :$opts: == *:leave:* ]]; then + local _ble_complete_menu_active= # suppress layer:menu_filter + local _ble_edit_mark_active= # suppress layer:region + local _ble_edit_overwrite_mode= # suppress layer:overwrite_mode + fi + local DMIN=$_ble_edit_dirty_draw_beg + ble-edit/content/update-syntax + ble/textarea#update-text-buffer # [in] text index [ref] lc lg; + local lc=32 lg=0 + [[ $bleopt_internal_suppress_bash_output ]] || + ble/textarea#update-left-char "$index" + local -a DRAW_BUFF=() + local begx=$_ble_textmap_begx begy=$_ble_textmap_begy + local endx=$_ble_textmap_endx endy=$_ble_textmap_endy + local cx cy + ble/textmap#getxy.cur --prefix=c "$index" # → cx cy + local cols=$_ble_textmap_cols + local height=${_ble_canvas_panel_height[_ble_textarea_panel]} + local scroll=${_ble_textarea_scroll_new:-$_ble_textarea_scroll} + ble/textarea#render/.determine-scroll # update: height scroll umin umax + local gend gendx gendy + if [[ $scroll ]]; then + ble/textmap#get-index-at "$cols" "$((height+scroll-1))"; gend=$index + ble/textmap#getxy.out --prefix=gend "$gend" + ((gendy-=scroll)) + else + gend=$iN gendx=$endx gendy=$endy + fi + _ble_textarea_gendx=$gendx _ble_textarea_gendy=$gendy + local ret esc_line= esc_line_set= + if [[ ! $_ble_textarea_invalidated ]]; then + [[ ! $rps1_enabled && $_ble_prompt_rps1_shown || $rps1_enabled && $_ble_prompt_rps1_dirty ]] && + ble/textarea#render/.cleanup-trailing-spaces-after-newline + ble/textarea#render/.perform-scroll "$scroll" # update: umin umax + _ble_textarea_scroll_new=$_ble_textarea_scroll + [[ $rps1_enabled ]] && ble/textarea#render/.show-rprompt + ble/textarea#render/.show-prompt + if [[ $subprompt_enabled ]]; then + ble/textarea#render/.show-control-string _ble_prompt_xterm_title + ble/textarea#render/.show-control-string _ble_prompt_screen_title + ble/textarea#render/.show-control-string _ble_prompt_term_status + fi + if ((umin=0)); then + local endY=$((endy-_ble_textarea_scroll)) + if ((endY0)) && ble/canvas/put-cub.draw "$ret" + ble/util/c2bc "$lc" + READLINE_POINT=$ret + fi + ble/color/g2sgr "$lg" + ble/canvas/put.draw "$ret" + fi +} +function ble/textarea#save-state { + local prefix=$1 + local -a vars=() + ble/array#push vars _ble_edit_PS1 _ble_prompt_ps1_data + ble/array#push vars "${_ble_edit_VARNAMES[@]}" + ble/array#push vars "${_ble_textmap_VARNAMES[@]}" + ble/array#push vars _ble_highlight_layer_list + local layer names + for layer in "${_ble_highlight_layer_list[@]}"; do + local _ble_local_script=' + if [[ ${_ble_highlight_layer_LAYER_VARNAMES[@]-} ]]; then + ble/array#push vars "${_ble_highlight_layer_LAYER_VARNAMES[@]}" + else + ble/array#push vars "${!_ble_highlight_layer_LAYER_@}" + fi' + builtin eval -- "${_ble_local_script//LAYER/$layer}" + done + ble/array#push vars "${_ble_textarea_VARNAMES[@]}" + ble/array#push vars "${_ble_syntax_VARNAMES[@]}" + ble/array#push vars "${_ble_textarea_local_VARNAMES[@]}" + builtin eval -- "${prefix}_VARNAMES=(\"\${vars[@]}\")" + ble/util/save-vars "$prefix" "${vars[@]}" +} +function ble/textarea#restore-state { + local prefix=$1 + if builtin eval "[[ \$prefix && \${${prefix}_VARNAMES+set} ]]"; then + builtin eval "ble/util/restore-vars $prefix \"\${${prefix}_VARNAMES[@]}\"" + else + ble/util/print "ble/textarea#restore-state: unknown prefix '$prefix'." >&2 + return 1 + fi +} +function ble/textarea#clear-state { + local prefix=$1 + if [[ $prefix ]]; then + local vars=${prefix}_VARNAMES + builtin eval "builtin unset -v \"\${$vars[@]/#/$prefix}\" $vars" + else + ble/util/print "ble/textarea#restore-state: unknown prefix '$prefix'." >&2 + return 1 + fi +} +_ble_textarea_render_defer= +function ble/textarea#render-defer.idle { + ble/util/idle.wait-user-input + [[ $_ble_textarea_render_defer ]] || return 0 + local ble_textarea_render_defer_running=1 + ble/util/buffer.flush + _ble_textarea_render_defer= + blehook/invoke textarea_render_defer + ble/textarea#render update + [[ $_ble_textarea_render_defer ]] && + ble/util/idle.continue + return 0 +} +ble/function#try ble/util/idle.push-background ble/textarea#render-defer.idle +function ble/widget/.update-textmap { + local cols=${COLUMNS:-80} render_opts= + if [[ $_ble_prompt_rps1_enabled ]]; then + local rps1_width=${_ble_prompt_rps1_data[11]} + render_opts=relative + ((cols-=rps1_width+1,_ble_term_xenl||cols--)) + fi + local x=$_ble_textmap_begx y=$_ble_textmap_begy + COLUMNS=$cols ble/textmap#update "$_ble_edit_str" "$render_opts" +} +function ble/widget/do-lowercase-version { + local n=${#KEYS[@]}; ((n&&n--)) + local flag=$((KEYS[n]&_ble_decode_MaskFlag)) + local char=$((KEYS[n]&_ble_decode_MaskChar)) + if ((65<=char&&char<=90)); then + ble/decode/widget/redispatch-by-keys "$((flag|char+32))" "${KEYS[@]:1}" + else + return 125 + fi +} +function ble/widget/redraw-line { + ble-edit/content/clear-arg + ble/textarea#invalidate +} +function ble/widget/clear-screen { + ble-edit/content/clear-arg + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + _ble_prompt_trim_opwd= + ble/textarea#invalidate + local -a DRAW_BUFF=() + ble/canvas/panel/goto-top-dock.draw + ble/canvas/bflush.draw + ble/util/buffer "$_ble_term_clear" + _ble_canvas_x=0 _ble_canvas_y=0 + ble/term/visible-bell/cancel-erasure + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout +} +function ble/widget/clear-display { + ble/util/buffer $'\e[3J' + ble/widget/clear-screen +} +function ble/edit/display-version/git-rev-parse { + ret= + local git_base opts=$2 + case $1 in + (.) git_base=$PWD ;; + (./*) git_base=$PWD/${1#./} ;; + (..|../*) git_base=$PWD/$1 ;; + (*) git_base=$1 ;; + esac + "${_ble_util_set_declare[@]//NAME/visited}" # WA #D1570 checked + until [[ -s $git_base/HEAD || -s $git_base/.git/HEAD ]]; do + ble/set#contains visited "$git_base" && return 1 + ble/set#add visited "$git_base" + if [[ -f $git_base/.git ]]; then + local content + ble/util/mapfile content < "$git_base/.git" + if ble/string#match "$content" '^gitdir: (.*)'; then + git_base=$git_base/${BASH_REMATCH[1]} + continue + fi + fi + if [[ :$opts: == *:parent:* && $git_base == */* ]]; then + git_base=${git_base%/*} + continue + fi + break + done + [[ -s $git_base/HEAD ]] || git_base=$git_base/.git + local head=$git_base/HEAD + if [[ -f $head ]]; then + local content + ble/util/mapfile content < "$head" + if ble/string#match "$content" '^ref: (.*)$'; then + head=$git_base/${BASH_REMATCH[1]} + ble/util/mapfile content < "$head" + fi + if ble/string#match "$content" '^[a-f0-9]+$'; then + content=${content::8} + fi + ret=$content + [[ $ret ]] + return "$?" + fi + return 1 +} +function ble/edit/display-version/git-hash-object { + local file=$1 size + if ! ble/util/assign size 'ble/bin/wc -c "$file" 2>/dev/null'; then + ret='error' + return 1 + fi + ble/string#split-words size "$size" + if ble/bin#has git; then + ble/util/assign ret 'git hash-object "$file"' + ret="hash:$ret, $size bytes" + elif ble/bin#has sha1sum; then + local _ble_local_tmpfile; ble/util/assign/mktmp + { printf 'blob %d\0' "$size"; ble/bin/cat "$file"; } >| "$_ble_local_tmpfile" + blob_data=$_ble_local_tmpfile ble/util/assign ret 'sha1sum "$blob_data"' + ble/util/assign/rmtmp + ble/string#split-words ret "$ret" + ret="sha1:$ret, $size bytes" + elif ble/bin#has cksum; then + ble/util/assign-words ret 'cksum "$file"' + ble/util/sprintf ret 'cksum:%08x, %d bytes' "$ret" "$size" + else + ret=size:$size + fi +} +function ble/edit/display-version/add-line { + lines[iline++]=$1 +} +function ble/edit/display-version/check:bash-completion { + [[ ${BASH_COMPLETION_VERSINFO[0]-} ]] || return 1 + local patch=${BASH_COMPLETION_VERSINFO[2]-} + local version=${BASH_COMPLETION_VERSINFO[0]}.${BASH_COMPLETION_VERSINFO[1]:-y}${patch:+.$patch} + local source lineno ret + if ble/function#get-source-and-lineno _init_completion; then + if ble/edit/display-version/git-rev-parse "${source%/*}"; then + version=$sgrV$version+$ret$sgr0 + elif ble/edit/display-version/git-hash-object "$source"; then + version="$sgrV$version$sgr0 ($ret)" + fi + fi + ble/edit/display-version/add-line "${sgrF}bash-completion$sgr0, version $version$label_noarch" +} +function ble/edit/display-version/check:bash-preexec { + local source lineno ret + ble/function#get-source-and-lineno __bp_preexec_invoke_exec || return 1 + local version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}"; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + local file=${source##*/} + if [[ $file == bash-preexec.sh || $file == bash-preexec.bash ]]; then + file= + else + file=" ($file)" + fi + local integ_label=$label_integration_off + ble/util/import/is-loaded contrib/integration/bash-preexec && integ_label=$label_integration + ble/edit/display-version/add-line "${sgrF}bash-preexec$sgr0$file, $version$integ_label" +} +function ble/edit/display-version/check:fzf { + local source lineno ret + if ble/function#get-source-and-lineno __fzf_select__; then + local version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}" parent; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + local integ= integ_label=$label_integration_off + ble/util/import/is-loaded integration/fzf-key-bindings && + integ=1 integ_label=$label_integration + ble/edit/display-version/add-line "${sgrC}fzf$sgr0 ${sgrF}key-bindings$sgr0, $version$integ_label" + [[ $integ ]] || ble/edit/display-version/add-line "$label_warning: fzf integration \"integration/fzf-key-bindings\" is not activated." + fi + if ble/function#get-source-and-lineno __fzf_orig_completion; then + local version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}" parent; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + local integ= integ_label=$label_integration_off + ble/util/import/is-loaded integration/fzf-completion && + integ=1 integ_label=$label_integration + ble/edit/display-version/add-line "${sgrC}fzf$sgr0 ${sgrF}completion$sgr0, $version$integ_label" + [[ $integ ]] || ble/edit/display-version/add-line "$label_warning: fzf integration \"integration/fzf-completion\" is not activated." + fi +} +function ble/edit/display-version/check:starship { + local source lineno + ble/function#get-source-and-lineno starship_precmd || return 1 + local starship sed_script='s/^[[:blank:]]*PS1="\$(\(.\{1,\}\) prompt .*)";\{0,1\}$/\1/p' + ble/util/assign-array starship 'declare -f starship_precmd | ble/bin/sed -n "$sed_script"' + if ! ble/bin#has "$starship"; then + { builtin eval -- "starship=$starship" && ble/bin#has "$starship"; } || + { starship=starship; ble/bin#has "$starship"; } || return 1 + fi + local awk_script=' + sub(/^starship /, "") { version = $0; next; } + sub(/^branch:/, "") { gsub(/['"$_ble_term_blank"']/, "_"); if ($0 != "") version = version "-" $0; next; } + sub(/^commit_hash:/, "") { gsub(/['"$_ble_term_blank"']/, "_"); if ($0 != "") version = version "+" $0; next; } + sub(/^build_time:/, "") { build_time = $0; } + sub(/^build_env:/, "") { build_env = $0; } + END { + if (version != "") { + print version; + print build_env, build_time + } + } + ' + local version= + ble/util/assign-array version '"$starship" --version | ble/bin/awk "$awk_script"' + [[ $version ]] || return 1 + local ret; ble/string#trim "${version[1]}"; local build=$ret + ble/edit/display-version/add-line "${sgrF}starship${sgr0}, version $sgrV$version$sgr0${build:+ ($build)}" +} +function ble/edit/display-version/check:bash-it { + [[ ${BASH_IT-} ]] && ble/is-function bash-it || return 1 + local version= ret + if ble/edit/display-version/git-rev-parse "$BASH_IT"; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$BASH_IT/bash_it.sh"; then + version="($ret)$label_noarch" + else + version="(bash-it version)" + fi + local modules= + if ble/is-function _bash-it-component-item-is-enabled; then + local category subdir suffix + for category in aliases:alias completion plugins:plugin; do + local subdir=${category%:*} suffix=${category#*:} list + list=() + local file name + for file in "$BASH_IT/$subdir/available"/*.*.bash; do + name=${file##*/} + name=${name%."$suffix"*.bash} + _bash-it-component-item-is-enabled "$suffix" "$name" && ble/array#push list "$name" + done + modules="$modules, $suffix(${list[*]})" + done + fi + ble/edit/display-version/add-line "${sgrF}bash-it$sgr0${theme:+ ($theme)}, $version$modules" +} +function ble/edit/display-version/check:oh-my-bash { + local source lineno ret version= + if [[ ${OMB_VERSINFO-set} ]] && ble/function#get-source-and-lineno _omb_module_require; then + version=${OMB_VERSINFO[0]}.${OMB_VERSINFO[1]}.${OMB_VERSINFO[2]} + if ble/edit/display-version/git-rev-parse "${source%/*}"; then + version="version $sgrV$version+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="version $sgrV$version$sgr0 ($ret)$label_noarch" + else + version="version $sgrV$version$sgr0$label_noarch" + fi + elif [[ ${OSH_CUSTOM-set} ]] && ble/function#get-source-and-lineno is_plugin; then + version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}" parent; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + fi + if [[ $version ]]; then + local theme=${OMB_THEME-${OSH_THEME-}} + local modules="aliases(${aliases[*]}), completions(${completions[*]}), plugins(${plugins[*]})" + ble/edit/display-version/add-line "${sgrF}oh-my-bash$sgr0${theme:+ ($theme)}, $version, $modules" + fi +} +function ble/edit/display-version/check:sbp { + local source lineno ret + ble/function#get-source-and-lineno _sbp_set_prompt || return 1 + local version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}"; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + local hooks="hooks(${settings_hooks[*]-${SBP_HOOKS[*]}})" + local left="left(${settings_segments_left[*]-${SBP_SEGMENTS_LEFT[*]}})" + local right="right(${settings_segments_right[*]-${RBP_SEGMENTS_RIGHT[*]}})" + local modules="$hooks, $left, $right" + ble/edit/display-version/add-line "${sgrF}sbp$sgr0, $version, $modules" +} +function ble/edit/display-version/check:gitstatus { + local source lineno ret + ble/function#get-source-and-lineno gitstatus_query || return 1 + local version="${source/#$HOME/~}$label_noarch" + if ble/edit/display-version/git-rev-parse "${source%/*}"; then + version="version $sgrV+$ret$sgr0$label_noarch" + elif ble/edit/display-version/git-hash-object "$source"; then + version="($ret)$label_noarch" + fi + ble/edit/display-version/add-line "${sgrF}romkatv/gitstatus$sgr0, $version" +} +function ble/edit/display-version/check:zoxide { + ble/is-function __zoxide_hook || return 1 + local path= + ble/bin#get-path zoxide || return 1 + local version= + ble/util/assign-array version '\command zoxide --version' + [[ $version ]] || return 1 + version=${version#zoxide } + version=${version#v} + local integ_label=$label_integration_off + ble/util/import/is-loaded contrib/integration/zoxide && integ_label=$label_integration + ble/edit/display-version/add-line "${sgrF}zoxide${sgr0}, version $sgrV$version$sgr0 ($path)$integ_label" +} +function ble/edit/display-version/check:atuin { + ble/is-function _atuin_precmd || ble/is-function __atuin_precmd || return 1 + local path= + ble/bin#get-path atuin || return 1 + local version= + ble/util/assign-array version '\command atuin --version' + [[ $version ]] || return 1 + version=${version#atuin } + version=${version#v} + ble/edit/display-version/add-line "${sgrF}atuin${sgr0}, version $sgrV$version$sgr0 ($path)" +} +function ble/widget/display-shell-version { + ble-edit/content/clear-arg + local set shopt + [[ $_ble_bash_options_adjusted ]] || ble/base/.adjust-bash-options set shopt + local sgrC= sgrF= sgrV= sgrA= sgr2= sgr0= bold= + local quote_word_opts=quote-empty + if [[ -t 1 ]]; then + bold=$_ble_term_bold + sgr0=$_ble_term_sgr0 + ble/color/face2sgr command_file; sgrC=$ret + ble/color/face2sgr command_function; sgrF=$ret + ble/color/face2sgr syntax_expr; sgrV=$ret + ble/color/face2sgr varname_readonly; sgrA=$ret + ble/color/face2sgr syntax_varname; sgr2=$ret + ble/color/face2sgr syntax_quoted; local sgr3=$ret + ble/color/face2sgr syntax_escape; local sgr4=$ret + quote_word_opts=$quote_word_opts:sgrq=$sgr3:sgre=$sgr4:sgr0=$sgr0 + fi + local label_noarch=" (${sgrA}noarch$sgr0)" + local label_integration=" $_ble_term_bold(integration: on)$sgr0" + local label_integration_off=" $_ble_term_bold(integration: off)$sgr0" + local label_warning="${bold}WARNING$sgr0" + local os_release= + if [[ -s /etc/os-release ]]; then + ble/util/assign os_release '( + builtin unset -v PRETTY_NAME NAME VERSION + source /etc/os-release + ble/util/print "${PRETTY_NAME:-${NAME:+$NAME${VERSION:+ $VERSION}}}")' 2>/dev/null + fi + if [[ ! $os_release && -s /etc/release ]]; then + local ret + ble/util/mapfile ret < /etc/release + ble/string#trim "$ret" + os_release=$ret + fi + local lines="${sgrC}GNU bash$sgr0, version $sgrV$BASH_VERSION$sgr0 ($sgrA$MACHTYPE$sgr0)${os_release:+ [$os_release]}" iline=1 + local ble_build_info="${_ble_base_build_git_version/#git version/git}, $_ble_base_build_make_version, $_ble_base_build_gawk_version" + lines[iline++]="${sgrF}ble.sh$sgr0, version $sgrV$BLE_VERSION$sgr0$label_noarch [$ble_build_info]" + ble/edit/display-version/check:bash-completion + ble/edit/display-version/check:fzf + ble/edit/display-version/check:bash-preexec + ble/edit/display-version/check:starship + ble/edit/display-version/check:bash-it + ble/edit/display-version/check:oh-my-bash + ble/edit/display-version/check:sbp + ble/edit/display-version/check:gitstatus + ble/edit/display-version/check:zoxide + ble/edit/display-version/check:atuin + local q=\' + local ret='(unset)' + local var line=${bold}locale$sgr0: + for var in _ble_bash_LANG "${!_ble_bash_LC_@}" LANG "${!LC_@}"; do + case $var in + (LC_ALL|LC_COLLATE) continue ;; + (LANG|LC_CTYPE|LC_MESSAGES|LC_NUMERIC|LC_TIME) + [[ ${_ble_bash_LC_ALL-} ]] && continue ;; + esac + [[ ${!var+set} ]] || continue + ble/string#quote-word "${!var}" "$quote_word_opts" + line="$line $sgr2${var#_ble_bash_}$sgrV=$sgr0$ret" + done + lines[iline++]=$line + ret='(unset)' + [[ ${TERM+set} ]] && ble/string#quote-word "$TERM" "$quote_word_opts" + local i line="${bold}terminal$sgr0: ${sgr2}TERM$sgrV=$sgr0$ret" + line="$line ${sgr2}wcwidth$sgrV=$sgr0$bleopt_char_width_version-$bleopt_char_width_mode${bleopt_emoji_width:+/$bleopt_emoji_version-$bleopt_emoji_width+$bleopt_emoji_opts}" + [[ ${MC_SID-} ]] && line="$line, ${sgrC}mc$sgr0 (${sgrV}MC_SID:$MC_SID$sgr0)" + for i in "${!_ble_term_DA2R[@]}"; do + line="$line, $sgrC${_ble_term_TERM[i]-unknown}$sgr0 ($sgrV${_ble_term_DA2R[i]}$sgr0)" + done + lines[iline++]=$line + if ble/bin#freeze-utility-path diff && [[ -x $BASH ]]; then + local _ble_local_tmpfile + ble/util/assign/mktmp; local tmpfile1=$_ble_local_tmpfile + ble/util/assign/mktmp; local tmpfile2=$_ble_local_tmpfile + "$BASH" --norc --noprofile -ic 'shopt -po; shopt' >| "$tmpfile1" + { shopt -po; shopt; } >| "$tmpfile2" + local diff awk_script='/^[-+].*[[:blank:]]on$/ {print $1} /^[-+]set -o .*$/ {print substr($0,1,1) $3}' IFS=$' \t\n' + ble/util/assign-words diff 'ble/bin/diff -bwu "$tmpfile1" "$tmpfile2" | ble/bin/awk "$awk_script"' + line="${bold}options$sgr0: ${diff[*]}" + _ble_local_tmpfile=$tmpfile2 ble/util/assign/rmtmp + _ble_local_tmpfile=$tmpfile1 ble/util/assign/rmtmp + else + line="${bold}options$sgr0: ${sgr2}SHELLOPTS$sgrV=$sgr0$SHELLOPTS" + ((_ble_bash>=40100)) && line="$line, ${sgr2}BASHOPTS$sgrV=$sgr0$BASHOPTS" + fi + lines[iline++]=$line + ble/widget/print "${lines[@]}" + [[ $_ble_bash_options_adjusted ]] || ble/base/.restore-bash-options set shopt +} +function ble/widget/readline-dump-functions { + ble-edit/content/clear-arg + local ret + ble/util/assign ret 'ble/builtin/bind -P' + ble/widget/print "$ret" +} +function ble/widget/readline-dump-macros { + ble-edit/content/clear-arg + local ret + ble/util/assign ret 'ble/builtin/bind -S' + ble/widget/print "$ret" +} +function ble/widget/readline-dump-variables { + ble-edit/content/clear-arg + local ret + ble/util/assign ret 'ble/builtin/bind -V' + ble/widget/print "$ret" +} +function ble/widget/re-read-init-file { + ble-edit/content/clear-arg + local inputrc=$INPUTRC + [[ $inputrc && -e $inputrc ]] || inputrc=~/.inputrc + [[ -e $inputrc ]] || return 0 + ble/decode/read-inputrc "$inputrc" + _ble_builtin_bind_keymap= +} +_ble_edit_rlfunc_history=() +_ble_edit_rlfunc_history_edit=() +_ble_edit_rlfunc_history_dirt=() +_ble_edit_rlfunc_history_index=0 +function ble/widget/execute-named-command/accept.hook { + local ret rlfunc error= + ble/string#split-words rlfunc "$1" + if ble/util/assign error 'ble/builtin/bind/rlfunc2widget "$_ble_decode_keymap" "$rlfunc" 2>&1'; then + ble/decode/widget/dispatch "$ret" "${rlfunc[@]:1}" + elif [[ $error ]]; then + ble/widget/bell "$error" + fi +} +function ble/widget/execute-named-command { + [[ $_ble_edit_async_read_prefix ]] && return 1 + ble/edit/async-read-mode 'ble/widget/execute-named-command/accept.hook' + _ble_edit_async_read_before_widget=ble/edit/async-read-mode/empty-cancel.hook + ble/history/set-prefix _ble_edit_rlfunc + _ble_edit_PS1='!' + _ble_syntax_lang=edit.named-command + _ble_highlight_layer_list=(plain syntax region overwrite_mode) + return 147 +} +ble/util/autoload "$_ble_base/contrib/syntax/edit.named-command.bash" \ + ble/syntax:edit.named-command/initialize-ctx +function ble/widget/overwrite-mode { + ble-edit/content/clear-arg + if [[ $_ble_edit_overwrite_mode ]]; then + _ble_edit_overwrite_mode= + else + _ble_edit_overwrite_mode=1 + fi +} +function ble/widget/set-mark { + ble-edit/content/clear-arg + _ble_edit_mark=$_ble_edit_ind + _ble_edit_mark_active=1 +} +function ble/widget/kill-forward-text { + ble-edit/content/clear-arg + ((_ble_edit_ind>=${#_ble_edit_str})) && return 0 + ble-edit/content/push-kill-ring "${_ble_edit_str:_ble_edit_ind}" '' forward + ble-edit/content/replace "$_ble_edit_ind" "${#_ble_edit_str}" '' + ((_ble_edit_mark>_ble_edit_ind&&(_ble_edit_mark=_ble_edit_ind))) +} +function ble/widget/kill-backward-text { + ble-edit/content/clear-arg + ((_ble_edit_ind==0)) && return 0 + ble-edit/content/push-kill-ring "${_ble_edit_str::_ble_edit_ind}" '' backward + ble-edit/content/replace 0 "$_ble_edit_ind" '' + ((_ble_edit_mark=_ble_edit_mark<=_ble_edit_ind?0:_ble_edit_mark-_ble_edit_ind)) + _ble_edit_ind=0 +} +function ble/widget/exchange-point-and-mark { + ble-edit/content/clear-arg + local m=$_ble_edit_mark p=$_ble_edit_ind + _ble_edit_ind=$m _ble_edit_mark=$p +} +function ble/widget/@marked { + local index=$_ble_edit_ind + ble/decode/widget/dispatch "$@" + if ((_ble_edit_ind!=index)); then + _ble_edit_mark=$index + _ble_edit_mark_active=S + ble/decode/keymap/push selection + fi +} +function ble/widget/selection/exit-default { + ble/decode/keymap/pop + ble/decode/widget/redispatch + local ext=$? + [[ $_ble_edit_mark_active == S && $_ble_decode_keymap != selection ]] && + _ble_edit_mark_active= + return "$ext" +} +function ble-decode/keymap:selection/bind-shift { + local marked=${1:+$1 } + ble-decode/keymap:safe/.bind 'S-C-f' "${marked}forward-char" + ble-decode/keymap:safe/.bind 'S-right' "${marked}forward-char" + ble-decode/keymap:safe/.bind 'S-C-b' "${marked}backward-char" + ble-decode/keymap:safe/.bind 'S-left' "${marked}backward-char" + ble-decode/keymap:safe/.bind 'S-C-right' "${marked}forward-cword" + ble-decode/keymap:safe/.bind 'M-F' "${marked}forward-cword" + ble-decode/keymap:safe/.bind 'M-S-f' "${marked}forward-cword" + ble-decode/keymap:safe/.bind 'S-C-left' "${marked}backward-cword" + ble-decode/keymap:safe/.bind 'M-B' "${marked}backward-cword" + ble-decode/keymap:safe/.bind 'M-S-b' "${marked}backward-cword" + ble-decode/keymap:safe/.bind 'M-S-right' "${marked}forward-sword" + ble-decode/keymap:safe/.bind 'M-S-left' "${marked}backward-sword" + ble-decode/keymap:safe/.bind 'S-C-a' "${marked}beginning-of-line" + ble-decode/keymap:safe/.bind 'S-home' "${marked}beginning-of-line" + ble-decode/keymap:safe/.bind 'S-C-e' "${marked}end-of-line" + ble-decode/keymap:safe/.bind 'S-end' "${marked}end-of-line" + ble-decode/keymap:safe/.bind 'S-C-p' "${marked}backward-line" + ble-decode/keymap:safe/.bind 'S-up' "${marked}backward-line" + ble-decode/keymap:safe/.bind 'S-C-n' "${marked}forward-line" + ble-decode/keymap:safe/.bind 'S-down' "${marked}forward-line" + ble-decode/keymap:safe/.bind 'S-C-home' "${marked}beginning-of-text" + ble-decode/keymap:safe/.bind 'S-C-end' "${marked}end-of-text" + ble-decode/keymap:safe/.bind 'M-S-m' "${marked}non-space-beginning-of-line" + ble-decode/keymap:safe/.bind 'M-M' "${marked}non-space-beginning-of-line" +} +function ble-decode/keymap:selection/define { + ble-bind -f __default__ 'selection/exit-default' + ble-bind -f __line_limit__ nop + ble-decode/keymap:selection/bind-shift +} +function ble/widget/.process-range-argument { + p0=$1 p1=$2 len=${#_ble_edit_str} + local pt + (( + p0>len?(p0=len):p0<0&&(p0=0), + p1>len?(p1=len):p0<0&&(p1=0), + p10 + )) +} +function ble/widget/.delete-range { + local p0 p1 len + ble/widget/.process-range-argument "${@:1:2}" || return 1 + if ((len)); then + ble-edit/content/replace "$p0" "$p1" '' + (( + _ble_edit_ind>p1? (_ble_edit_ind-=len): + _ble_edit_ind>p0&&(_ble_edit_ind=p0), + _ble_edit_mark>p1? (_ble_edit_mark-=len): + _ble_edit_mark>p0&&(_ble_edit_mark=p0) + )) + fi + return 0 +} +function ble/widget/.kill-range { + local p0 p1 len + ble/widget/.process-range-argument "${@:1:2}" || return 1 + ble-edit/content/push-kill-ring "${_ble_edit_str:p0:len}" "$4" "$p0:$p1" + if ((len)); then + ble-edit/content/replace "$p0" "$p1" '' + (( + _ble_edit_ind>p1? (_ble_edit_ind-=len): + _ble_edit_ind>p0&&(_ble_edit_ind=p0), + _ble_edit_mark>p1? (_ble_edit_mark-=len): + _ble_edit_mark>p0&&(_ble_edit_mark=p0) + )) + fi + return 0 +} +function ble/widget/.copy-range { + local p0 p1 len + ble/widget/.process-range-argument "${@:1:2}" || return 1 + ble-edit/content/push-kill-ring "${_ble_edit_str:p0:len}" "$4" "$p0:$p1" +} +function ble/widget/.replace-range { + local p0 p1 len + ble/widget/.process-range-argument "${@:1:2}" + local insert; ble-edit/content/replace-limited "$p0" "$p1" "$3" + local inslen=${#insert} delta + ((delta=inslen-len)) && + ((_ble_edit_ind>p1?(_ble_edit_ind+=delta): + _ble_edit_ind>=p0&&(_ble_edit_ind=p0+inslen), + _ble_edit_mark>p1?(_ble_edit_mark+=delta): + _ble_edit_mark>p0&&(_ble_edit_mark=p0))) + return 0 +} +function ble/widget/delete-region { + ble-edit/content/clear-arg + ble/widget/.delete-range "$_ble_edit_mark" "$_ble_edit_ind" + _ble_edit_mark_active= +} +function ble/widget/kill-region { + ble-edit/content/clear-arg + ble/widget/.kill-range "$_ble_edit_mark" "$_ble_edit_ind" + _ble_edit_mark_active= +} +function ble/widget/copy-region { + ble-edit/content/clear-arg + ble/widget/.copy-range "$_ble_edit_mark" "$_ble_edit_ind" + _ble_edit_mark_active= +} +function ble/widget/delete-region-or { + if [[ $_ble_edit_mark_active ]]; then + ble/widget/delete-region + else + ble/decode/widget/dispatch "$@" + fi +} +function ble/widget/kill-region-or { + if [[ $_ble_edit_mark_active ]]; then + ble/widget/kill-region + else + ble/decode/widget/dispatch "$@" + fi +} +function ble/widget/copy-region-or { + if [[ $_ble_edit_mark_active ]]; then + ble/widget/copy-region + else + ble/decode/widget/dispatch "$@" + fi +} +function ble/widget/yank { + local arg; ble-edit/content/get-arg 1 + local nkill=${#_ble_edit_kill_ring[@]} + if ((nkill==0)); then + ble/widget/.bell 'no strings in kill-ring' + _ble_edit_yank_index= + return 1 + fi + local index=$_ble_edit_kill_index + local delta=$((arg-1)) + if ((delta)); then + ((index=(index+delta)%nkill, + index=(index+nkill)%nkill)) + _ble_edit_kill_index=$index + fi + local insert=${_ble_edit_kill_ring[index]} + _ble_edit_yank_index=$index + if [[ $insert ]]; then + ble-edit/content/replace-limited "$_ble_edit_ind" "$_ble_edit_ind" "$insert" + ((_ble_edit_mark=_ble_edit_ind, + _ble_edit_ind+=${#insert})) + _ble_edit_mark_active= + fi +} +_ble_edit_yank_index= +function ble/edit/yankpop.impl { + local arg=$1 + local nkill=${#_ble_edit_kill_ring[@]} + ((_ble_edit_yank_index=(_ble_edit_yank_index+arg)%nkill, + _ble_edit_yank_index=(_ble_edit_yank_index+nkill)%nkill)) + local insert=${_ble_edit_kill_ring[_ble_edit_yank_index]} + ble-edit/content/replace-limited "$_ble_edit_mark" "$_ble_edit_ind" "$insert" + ((_ble_edit_ind=_ble_edit_mark+${#insert})) +} +function ble/widget/yank-pop { + local opts=$1 + local arg; ble-edit/content/get-arg 1 + if ! [[ $_ble_edit_yank_index && ${LASTWIDGET%%' '*} == ble/widget/yank ]]; then + ble/widget/.bell + return 1 + fi + [[ :$opts: == *:backward:* ]] && ((arg=-arg)) + ble/edit/yankpop.impl "$arg" + _ble_edit_mark_active=insert + ble/decode/keymap/push yankpop +} +function ble/widget/yankpop/next { + local arg; ble-edit/content/get-arg 1 + ble/edit/yankpop.impl "$arg" +} +function ble/widget/yankpop/prev { + local arg; ble-edit/content/get-arg 1 + ble/edit/yankpop.impl "$((-arg))" +} +function ble/widget/yankpop/exit { + ble/decode/keymap/pop + _ble_edit_mark_active= +} +function ble/widget/yankpop/cancel { + ble-edit/content/replace "$_ble_edit_mark" "$_ble_edit_ind" '' + _ble_edit_ind=$_ble_edit_mark + ble/widget/yankpop/exit +} +function ble/widget/yankpop/exit-default { + ble/widget/yankpop/exit + ble/decode/widget/redispatch +} +function ble-decode/keymap:yankpop/define { + ble-decode/keymap:safe/bind-arg yankpop/exit-default + ble-bind -f __default__ 'yankpop/exit-default' + ble-bind -f __line_limit__ nop + ble-bind -f 'C-g' 'yankpop/cancel' + ble-bind -f 'C-x C-g' 'yankpop/cancel' + ble-bind -f 'C-M-g' 'yankpop/cancel' + ble-bind -f 'M-y' 'yankpop/next' + ble-bind -f 'M-S-y' 'yankpop/prev' + ble-bind -f 'M-Y' 'yankpop/prev' +} +_ble_term_DECSCNM_state= +function ble/widget/.bell { + [[ :$bleopt_edit_bell: == *:vbell:* ]] && ble/term/visible-bell "$1" + [[ :$bleopt_edit_bell: == *:abell:* ]] && ble/term/audible-bell + if [[ :$bleopt_edit_bell: == *:visual:* ]]; then + ble/util/buffer $'\e[?5h' + ble/util/buffer.flush + _ble_term_DECSCNM_state=1 + if ble/is-function ble/util/idle.push; then + ble/util/idle.push --sleep=50 ble/widget/.bell/.clear-DECSCNM + else + ble/util/msleep 50 + ble/widget/.bell/.clear-DECSCNM + fi + fi + return 0 +} +function ble/widget/.bell/.clear-DECSCNM { + [[ $_ble_term_DECSCNM_state ]] || return "$?" + _ble_term_DECSCNM_state= + ble/util/buffer $'\e[?5l' + ble/util/buffer.flush +} +function ble/widget/bell { + ble-edit/content/clear-arg + _ble_edit_mark_active= + _ble_edit_arg= + blehook/invoke widget_bell + ble/widget/.bell "$1" +} +function ble/widget/nop { return 0; } +function ble/widget/insert-string { + local IFS=$_ble_term_IFS + local content="$*" + local arg; ble-edit/content/get-arg 1 + if ((arg<0)); then + ble/widget/.bell "negative repetition number $arg" + return 1 + elif ((arg==0)); then + return 0 + elif ((arg>1)); then + local ret; ble/string#repeat "$content" "$arg"; content=$ret + fi + ble/widget/.insert-string "$content" +} +function ble/widget/.insert-string { + local insert=$1 + [[ $insert ]] || return 1 + ble-edit/content/replace-limited "$_ble_edit_ind" "$_ble_edit_ind" "$insert" + local dx=${#insert} + (( + _ble_edit_mark>_ble_edit_ind&&(_ble_edit_mark+=dx), + _ble_edit_ind+=dx + )) + _ble_edit_mark_active= +} +function ble/edit/get-clipboard { + builtin unset -f "$FUNCNAME" + if [[ -c /dev/clipboard ]]; then + function ble/edit/get-clipboard { ble/util/readfile clipboard /dev/clipboard; } + elif ble/base/is-wsl && ble/bin#freeze-utility-path powershell.exe; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/powershell.exe -command Get-Clipboard 2>/dev/null'; } + elif ble/bin#freeze-utility-path pbpaste; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/pbpaste 2>/dev/null'; } + elif ble/bin#freeze-utility-path xclip; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/xclip -selection clipboard -o 2>/dev/null'; } + elif ble/bin#freeze-utility-path xsel; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/xsel --clipboard --output 2>/dev/null'; } + elif ble/bin#freeze-utility-path wxpaste; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/wxpaste 2>/dev/null'; } + elif ble/bin#freeze-utility-path xcb; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/xcb -p 0 2>/dev/null'; } + elif [[ ${TMUX-} && ${TMUX_PANE-} ]] && ble/bin#freeze-utility-path tmux; then + function ble/edit/get-clipboard { ble/util/assign clipboard 'ble/bin/tmux save-buffer - 2>/dev/null'; } + elif [[ ${STY-} && ${WINDOW-} ]] && ble/bin#freeze-utility-path screen; then + function ble/edit/get-clipboard { ble/util/readfile clipboard /tmp/screen-exchange; } + else + function ble/edit/get-clipboard { return 1; } + fi + ble/edit/get-clipboard "$@" +} +function ble/widget/paste-from-clipboard { + local clipboard + if ble/edit/get-clipboard; then + ble/widget/insert-string "$clipboard" + return 0 + else + ble/widget/.bell + return 1 + fi +} +_ble_edit_lastarg_index= +_ble_edit_lastarg_delta= +_ble_edit_lastarg_nth= +function ble/widget/insert-arg.impl { + local beg=$1 end=$2 index=$3 delta=$4 nth=$5 + ((delta)) || delta=1 + ble/history/initialize + local hit= lastarg= + local decl=$( + local original=${_ble_edit_str:beg:end-beg} + local count=; ((delta>0)) && count=_ble_history_COUNT + while ((1)); do + if ((delta>0)); then + ((index+1>=count)) && break + ((index+=delta,delta=1)) + ((index>=count&&(index=count-1))) + else + ((index-1<0)) && break + ((index+=delta,delta=-1)) + ((index<0&&(index=0))) + fi + local entry; ble/history/get-edited-entry "$index" + builtin history -s -- "$entry" + local ret + if ble/edit/histexpand '!!:'"$nth" && [[ $ret != "$original" ]]; then + hit=1 lastarg=$ret + ble/util/declare-print-definitions hit lastarg + break + fi + done + _ble_edit_lastarg_index=$index + _ble_edit_lastarg_delta=$delta + _ble_edit_lastarg_nth=$nth + ble/util/declare-print-definitions \ + _ble_edit_lastarg_index \ + _ble_edit_lastarg_delta \ + _ble_edit_lastarg_nth + ) + builtin eval -- "$decl" + if [[ $hit ]]; then + local insert; ble-edit/content/replace-limited "$beg" "$end" "$lastarg" + ((_ble_edit_mark=beg,_ble_edit_ind=beg+${#insert})) + return 0 + else + ble/widget/.bell + return 1 + fi +} +function ble/widget/insert-nth-argument { + ble/history/initialize + local arg; ble-edit/content/get-arg '^' + local beg=$_ble_edit_ind end=$_ble_edit_ind + local index=$_ble_history_INDEX + local delta=-1 nth=$arg + ble/widget/insert-arg.impl "$beg" "$end" "$index" "$delta" "$nth" +} +function ble/widget/insert-last-argument { + ble/history/initialize + local arg; ble-edit/content/get-arg '$' + local beg=$_ble_edit_ind end=$_ble_edit_ind + local index=$_ble_history_INDEX + local delta=-1 nth=$arg + ble/widget/insert-arg.impl "$beg" "$end" "$index" "$delta" "$nth" || return "$?" + _ble_edit_mark_active=insert + ble/decode/keymap/push lastarg +} +function ble/widget/lastarg/next { + local arg; ble-edit/content/get-arg 1 + local beg=$_ble_edit_mark + local end=$_ble_edit_ind + local index=$_ble_edit_lastarg_index + local delta + if [[ $arg ]]; then + delta=$((-arg)) + else + ((delta=_ble_edit_lastarg_delta>=0?1:-1)) + fi + local nth=$_ble_edit_lastarg_nth + ble/widget/insert-arg.impl "$beg" "$end" "$index" "$delta" "$nth" +} +function ble/widget/lastarg/exit { + ble/decode/keymap/pop + _ble_edit_mark_active= +} +function ble/widget/lastarg/cancel { + ble-edit/content/replace "$_ble_edit_mark" "$_ble_edit_ind" '' + _ble_edit_ind=$_ble_edit_mark + ble/widget/lastarg/exit +} +function ble/widget/lastarg/exit-default { + ble/widget/lastarg/exit + ble/decode/widget/redispatch +} +function ble/highlight/layer:region/mark:insert/get-face { + face=region_insert +} +function ble-decode/keymap:lastarg/define { + ble-decode/keymap:safe/bind-arg lastarg/exit-default + ble-bind -f __default__ 'lastarg/exit-default' + ble-bind -f __line_limit__ nop + ble-bind -f 'C-g' 'lastarg/cancel' + ble-bind -f 'C-x C-g' 'lastarg/cancel' + ble-bind -f 'C-M-g' 'lastarg/cancel' + ble-bind -f 'M-.' 'lastarg/next' + ble-bind -f 'M-_' 'lastarg/next' +} +function ble/widget/self-insert/.get-code { + if ((${#KEYS[@]})); then + code=${KEYS[${#KEYS[@]}-1]} + local flag=$((code&_ble_decode_MaskFlag)) + local char=$((code&_ble_decode_MaskChar)) + if ((flag==0&&char<_ble_decode_FunctionKeyBase)); then + code=$char + return 0 + elif ((flag==_ble_decode_Ctrl&&(char==63||91<=char&&char<=122)&&(char&0x1F)!=0)); then + ((char=char==63?127:char&0x1F)) + code=$char + return 0 + fi + fi + if ((${#CHARS[@]})); then + code=${CHARS[${#CHARS[@]}-1]} + return 0 + fi + code=0 + return 1 +} +function ble/widget/self-insert { + local code; ble/widget/self-insert/.get-code + ((code==0)) && return 0 + ((code==127&&_ble_bash<30100)) && return 0 + local ibeg=$_ble_edit_ind iend=$_ble_edit_ind + local ret ins; ble/util/c2s "$code"; ins=$ret + local arg; ble-edit/content/get-arg 1 + if ((arg<0)); then + ble/widget/.bell "negative repetition number $arg" + return 1 + elif ((arg==0)) || [[ ! $ins ]]; then + arg=0 ins= + elif ((arg>1)); then + ble/string#repeat "$ins" "$arg"; ins=$ret + fi + if [[ $bleopt_delete_selection_mode && $_ble_edit_mark_active ]]; then + ((_ble_edit_mark<_ble_edit_ind?(ibeg=_ble_edit_mark):(iend=_ble_edit_mark), + _ble_edit_ind=ibeg)) + ((arg==0&&ibeg==iend)) && return 0 + elif [[ $_ble_edit_overwrite_mode ]] && ((code!=10&&code!=9)); then + ((arg==0)) && return 0 + local removed_width + if [[ $_ble_edit_overwrite_mode == R ]]; then + local removed_text=${_ble_edit_str:ibeg:arg} + removed_text=${removed_text%%[$'\n\t']*} + removed_width=${#removed_text} + ((iend+=removed_width)) + else + local ret w; ble/util/c2w-edit "$code"; w=$((arg*ret)) + local iN=${#_ble_edit_str} + for ((removed_width=0;removed_widthw)) && ins=$ins${_ble_string_prototype::removed_width-w} + fi + if [[ :$ble_widget_self_insert_opts: == *:nolineext:* ]]; then + if ((removed_widthibeg&&( + _ble_edit_mark=2000)) || return 1 + local ble_batch_insert_index=$index + local ble_batch_insert_count=$N + builtin eval -- "$_ble_decode_show_progress_hook" +} +function ble/widget/batch-insert { + local -a chars; chars=("${KEYS[@]}") + local -a KEYS=() + local index=0 N=${#chars[@]} + if [[ $_ble_edit_overwrite_mode ]]; then + while ((index=limit)); then + chars=("${chars[@]::limit-${#_ble_edit_str}}") + N=${#chars[@]} + ((index=5)); then + IFS=: builtin eval '_ble_edit_bracketed_paste=("${_ble_edit_bracketed_paste[*]}")' + chars=:$_ble_edit_bracketed_paste + if [[ $chars == *:50:48:49:126 ]]; then + if [[ $chars == *:27:91:50:48:49:126 ]]; then # ESC [ 2 0 1 ~ + chars=${chars%:27:91:50:48:49:126} is_end=1 + elif [[ $chars == *:155:50:48:49:126 ]]; then # CSI 2 0 1 ~ + chars=${chars%:155:50:48:49:126} is_end=1 + fi + fi + fi + [[ $is_end ]] || return 1 + _ble_decode_char__hook= + chars=:${chars//:/::}: + chars=${chars//:13::10:/:10:} # CR LF -> LF + chars=${chars//:13:/:10:} # CR -> LF + ble/string#split-words chars "${chars//:/ }" + local proc=$_ble_edit_bracketed_paste_proc + _ble_edit_bracketed_paste_proc= + [[ $proc ]] && builtin eval -- "$proc \"\${chars[@]}\"" + return 0 +} +function ble/widget/bracketed-paste.hook { + ((_ble_edit_bracketed_paste_count%1000==0)) && + IFS=: builtin eval '_ble_edit_bracketed_paste=("${_ble_edit_bracketed_paste[*]}")' # contract + _ble_edit_bracketed_paste[_ble_edit_bracketed_paste_count++]=$1 + (($1==126)) && ble/widget/bracketed-paste.hook/check-end && return 0 + if ((!_ble_debug_keylog_enabled)) && [[ ! $_ble_decode_keylog_chars_enabled ]]; then + local char + while ble/decode/char-hook/next-char; do + _ble_edit_bracketed_paste[_ble_edit_bracketed_paste_count++]=$char + ((char==126)) && ble/widget/bracketed-paste.hook/check-end && return 0 + done + fi + _ble_decode_char__hook=ble/widget/bracketed-paste.hook + return 147 +} +function ble/widget/bracketed-paste.proc { + local -a KEYS; KEYS=("$@") + ble/widget/batch-insert +} +function ble/widget/transpose-chars { + local arg; ble-edit/content/get-arg '' + if ((arg==0)); then + [[ ! $arg ]] && ble-edit/content/eolp && + ((_ble_edit_ind>0&&_ble_edit_ind--)) + arg=1 + fi + local p q r + if ((arg>0)); then + ((p=_ble_edit_ind-1, + q=_ble_edit_ind, + r=_ble_edit_ind+arg)) + else # arg<0 + ((p=_ble_edit_ind-1+arg, + q=_ble_edit_ind, + r=_ble_edit_ind+1)) + fi + if ((p<0||${#_ble_edit_str}=_ble_edit_ind&&(_ble_edit_mark+=w))) + fi + fi + fi + ble-edit/content/replace "$((_ble_edit_ind-a))" "$_ble_edit_ind" "$ins" + ((_ble_edit_ind-=a, + _ble_edit_ind+a<_ble_edit_mark?(_ble_edit_mark-=a): + _ble_edit_ind<_ble_edit_mark&&(_ble_edit_mark=_ble_edit_ind))) + return 0 +} +function ble/widget/.delete-char { + local a=${1:-1} + if ((a>0)); then + if ((${#_ble_edit_str}<_ble_edit_ind+a)); then + return 1 + else + ble-edit/content/replace "$_ble_edit_ind" "$((_ble_edit_ind+a))" '' + fi + elif ((a<0)); then + ble/widget/.delete-backward-char "$((-a))"; return "$?" + else + if ((${#_ble_edit_str}==0)); then + return 1 + elif ((_ble_edit_ind<${#_ble_edit_str})); then + ble-edit/content/replace "$_ble_edit_ind" "$((_ble_edit_ind+1))" '' + else + _ble_edit_ind=${#_ble_edit_str} + ble/widget/.delete-backward-char 1; return "$?" + fi + fi + ((_ble_edit_mark>_ble_edit_ind&&_ble_edit_mark--)) + return 0 +} +function ble/widget/delete-forward-char { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + ble/widget/.delete-char "$arg" || ble/widget/.bell +} +function ble/widget/delete-backward-char { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + [[ $_ble_decode_keymap == vi_imap ]] && ble/keymap:vi/undo/add more + ble/widget/.delete-char "$((-arg))" || ble/widget/.bell + [[ $_ble_decode_keymap == vi_imap ]] && ble/keymap:vi/undo/add more +} +_ble_edit_exit_count=0 +function ble/widget/exit { + ble-edit/content/clear-arg + if [[ $WIDGET == "$LASTWIDGET" ]]; then + ((_ble_edit_exit_count++)) + else + _ble_edit_exit_count=1 + fi + local ret; ble-edit/eval-IGNOREEOF + if ((_ble_edit_exit_count<=ret)); then + local remain=$((ret-_ble_edit_exit_count+1)) + ble/widget/.bell 'IGNOREEOF' + ble/widget/print "IGNOREEOF($remain): Use \"exit\" to leave the shell." + return 0 + fi + local opts=$1 + ((_ble_bash>=40000)) && shopt -q checkjobs &>/dev/null && opts=$opts:checkjobs + if [[ $bleopt_allow_exit_with_jobs ]]; then + local ret + if ble/util/assign ret 'compgen -A stopped -- ""' 2>/dev/null; [[ $ret ]]; then + opts=$opts:twice + elif [[ :$opts: == *:checkjobs:* ]]; then + if ble/util/assign ret 'compgen -A running -- ""' 2>/dev/null; [[ $ret ]]; then + opts=$opts:twice + fi + else + opts=$opts:force + fi + fi + if ! [[ :$opts: == *:force:* || :$opts: == *:twice:* && _ble_edit_exit_count -ge 2 ]]; then + local joblist + ble/util/joblist + if ((${#joblist[@]})); then + ble/widget/.bell "exit: There are remaining jobs." + local q=\' Q="'\''" message= + if [[ :$opts: == *:twice:* ]]; then + message='There are remaining jobs. Input the same key to exit the shell anyway.' + else + message='There are remaining jobs. Use "exit" to leave the shell.' + fi + local ret + ble/edit/marker#instantiate "$message" non-empty + ble/widget/internal-command "ble/util/print '${ret//$q/$Q}'; jobs" + return "$?" + fi + elif [[ :$opts: == *:checkjobs:* ]]; then + local joblist + ble/util/joblist + ((${#joblist[@]})) && printf '%s\n' "${#joblist[@]}" + fi + _ble_edit_line_disabled=1 ble/textarea#render + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + local -a DRAW_BUFF=() + ble/canvas/panel#goto.draw "$_ble_textarea_panel" "$_ble_textarea_gendx" "$_ble_textarea_gendy" + ble/canvas/bflush.draw + ble/edit/marker#instantiate-config exec_exit_mark + ble/util/buffer.print "$ret" + ble/util/buffer.flush + _ble_builtin_exit_processing=1 ble/builtin/exit 0 + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout + return 1 +} +function ble/widget/delete-forward-char-or-exit { + if [[ $_ble_edit_str ]]; then + ble/widget/delete-forward-char + else + ble/widget/exit + fi +} +function ble/widget/delete-forward-backward-char { + ble-edit/content/clear-arg + ble/widget/.delete-char 0 || ble/widget/.bell +} +function ble/widget/delete-forward-char-or-list { + local right=${_ble_edit_str:_ble_edit_ind} + if [[ ! $right || $right == $'\n'* ]]; then + ble/widget/complete show_menu + else + ble/widget/delete-forward-char + fi +} +function ble/widget/delete-horizontal-space { + local arg; ble-edit/content/get-arg '' + local b=0 rex=$'[ \t]+$' + [[ ${_ble_edit_str::_ble_edit_ind} =~ $rex ]] && + b=${#BASH_REMATCH} + local a=0 rex=$'^[ \t]+' + [[ ! $arg && ${_ble_edit_str:_ble_edit_ind} =~ $rex ]] && + a=${#BASH_REMATCH} + ble/widget/.delete-range "$((_ble_edit_ind-b))" "$((_ble_edit_ind+a))" +} +function ble/widget/.forward-char { + ((_ble_edit_ind+=${1:-1})) + if ((_ble_edit_ind>${#_ble_edit_str})); then + _ble_edit_ind=${#_ble_edit_str} + return 1 + elif ((_ble_edit_ind<0)); then + _ble_edit_ind=0 + return 1 + fi +} +function ble/widget/forward-char { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + ble/widget/.forward-char "$arg" || ble/widget/.bell +} +function ble/widget/backward-char { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + ble/widget/.forward-char "$((-arg))" || ble/widget/.bell +} +_ble_edit_character_search_arg= +function ble/widget/character-search-forward { + local arg; ble-edit/content/get-arg 1 + _ble_edit_character_search_arg=$arg + _ble_edit_mark_active= + _ble_decode_char__hook=ble/widget/character-search.hook +} +function ble/widget/character-search-backward { + local arg; ble-edit/content/get-arg 1 + ((_ble_edit_character_search_arg=-arg)) + _ble_edit_mark_active= + _ble_decode_char__hook=ble/widget/character-search.hook +} +function ble/widget/character-search.hook { + local char=${KEYS[0]} + local ret; ble/util/c2s "${KEYS[0]}"; local c=$ret + [[ $c ]] || return 1 # Note: C-@ の時は無視 + local arg=$_ble_edit_character_search_arg + if ((arg>0)); then + local right=${_ble_edit_str:_ble_edit_ind+1} + if ble/string#index-of "$right" "$c" "$arg"; then + ((_ble_edit_ind=_ble_edit_ind+1+ret)) + elif ble/string#last-index-of "$right" "$c"; then + ble/widget/.bell "${arg}th character not found" + ((_ble_edit_ind=_ble_edit_ind+1+ret)) + else + ble/widget/.bell 'character not found' + return 1 + fi + elif ((arg<0)); then + local left=${_ble_edit_str::_ble_edit_ind} + if ble/string#last-index-of "$left" "$c" "$((-arg))"; then + _ble_edit_ind=$ret + elif ble/string#index-of "$left" "$c"; then + ble/widget/.bell "$((-arg))th last character not found" + _ble_edit_ind=$ret + else + ble/widget/.bell 'character not found' + return 1 + fi + fi + return 0 +} +function ble/widget/.locate-forward-byte { + local delta=$1 ret + if ((delta==0)); then + return 0 + elif ((delta>0)); then + local right=${_ble_edit_str:index:delta} + local rlen=${#right} + ble/util/strlen "$right"; local rsz=$ret + if ((delta>=rsz)); then + ((index+=rlen)) + ((delta==rsz)); return "$?" + else + while ((delta&&rlen>=2)); do + local mlen=$((rlen/2)) + local m=${right::mlen} + ble/util/strlen "$m"; local msz=$ret + if ((delta>=msz)); then + right=${right:mlen} + ((index+=mlen, + rlen-=mlen, + delta-=msz)) + ((rlen>delta)) && + right=${right::delta} rlen=$delta + else + right=$m rlen=$mlen + fi + done + ((delta&&rlen&&index++)) + return 0 + fi + elif ((delta<0)); then + ((delta=-delta)) + local left=${_ble_edit_str::index} + local llen=${#left} + ((llen>delta)) && left=${left:llen-delta} llen=$delta + ble/util/strlen "$left"; local lsz=$ret + if ((delta>=lsz)); then + ((index-=llen)) + ((delta==lsz)); return "$?" + else + while ((delta&&llen>=2)); do + local mlen=$((llen/2)) + local m=${left:llen-mlen} + ble/util/strlen "$m"; local msz=$ret + if ((delta>=msz)); then + left=${left::llen-mlen} + ((index-=mlen, + llen-=mlen, + delta-=msz)) + ((llen>delta)) && + left=${left:llen-delta} llen=$delta + else + left=$m llen=$mlen + fi + done + ((delta&&llen&&index--)) + return 0 + fi + fi +} +function ble/widget/forward-byte { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + local index=$_ble_edit_ind + ble/widget/.locate-forward-byte "$arg" || ble/widget/.bell + _ble_edit_ind=$index +} +function ble/widget/backward-byte { + local arg; ble-edit/content/get-arg 1 + ((arg==0)) && return 0 + local index=$_ble_edit_ind + ble/widget/.locate-forward-byte "$((-arg))" || ble/widget/.bell + _ble_edit_ind=$index +} +function ble/widget/end-of-text { + local arg; ble-edit/content/get-arg '' + if [[ $arg ]]; then + if ((arg>=10)); then + _ble_edit_ind=0 + else + ((arg<0&&(arg=0))) + local index=$(((19-2*arg)*${#_ble_edit_str}/20)) + local ret; ble-edit/content/find-logical-bol "$index" + _ble_edit_ind=$ret + fi + else + _ble_edit_ind=${#_ble_edit_str} + fi +} +function ble/widget/beginning-of-text { + local arg; ble-edit/content/get-arg '' + if [[ $arg ]]; then + if ((arg>=10)); then + _ble_edit_ind=${#_ble_edit_str} + else + ((arg<0&&(arg=0))) + local index=$(((2*arg+1)*${#_ble_edit_str}/20)) + local ret; ble-edit/content/find-logical-bol "$index" + _ble_edit_ind=$ret + fi + else + _ble_edit_ind=0 + fi +} +function ble/widget/beginning-of-logical-line { + local arg; ble-edit/content/get-arg 1 + local ret; ble-edit/content/find-logical-bol "$_ble_edit_ind" "$((arg-1))" + _ble_edit_ind=$ret +} +function ble/widget/end-of-logical-line { + local arg; ble-edit/content/get-arg 1 + local ret; ble-edit/content/find-logical-eol "$_ble_edit_ind" "$((arg-1))" + _ble_edit_ind=$ret +} +function ble/widget/kill-backward-logical-line { + local arg; ble-edit/content/get-arg '' + if [[ $arg ]]; then + local ret; ble-edit/content/find-logical-eol "$_ble_edit_ind" "$((-arg))"; local index=$ret + if ((arg>0)); then + if ((_ble_edit_ind<=index)); then + index=0 + else + ble/string#count-char "${_ble_edit_str:index:_ble_edit_ind-index}" $'\n' + ((ret0)); then + if ((index<=_ble_edit_ind)); then + index=${#_ble_edit_str} + else + ble/string#count-char "${_ble_edit_str:_ble_edit_ind:index-_ble_edit_ind}" $'\n' + ((ret0?(eofs=arg-1):(arg<0&&(bofs=arg+1)))) + ble-edit/content/find-logical-bol "$_ble_edit_ind" "$bofs" && local bol=$ret + ble-edit/content/find-logical-eol "$_ble_edit_ind" "$eofs" && local eol=$ret + [[ ${_ble_edit_str:eol:1} == $'\n' ]] && ((eol++)) + ((bol0)); then + if [[ ! $_ble_history_prefix && ! $_ble_history_load_done ]]; then + _ble_edit_ind=${#_ble_edit_str} + ble/widget/.bell 'end of history' + return 1 + fi + fi + local point_opts point point_x + if ((arg>0)); then + opts=$opts:linewise:forward + else + opts=$opts:linewise:backward + fi + ble-edit/history/goto/.prepare-point "$opts" + local rest=$((arg>0?arg:-arg)) + ble/history/initialize + local index=$_ble_history_INDEX + local expr_next='--index>=0' + if ((arg>0)); then + local count=$_ble_history_COUNT + expr_next="++index<=$count" + fi + while ((expr_next)); do + if ((--rest<=0)); then + ble-edit/history/goto "$index" point=none + ble-edit/history/goto/.set-point 0 + return 0 + fi + local entry; ble/history/get-edited-entry "$index" + if [[ $entry == *$'\n'* ]]; then + local ret; ble/string#count-char "$entry" $'\n' + if ((rest<=ret)); then + ble-edit/history/goto "$index" point=none + ble-edit/history/goto/.set-point "$rest" + return 0 + fi + ((rest-=ret)) + fi + done + if ((arg>0)); then + ble-edit/history/goto "$count" point=none + _ble_edit_ind=${#_ble_edit_str} + ble/widget/.bell 'end of history' + else + ble-edit/history/goto 0 point=none + _ble_edit_ind=0 + ble/widget/.bell 'beginning of history' + fi + return 0 +} +function ble/widget/forward-logical-line.impl { + local arg=$1 opts=$2 + ((arg==0)) && return 0 + local ind=$_ble_edit_ind + if ((arg>0)); then + ((ind<${#_ble_edit_str})) || return 1 + else + ((ind>0)) || return 1 + fi + local ret; ble-edit/content/find-logical-bol "$ind" "$arg"; local bol2=$ret + if ((arg>0)); then + if ((indbol2)); then + ble/string#count-char "${_ble_edit_str:bol2:ind-bol2}" $'\n' + ((arg+=ret)) + fi + fi + if ((arg==0)); then + ble-edit/content/find-logical-bol "$ind" ; local bol1=$ret + ble-edit/content/find-logical-eol "$bol2"; local eol2=$ret + local dst=$((bol2+ind-bol1)) + ((_ble_edit_ind=dst0)); then + ble-edit/content/find-logical-eol "$bol2" + else + ret=$bol2 + fi + _ble_edit_ind=$ret + if ((arg>0)); then + ble/widget/.bell 'end of string' + else + ble/widget/.bell 'beginning of string' + fi + return 0 +} +function ble/widget/forward-logical-line { + local opts=$1 + local arg; ble-edit/content/get-arg 1 + ble/widget/forward-logical-line.impl "$arg" "$opts" +} +function ble/widget/backward-logical-line { + local opts=$1 + local arg; ble-edit/content/get-arg 1 + ble/widget/forward-logical-line.impl "$((-arg))" "$opts" +} +function ble-edit/content/find-graphical-eol { + local axis=${1:-$_ble_edit_ind} arg=${2:-0} + local x y index + ble/textmap#getxy.cur "$axis" + ble/textmap#get-index-at 0 "$((y+arg+1))" + if ((index>0)); then + local ax ay + ble/textmap#getxy.cur --prefix=a "$index" + ((ay>y+arg&&index--)) + fi + ret=$index +} +function ble/widget/beginning-of-graphical-line { + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local arg; ble-edit/content/get-arg 1 + local x y index + ble/textmap#getxy.cur "$_ble_edit_ind" + ble/textmap#get-index-at 0 "$((y+arg-1))" + _ble_edit_ind=$index +} +function ble/widget/end-of-graphical-line { + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local arg; ble-edit/content/get-arg 1 + local ret; ble-edit/content/find-graphical-eol "$_ble_edit_ind" "$((arg-1))" + _ble_edit_ind=$ret +} +function ble/widget/kill-backward-graphical-line { + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local arg; ble-edit/content/get-arg '' + if [[ ! $arg ]]; then + local x y index + ble/textmap#getxy.cur "$_ble_edit_ind" + ble/textmap#get-index-at 0 "$y" + ((index==_ble_edit_ind&&index>0&&index--)) + ble/widget/.kill-range "$index" "$_ble_edit_ind" + else + local ret; ble-edit/content/find-graphical-eol "$_ble_edit_ind" "$((-arg))" + ble/widget/.kill-range "$ret" "$_ble_edit_ind" + fi +} +function ble/widget/kill-forward-graphical-line { + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local arg; ble-edit/content/get-arg '' + local x y index ax ay + ble/textmap#getxy.cur "$_ble_edit_ind" + ble/textmap#get-index-at 0 "$((y+${arg:-1}))" + if [[ ! $arg ]] && ((_ble_edit_indy&&index--)) + fi + ble/widget/.kill-range "$_ble_edit_ind" "$index" +} +function ble/widget/kill-graphical-line { + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local arg; ble-edit/content/get-arg 0 + local bofs=0 eofs=0 + ((arg>0?(eofs=arg-1):(arg<0&&(bofs=arg+1)))) + local x y index ax ay + ble/textmap#getxy.cur "$_ble_edit_ind" + ble/textmap#get-index-at 0 "$((y+bofs))" ; local bol=$index + ble/textmap#get-index-at 0 "$((y+eofs+1))"; local eol=$index + ((bol0)); then + _ble_edit_ind=${#_ble_edit_str} + ble/widget/.bell 'end of string' + else + _ble_edit_ind=0 + ble/widget/.bell 'beginning of string' + fi + return 0 +} +function ble/widget/forward-graphical-line { + local opts=$1 + local arg; ble-edit/content/get-arg 1 + ble/widget/forward-graphical-line.impl "$arg" "$opts" +} +function ble/widget/backward-graphical-line { + local opts=$1 + local arg; ble-edit/content/get-arg 1 + ble/widget/forward-graphical-line.impl "$((-arg))" "$opts" +} +function ble/widget/beginning-of-line { + if ble/edit/performs-on-graphical-line; then + ble/widget/beginning-of-graphical-line + else + ble/widget/beginning-of-logical-line + fi +} +function ble/widget/non-space-beginning-of-line { + local old=$_ble_edit_ind + ble/widget/beginning-of-logical-line + local bol=$_ble_edit_ind ret= + ble-edit/content/find-non-space "$bol" + [[ $ret == $old ]] && ret=$bol # toggle + _ble_edit_ind=$ret + return 0 +} +function ble/widget/end-of-line { + if ble/edit/performs-on-graphical-line; then + ble/widget/end-of-graphical-line + else + ble/widget/end-of-logical-line + fi +} +function ble/widget/kill-backward-line { + if ble/edit/performs-on-graphical-line; then + ble/widget/kill-backward-graphical-line + else + ble/widget/kill-backward-logical-line + fi +} +function ble/widget/kill-forward-line { + if ble/edit/performs-on-graphical-line; then + ble/widget/kill-forward-graphical-line + else + ble/widget/kill-forward-logical-line + fi +} +function ble/widget/kill-line { + if ble/edit/performs-on-graphical-line; then + ble/widget/kill-graphical-line + else + ble/widget/kill-logical-line + fi +} +function ble/widget/forward-line { + if ble/edit/use-textmap; then + ble/widget/forward-graphical-line "$@" + else + ble/widget/forward-logical-line "$@" + fi +} +function ble/widget/backward-line { + if ble/edit/use-textmap; then + ble/widget/backward-graphical-line "$@" + else + ble/widget/backward-logical-line "$@" + fi +} +function ble/edit/word:eword/setup { + word_class=set2 word_set='a-zA-Z0-9' word_sep="$_ble_term_IFS" +} +function ble/edit/word:cword/setup { + word_class=set2 word_set='_a-zA-Z0-9' word_sep="$_ble_term_IFS" +} +function ble/edit/word:uword/setup { + word_class=set word_sep="$_ble_term_IFS" word_set="^$word_sep" +} +function ble/edit/word:sword/setup { + word_class=set word_sep=$'|&;()<> \t\n' word_set="^$word_sep" +} +function ble/edit/word:fword/setup { + word_class=set word_sep="/$_ble_term_IFS" word_set="^$word_sep" +} +function ble/edit/word/skip-backward { + local set=$1 head=${_ble_edit_str::x} + head=${head##*[$set]} + ((x-=${#head},${#head})) +} +function ble/edit/word/skip-forward { + local set=$1 tail=${_ble_edit_str:x} + tail=${tail%%[$set]*} + ((x+=${#tail},${#tail})) +} +function ble/edit/word/class:set/find-backward-word { + ble/edit/word/skip-backward "$word_set" +} +function ble/edit/word/class:set/find-backward-space { + ble/edit/word/skip-backward "$word_sep" +} +function ble/edit/word/class:set/find-forward-word { + ble/edit/word/skip-forward "$word_set" +} +function ble/edit/word/class:set/find-forward-space { + ble/edit/word/skip-forward "$word_sep" +} +function ble/edit/word/class:set2/find-backward-word { + ble/edit/word/skip-backward "!$word_sep" +} +function ble/edit/word/class:set2/find-backward-space { + case ${_ble_edit_str::x} in + (*[$word_sep]) return 1 ;; + (*[$word_set]) ble/edit/word/skip-backward "!$word_set" ;; + (*?) ble/edit/word/skip-backward "$word_set$word_sep" ;; + esac +} +function ble/edit/word/class:set2/find-forward-word { + ble/edit/word/skip-forward "!$word_sep" +} +function ble/edit/word/class:set2/find-forward-space { + case ${_ble_edit_str:x} in + ([$word_sep]*) return 1 ;; + ([$word_set]*) ble/edit/word/skip-forward "!$word_set" ;; + (?*) ble/edit/word/skip-forward "$word_set$word_sep" ;; + esac +} +function ble/edit/word/locate-backward { + local x=${1:-$_ble_edit_ind} arg=${2:-1} + while ((arg--)); do + ble/edit/word/class:"$word_class"/find-backward-word; c=$x + ble/edit/word/class:"$word_class"/find-backward-space; b=$x + done + ble/edit/word/class:"$word_class"/find-backward-word; a=$x +} +function ble/edit/word/locate-forward { + local x=${1:-$_ble_edit_ind} arg=${2:-1} + while ((arg--)); do + ble/edit/word/class:"$word_class"/find-forward-word; s=$x + ble/edit/word/class:"$word_class"/find-forward-space; t=$x + done + ble/edit/word/class:"$word_class"/find-forward-word; u=$x +} +function ble/edit/word/forward-range { + local arg=$1; ((arg)) || arg=1 + if ((arg<0)); then + ble/edit/word/backward-range "$((-arg))" + return "$?" + fi + local s t u; ble/edit/word/locate-forward "$x" "$arg"; y=$t +} +function ble/edit/word/backward-range { + local arg=$1; ((arg)) || arg=1 + if ((arg<0)); then + ble/edit/word/forward-range "$((-arg))" + return "$?" + fi + local a b c; ble/edit/word/locate-backward "$x" "$arg"; y=$b +} +function ble/edit/word/current-range { + local arg=$1; ((arg)) || arg=1 + if ((arg>0)); then + local a b c; ble/edit/word/locate-backward "$x" + local s t u; ble/edit/word/locate-forward "$a" "$arg" + ((y=a,x0)); then + x=$e1 + ble/edit/word/class:"$word_class"/find-forward-word; local b2=$x + while ble/edit/word/class:"$word_class"/find-forward-space || return 1; ((--arg>0)); do + ble/edit/word/class:"$word_class"/find-forward-word + done; local e2=$x + else + x=$b1 + ble/edit/word/class:"$word_class"/find-backward-word; local e2=$x + while ble/edit/word/class:"$word_class"/find-backward-space || return 1; ((++arg<0)); do + ble/edit/word/class:"$word_class"/find-backward-word + done; local b2=$x + fi + fi + ((b1>b2)) && local b1=$b2 e1=$e2 b2=$b1 e2=$e1 + ((b1=0)); then + ((arg==0)) && arg=1 + if ble/string#index-of "${_ble_edit_str:_ble_edit_ind}" "$char" "$arg"; then + ble/widget/.kill-range "$_ble_edit_ind" "$((_ble_edit_ind+ret+${#char}))" + return "$?" + fi + else + if ble/string#last-index-of "${_ble_edit_str::_ble_edit_ind}" "$char" "$((-arg))"; then + ble/widget/.kill-range "$ret" "$_ble_edit_ind" + return "$?" + fi + fi + if ((arg>0)); then + if ((arg==-1)); then + ble/widget/.bell "last char '$char' not found" + else + ble/widget/.bell "$((-arg))th last char '$char' not found" + fi + else + if ((arg==1)); then + ble/widget/.bell "next char '$char' not found" + else + ble/widget/.bell "$arg-th next char '$char' not found" + fi + fi + return 0 +} +function ble/widget/zap-to-char { + _ble_edit_mark_active= + _ble_decode_key__hook=ble/widget/zap-to-char.hook + return 147 +} +_ble_edit_exec_lines=() +_ble_edit_exec_lastexit=0 +_ble_edit_exec_lastarg=$BASH +_ble_edit_exec_lastparams=() +_ble_edit_exec_BASH_COMMAND=$BASH +_ble_edit_exec_PIPESTATUS=() +function ble-edit/exec/register { + local command=$1 + if [[ $command != *[!"$_ble_term_IFS"]* ]]; then + ble/edit/leave-command-layout + return 1 + fi + local command_id=$((_ble_edit_CMD++)) # Exposed to blehook exec_register + local lineno=$((_ble_edit_LINENO+1)) # Exposed to blehook exec_register + ble/array#push _ble_edit_exec_lines "$command_id,$lineno:$command" + blehook/invoke exec_register "$command" +} +function ble-edit/exec/has-pending-commands { + ((${#_ble_edit_exec_lines[@]})) +} +function ble-edit/exec/.setexit { + return "$_ble_edit_exec_lastexit" +} +function ble-edit/exec/compose-PIPESTATUS-reproducer { + ret= + [[ $bleopt_exec_restore_pipestatus ]] && ((${#_ble_edit_exec_PIPESTATUS[@]} >= 2)) || return 1 + local i pipe= + for ((i=0;i<${#_ble_edit_exec_PIPESTATUS[@]};i++)); do + pipe=$pipe'| (builtin exit '${_ble_edit_exec_PIPESTATUS[i]}')' + done + ret=${pipe:2} + return 0 +} +function ble-edit/exec/eval-with-setexit { + local debug_insert= + [[ :$2: == *:DEBUG:* ]] && + debug_insert='; local _ble_edit_exec_TRAPDEBUG_enabled=1' + local ret= q=\' Q="'\''" + [[ :$2: == *:pipestatus:* ]] && + ble-edit/exec/compose-PIPESTATUS-reproducer + local _ble_local_script=' + local -a BLE_PIPESTATUS + BLE_PIPESTATUS=("${_ble_edit_exec_PIPESTATUS[@]}")'$debug_insert' + ble-edit/exec/.setexit "$_ble_edit_exec_lastarg"'${ret:+"; $ret"}' + LINENO=${_ble_edit_LINENO:-${BASH_LINENO[${#BASH_LINENO[@]}-1]}} \ + BASH_COMMAND=$_ble_edit_exec_BASH_COMMAND \ + builtin eval -- '$q${1//$q/$Q}$q + ble/util/unlocal debug_insert ret q Q + builtin eval -- "$_ble_local_script" +} +ble/function#trace ble-edit/exec/eval-with-setexit +_ble_prompt_eol_mark=('' '' 0) +function ble-edit/exec/.adjust-eol { + local cols=${COLUMNS:-80} + local -a DRAW_BUFF=() + if [[ $bleopt_prompt_eol_mark ]]; then + if [[ $bleopt_prompt_eol_mark != "${_ble_prompt_eol_mark[0]}" ]]; then + if [[ $bleopt_prompt_eol_mark ]]; then + local ret= x=0 y=0 g=0 x1=0 x2=0 y1=0 y2=0 + LINES=1 COLUMNS=80 ble/canvas/trace "$bleopt_prompt_eol_mark" truncate:measure-bbox + _ble_prompt_eol_mark=("$bleopt_prompt_eol_mark" "$ret" "$x2") + else + _ble_prompt_eol_mark=('' '' 0) + fi + fi + local eol_mark=${_ble_prompt_eol_mark[1]} + ble/canvas/put.draw "$_ble_term_sgr0$_ble_term_sc" + local width=${_ble_prompt_eol_mark[2]} limit=$cols + [[ $_ble_term_rc ]] || ((limit--)) + if ((width>limit)); then + local x=0 y=0 g=0 + LINES=1 COLUMNS=$limit ble/canvas/trace.draw "$bleopt_prompt_eol_mark" truncate + width=$x + else + ble/canvas/put.draw "$eol_mark" + fi + [[ $_ble_term_rc ]] || ble/canvas/put-cub.draw "$width" + ble/canvas/put.draw "$_ble_term_sgr0$_ble_term_rc" + fi + local advance=$((_ble_term_xenl?cols-2:cols-3)) + if [[ $_ble_term_TERM == cygwin:* ]]; then + while ((advance)); do + ble/canvas/put-cuf.draw "$((advance-advance/2))" + ((advance/=2)) + done + else + ble/canvas/put-cuf.draw "$advance" + fi + ble/canvas/put.draw " $_ble_term_cr$_ble_term_el" + ble/canvas/bflush.draw +} +_ble_prompt_ps10_data=() +function ble/prompt/unit:_ble_prompt_ps10/update { + ble/prompt/unit:{section}/update _ble_prompt_ps10 "$PS0" '' +} +function ble-edit/exec/print-PS0 { + if [[ $PS0 ]]; then + local version=$COLUMNS,$_ble_edit_lineno,$_ble_history_count,$_ble_edit_CMD + local prompt_hashref_base='$version' + local prompt_rows=${LINES:-25} + local prompt_cols=${COLUMNS:-80} + local "${_ble_prompt_cache_vars[@]/%/=}" # WA #D1570 checked + ble/prompt/unit#update _ble_prompt_ps10 + local ret; ble/prompt/unit:{section}/get _ble_prompt_ps10 + ble/util/put "$ret" + fi +} +_ble_builtin_exit_processing= +function ble/builtin/exit/.read-arguments { + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/adjust-BASH_REMATCH + while (($#)); do + local arg=$1; shift + if [[ $arg == --help ]]; then + opt_flags=${opt_flags}H + elif local rex='^[-+]?[0-9]+$'; [[ $arg =~ $rex ]]; then + ble/array#push opt_args "$arg" + else + ble/util/print "exit: unrecognized argument '$arg'" >&2 + opt_flags=${opt_flags}E + fi + done + if ((${#opt_args[@]}>=2)); then + ble/util/print "exit: too many arguments" >&2 + opt_flags=${opt_flags}E + fi + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && + ble/base/restore-BASH_REMATCH +} +function ble/builtin/exit { + local ext=$? + local trap_processing=$_ble_builtin_trap_processing + [[ $_ble_builtin_trap_processing == "${BASH_SUBSHELL:-0}"/* ]] || trap_processing= + ((_ble_bash<40000)) && + [[ $trap_processing && " ${FUNCNAME[*]} " == *' ble-edit/io/TRAPUSR1 '* ]] && + [[ ${_ble_builtin_trap_sig_name[${trap_processing##*/}]} == SIGUSR1 ]] && + trap_processing= + if [[ ! $trap_processing ]] && { ble/util/is-running-in-subshell || [[ $_ble_decode_bind_state == none ]]; }; then + (($#)) || set -- "$ext" + builtin exit "$@" + return "$?" # オプションの指定間違いなどで失敗する可能性がある。 + fi + local set shopt; ble/base/.adjust-bash-options set shopt + local opt_flags= + local -a opt_args=() + ble/builtin/exit/.read-arguments "$@" + if [[ $opt_flags == *[EH]* ]]; then + [[ $opt_flags == *H* ]] && builtin exit --help + ble/base/.restore-bash-options set shopt + return 2 + fi + ((${#opt_args[@]})) || ble/array#push opt_args "$ext" + if [[ $trap_processing ]]; then + shopt -s extdebug + _ble_edit_exec_TRAPDEBUG_EXIT=$opt_args + ble-edit/exec:gexec/.TRAPDEBUG/trap + return 0 + fi + if [[ ! $_ble_builtin_exit_processing ]]; then + local joblist + ble/util/joblist + if ((${#joblist[@]})); then + local ret + while + local cancel_reason= + if ble/util/assign ret 'compgen -A stopped -- ""' 2>/dev/null; [[ $ret ]]; then + cancel_reason='stopped jobs' + elif [[ :$opts: == *:checkjobs:* ]]; then + if ble/util/assign ret 'compgen -A running -- ""' 2>/dev/null; [[ $ret ]]; then + cancel_reason='running jobs' + fi + fi + [[ $cancel_reason ]] + do + jobs + ble/builtin/read -ep "\e[38;5;12m[ble: There are $cancel_reason]\e[m Leave the shell anyway? [yes/No] " ret + case $ret in + ([yY]|[yY][eE][sS]) break ;; + ([nN]|[nN][oO]|'') + ble/base/.restore-bash-options set shopt + return 0 ;; + esac + done + fi + local ret + ble/edit/marker#instantiate-config exec_exit_mark && + ble/util/print "$ret" >&2 + fi + if ((40400<=_ble_bash&&_ble_bash<50200)); then + local global_TIMEFORMAT local_TIMEFORMAT + ble/util/assign global_TIMEFORMAT 'ble/util/print-global-definitions TIMEFORMAT' + if [[ $global_TIMEFORMAT == 'declare TIMEFORMAT; builtin unset -v TIMEFORMAT' ]]; then + global_TIMEFORMAT='declare -g TIMEFORMAT=$'\''\nreal\t%3lR\nuser\t%3lU\nsys %3lS'\' + else + global_TIMEFORMAT="declare -g ${global_TIMEFORMAT#declare }" + fi + ble/variable#copy-state TIMEFORMAT local_TIMEFORMAT + declare -g TIMEFORMAT= + TIMEFORMAT= + fi + ble/base/.restore-bash-options set shopt + _ble_builtin_exit_processing=1 + ble/fd#alloc _ble_builtin_exit_stdout '>&1' # EXIT trap で stdin/stdout を復元する + ble/fd#alloc _ble_builtin_exit_stderr '>&2' + builtin exit "${opt_args[@]}" &>/dev/null + builtin exit "${opt_args[@]}" &>/dev/null + _ble_builtin_exit_processing= + ble/fd#close _ble_builtin_exit_stdout + ble/fd#close _ble_builtin_exit_stderr + if ((40400<=_ble_bash&&_ble_bash<50200)); then + builtin eval -- "$global_TIMEFORMAT" + ble/variable#copy-state local_TIMEFORMAT TIMEFORMAT + fi + return 1 # exit できなかった場合は 1 らしい +} +function exit { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/exit "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_exec_time_TIMEFILE=$_ble_base_run/$$.exec.time +_ble_exec_time_TIMEFORMAT= +_ble_exec_time_tot= +_ble_exec_time_usr= +_ble_exec_time_sys= +function ble/exec/time#adjust-TIMEFORMAT { + if [[ ${TIMEFORMAT+set} ]]; then + _ble_exec_time_TIMEFORMAT=$TIMEFORMAT + else + builtin unset -v _ble_exec_time_TIMEFORMAT + fi + TIMEFORMAT='%R %U %S' +} +function ble/exec/time#restore-TIMEFORMAT { + if [[ ${_ble_exec_time_TIMEFORMAT+set} ]]; then + TIMEFORMAT=$_ble_exec_time_TIMEFORMAT + else + builtin unset -v 'TIMEFORMAT[0]' + fi + local tot usr sys dummy + while IFS=' ' ble/bash/read tot usr sys dummy; do + ble/string#match "$tot" '^[0-9.ms]+$' && break + done < "$_ble_exec_time_TIMEFILE" + ((_ble_exec_time_tot=10#0${tot//[!0-9]})) + ((_ble_exec_time_usr=10#0${usr//[!0-9]})) + ((_ble_exec_time_sys=10#0${sys//[!0-9]})) +} +_ble_exec_time_TIMES=$_ble_base_run/$$.exec.times +_ble_exec_time_usr_self= +_ble_exec_time_sys_self= +function ble/exec/time/times.parse-time { + local rex='^([0-9]+m)?([0-9]*)([^0-9ms][0-9]{3})?s?$' + [[ $1 =~ $rex ]] || return 1 + local min=$((10#0${BASH_REMATCH[1]%m})) + local sec=$((10#0${BASH_REMATCH[2]})) + local msc=$((10#0${BASH_REMATCH[3]#?})) + ((ret=(min*60+sec)*1000+msc)) + return 0 +} +function ble/exec/time/times.start { + builtin times >| "$_ble_exec_time_TIMES" +} +function ble/exec/time/times.end { + builtin times >> "$_ble_exec_time_TIMES" + local times + ble/util/readfile times "$_ble_exec_time_TIMES" + ble/string#split-words times "$times" + _ble_exec_time_usr_self= + _ble_exec_time_sys_self= + local ret= t1 t2 + ble/exec/time/times.parse-time "${times[0]}" && t1=$ret && + ble/exec/time/times.parse-time "${times[4]}" && t2=$ret && + ((_ble_exec_time_usr_self=t2>t1?t2-t1:0, + _ble_exec_time_usr_self>_ble_exec_time_usr&&( + _ble_exec_time_usr_self=_ble_exec_time_usr))) + ble/exec/time/times.parse-time "${times[1]}" && t1=$ret && + ble/exec/time/times.parse-time "${times[5]}" && t2=$ret && + ((_ble_exec_time_sys_self=t2>t1?t2-t1:0, + _ble_exec_time_sys_self>_ble_exec_time_sys&&( + _ble_exec_time_sys_self=_ble_exec_time_sys))) + return 0 +} +function ble/exec/time#mark-enabled { + local real=$_ble_exec_time_tot + local usr=$_ble_exec_time_usr usr_self=$_ble_exec_time_usr_self + local sys=$_ble_exec_time_sys sys_self=$_ble_exec_time_sys_self + local usr_child=$((usr-usr_self)) + local sys_child=$((sys-sys_self)) + local cpu=$((real>0?(usr+sys)*100/real:0)) + ((bleopt_exec_elapsed_enabled)) +} +_ble_exec_time_beg= +_ble_exec_time_end= +_ble_exec_time_ata= +function ble/exec/time#start { + if ((_ble_bash>=50000)); then + _ble_exec_time_EPOCHREALTIME_delay=0 + _ble_exec_time_EPOCHREALTIME_beg= + _ble_exec_time_EPOCHREALTIME_end= + function ble/exec/time#start { + ble/exec/time/times.start + _ble_exec_time_EPOCHREALTIME_beg= + _ble_exec_time_EPOCHREALTIME_end= + } + function ble/exec/time#end { + local beg=${_ble_exec_time_EPOCHREALTIME_beg//[!0-9]} + local end=${_ble_exec_time_EPOCHREALTIME_end//[!0-9]} + ((beg+=delay,beg>end)) && beg=$end + _ble_exec_time_beg=$beg + _ble_exec_time_end=$end + _ble_exec_time_ata=$((end-beg)) + _ble_exec_time_LINENO=$_ble_edit_LINENO + ble/exec/time/times.end + } + function ble/exec/time#calibrate.restore-lastarg { + _ble_exec_time_EPOCHREALTIME_beg=$EPOCHREALTIME + return "$_ble_edit_exec_lastexit" + } + function ble/exec/time#calibrate.save-lastarg { + _ble_exec_time_EPOCHREALTIME_end=$EPOCHREALTIME + ble/exec/time#adjust-TIMEFORMAT + } + function ble/exec/time#calibrate { + local _ble_edit_exec_lastexit=0 + local _ble_edit_exec_lastarg=hello + local _ble_exec_time_EPOCHREALTIME_beg= + local _ble_exec_time_EPOCHREALTIME_end= + local _ble_exec_time_tot= + local _ble_exec_time_usr= + local _ble_exec_time_sys= + local TIMEFORMAT= + local script1='ble/exec/time#calibrate.restore-lastarg "$_ble_edit_exec_lastarg"' + local script2='{ ble/exec/time#calibrate.save-lastarg; } 4>&1 5>&2 &>/dev/null' + local script=$script1$_ble_term_nl$script2$_ble_term_nl + local -a hist=() + local i + for i in {00..99}; do + { time LINENO=$i builtin eval -- "$script" 0<&"$_ble_util_fd_cmd_stdin" 1>&"$_ble_util_fd_cmd_stdout" 2>&"$_ble_util_fd_cmd_stderr"; } 2>| "$_ble_exec_time_TIMEFILE" + ble/exec/time#restore-TIMEFORMAT + local beg=${_ble_exec_time_EPOCHREALTIME_beg//[!0-9]} + local end=${_ble_exec_time_EPOCHREALTIME_end//[!0-9]} + ((hist[end-beg]++)) + done + local -a keys; keys=("${!hist[@]}") + keys=("${keys[@]::(${#keys[@]}+1)/2}") # Remove outliers + local s=0 n=0 t + for t in "${keys[@]}"; do ((s+=t*hist[t],n+=hist[t])); done + ((_ble_exec_time_EPOCHREALTIME_delay=s/n)) + } + ble/exec/time#calibrate + builtin unset -f ble/exec/time#calibrate + builtin unset -f ble/exec/time#calibrate.restore-lastarg + builtin unset -f ble/exec/time#calibrate.save-lastarg + else + _ble_exec_time_CLOCK_base=0 + _ble_exec_time_CLOCK_beg= + _ble_exec_time_CLOCK_end= + function ble/exec/time#end.adjust { + ((_ble_exec_time_beg/dev/null && ble/string#match "$ret" '^[0-9]+$'; then + function ble/exec/time#start { + ble/exec/time/times.start + _ble_exec_time_CLOCK_beg= + _ble_exec_time_CLOCK_end= + ble/util/assign _ble_exec_time_CLOCK_beg 'ble/bin/date +%s%6N' + } + function ble/exec/time#end { + ble/util/assign _ble_exec_time_CLOCK_end 'ble/bin/date +%s%6N' + local prev_end=$_ble_exec_time_end + _ble_exec_time_beg=$_ble_exec_time_CLOCK_beg + _ble_exec_time_end=$_ble_exec_time_CLOCK_end + _ble_exec_time_ata=$((_ble_exec_time_tot*1000)) + ble/exec/time#end.adjust + ble/exec/time/times.end + } + fi ;; + esac + fi + ble/exec/time#start +} +function ble/exec/time#format-elapsed-time { + ret=$_ble_exec_time_ata + if ((ret%1000!=0&&ret<1000)); then + ret="${ret}us" + elif ((ret%1000!=0&&ret<1000*100)); then + ret="${ret::${#ret}-3}.${ret:${#ret}-3:2}ms" + elif ((ret/=1000,ret<1000)); then + ret="${ret}ms" + elif ((ret<1000*1000)); then + ret="${ret::${#ret}-3}.${ret:${#ret}-3}s" + elif ((ret/=1000,ret<3600*100)); then # ret [s] + local min + ((min=ret/60,ret%=60)) + if ((min<100)); then + ret="${min}m${ret}s" + else + ret="$((min/60))h$((min%60))m${ret}s" + fi + else + local hour + ((ret/=60,hour=ret/60,ret%=60)) + ret="$((hour/24))d$((hour%24))h${ret}m" + fi +} +_ble_edit_exec_TRAPDEBUG_enabled= +_ble_edit_exec_TRAPDEBUG_INT= +_ble_edit_exec_TRAPDEBUG_EXIT= +_ble_edit_exec_inside_begin= +_ble_edit_exec_inside_prologue= +_ble_edit_exec_inside_userspace= +ble/builtin/trap/sig#reserve DEBUG override-builtin-signal:user-trap-in-postproc +function ble-edit/exec:gexec/.TRAPDEBUG/trap { + local trap_command + ble/builtin/trap/install-hook/.compose-trap_command "$_ble_builtin_trap_DEBUG" + builtin eval -- "builtin $trap_command" +} +_ble_edit_exec_TRAPDEBUG_adjusted= +function _ble_edit_exec_gexec__TRAPDEBUG_adjust { + builtin trap - DEBUG + _ble_edit_exec_TRAPDEBUG_adjusted=1 +} +ble/function#trace _ble_edit_exec_gexec__TRAPDEBUG_adjust +function ble-edit/exec:gexec/.TRAPDEBUG/restore { + _ble_edit_exec_TRAPDEBUG_adjusted= + local opts=$1 + if ble/builtin/trap/user-handler#has "$_ble_builtin_trap_DEBUG"; then + ble-edit/exec:gexec/.TRAPDEBUG/trap "$opts" + fi +} +function ble-edit/exec:gexec/.TRAPDEBUG/.filter { + [[ $_ble_edit_exec_TRAPDEBUG_enabled || ! $_ble_attached ]] || return 1 + [[ ${_ble_builtin_trap_inside-} ]] && return 1 + [[ $_ble_trap_bash_command != *ble-edit/exec:gexec/.* ]] || return 1 + if [[ ${FUNCNAME[2]-} == 'ble-edit/exec/eval-with-setexit' ]]; then + case $_ble_trap_bash_command in + ('ble-edit/exec/.setexit '*) return 1 ;; + ('LINENO='*' BASH_COMMAND='*' builtin eval -- '*) return 1 ;; + esac + fi + return 0 +} +_ble_trap_builtin_handler_DEBUG_filter=ble-edit/exec:gexec/.TRAPDEBUG/.filter +function ble-edit/exec:gexec/.TRAPDEBUG { + if [[ $_ble_edit_exec_TRAPDEBUG_EXIT ]]; then + local flag_clear= flag_exit= postproc= + ble/util/unlocal _ble_builtin_trap_processing + if [[ ! $_ble_builtin_trap_processing ]] || ((${#BLE_TRAP_FUNCNAME[*]}==0)); then + flag_clear=2 + flag_exit=$_ble_edit_exec_TRAPDEBUG_EXIT + else + case " ${BLE_TRAP_FUNCNAME[*]} " in + (' ble/builtin/trap/invoke.sandbox ble/builtin/trap/invoke '*) + ble/util/unlocal _ble_trap_lastarg # declared in ble/builtin/trap/.handler for DEBUG + _ble_trap_done=exit # declared in ble/builtin/trap/invoke for the other signal + _ble_trap_lastarg=$_ble_edit_exec_TRAPDEBUG_EXIT # declared in ble/builtin/trap/invoke for the other signal + postproc='ble/util/setexit 2' + shopt -q extdebug || postproc='return 0' ;; + (' blehook/invoke.sandbox blehook/invoke ble/builtin/trap/.handler '*) + _ble_local_ext=$_ble_edit_exec_TRAPDEBUG_EXIT + _ble_builtin_trap_processing=${_ble_builtin_trap_processing%%/*}/exit:$_ble_edit_exec_TRAPDEBUG_EXIT + postproc='ble/util/setexit 2' + shopt -q extdebug || postproc='return 0' ;; + (' ble/builtin/trap/invoke '* | ' blehook/invoke '*) + flag_clear=1 ;; + (' ble/builtin/trap/.handler '* | ' ble-edit/exec:gexec/.TRAPDEBUG '*) + flag_clear=2 ;; + (*) + postproc='ble/util/setexit 2' + shopt -q extdebug || postproc='return 128' ;; + esac + fi + if [[ $flag_clear ]]; then + [[ $flag_clear == 2 ]] || shopt -u extdebug + _ble_edit_exec_TRAPDEBUG_EXIT= + if ! ble/builtin/trap/user-handler#has "$_ble_trap_sig"; then + postproc="builtin trap - DEBUG${postproc:+;$postproc}" + fi + if [[ $flag_exit ]]; then + builtin exit "$flag_exit" + fi + fi + _ble_builtin_trap_postproc[_ble_trap_sig]=$postproc + return 126 # skip user hooks/traps + elif [[ $_ble_edit_exec_TRAPDEBUG_INT ]]; then + ble/util/setexit "$_ble_trap_lastexit" "$_ble_trap_lastarg" + BASH_COMMAND=$_ble_trap_bash_command LINENO=$BLE_TRAP_LINENO \ + ble/builtin/trap/invoke "$_ble_trap_sig" "${_ble_trap_args[@]}" + local depth=${#BLE_TRAP_FUNCNAME[*]} + if ((depth>=1)) && ! ble/string#match "${BLE_TRAP_FUNCNAME[*]}" '^ble-edit/exec:gexec/\.|(^| )ble/builtin/trap/\.handler'; then + if [[ ${bleopt_internal_exec_int_trace-} ]]; then + local source=${_ble_term_setaf[5]}${BLE_TRAP_SOURCE[0]} + local sep=${_ble_term_setaf[6]}: + local lineno=${_ble_term_setaf[2]}${BLE_TRAP_LINENO[0]} + local func=${_ble_term_setaf[6]}' ('${_ble_term_setaf[4]}${BLE_TRAP_FUNCNAME[0]}${1:+ $1}${_ble_term_setaf[6]}')' + ble/util/print "${_ble_term_setaf[9]}[SIGINT]$_ble_term_sgr0 $source$sep$lineno$func$_ble_term_sgr0" >&"$_ble_util_fd_tui_stderr" + fi + _ble_builtin_trap_postproc[_ble_trap_sig]="{ return $_ble_edit_exec_TRAPDEBUG_INT || break; } &>/dev/null" + elif ((depth==0)) && ! ble/string#match "$_ble_trap_bash_command" '^ble-edit/exec:gexec/\.'; then + if [[ ${bleopt_internal_exec_int_trace-} ]]; then + local source=${_ble_term_setaf[5]}global + local sep=${_ble_term_setaf[6]}: + ble/util/print "${_ble_term_setaf[9]}[SIGINT]$_ble_term_sgr0 $source$sep$_ble_term_sgr0 $_ble_trap_bash_command" >&"$_ble_util_fd_tui_stderr" + fi + _ble_builtin_trap_postproc[_ble_trap_sig]="break &>/dev/null" + fi + return 126 # skip user hooks/traps + elif ! ble/builtin/trap/user-handler#has "$_ble_trap_sig"; then + _ble_builtin_trap_postproc[_ble_trap_sig]='builtin trap -- - DEBUG' + return 126 # skip user hooks/traps + fi + return 0 +} +blehook internal_DEBUG!=ble-edit/exec:gexec/.TRAPDEBUG +_ble_builtin_trap_DEBUG_userTrapInitialized= +function ble/builtin/trap:DEBUG { + _ble_builtin_trap_DEBUG_userTrapInitialized=1 + if [[ $1 != - && ( $_ble_edit_exec_TRAPDEBUG_enabled || ! $_ble_attached ) ]]; then + ble-edit/exec:gexec/.TRAPDEBUG/trap + fi +} +function _ble_builtin_trap_DEBUG__initialize { + if [[ $_ble_builtin_trap_DEBUG_userTrapInitialized ]]; then + builtin eval -- "function $FUNCNAME { return 0; }" + return 0 + elif [[ $1 == force ]] || ble/function/is-global-trace-context; then + _ble_builtin_trap_DEBUG_userTrapInitialized=1 + builtin eval -- "function $FUNCNAME { return 0; }" + local _ble_local_tmpfile; ble/util/assign/mktmp + builtin trap -p DEBUG >| "$_ble_local_tmpfile" + local content; ble/util/readfile content "$_ble_local_tmpfile" + ble/util/assign/rmtmp + case ${content#"trap -- '"} in + (ble-edit/exec:gexec/.TRAPDEBUG*|ble/builtin/trap/.handler*) ;; # ble-0.4 + (ble-edit/exec:exec/.eval-TRAPDEBUG*|ble-edit/exec:gexec/.eval-TRAPDEBUG*) ;; # ble-0.2 + (.ble-edit/exec:exec/eval-TRAPDEBUG*|.ble-edit/exec:gexec/eval-TRAPDEBUG*) ;; # ble-0.1 + (*) builtin eval -- "$content" ;; # ble/builtin/trap に処理させる + esac + return 0 + fi +} +ble/function#trace _ble_builtin_trap_DEBUG__initialize +_ble_builtin_trap_DEBUG__initialize +function ble-edit/exec:gexec/.TRAPINT { + local ret; ble/builtin/trap/sig#resolve INT + ble/builtin/trap/user-handler#has "$ret" && return 0 + local ext=130 + ((_ble_bash>=40300)) || ext=128 # bash-4.2 以下は 128 + if [[ $_ble_attached ]]; then + if [[ ${bleopt_internal_exec_int_trace-} ]]; then + ble/util/print "$_ble_term_bold^C$_ble_term_sgr0" >&"$_ble_util_fd_tui_stderr" + fi + _ble_edit_exec_TRAPDEBUG_INT=$ext + ble-edit/exec:gexec/.TRAPDEBUG/trap + else + _ble_builtin_trap_postproc="{ return $ext || break; } 2>&$_ble_util_fd_tui_stderr" + fi +} +function ble-edit/exec:gexec/.TRAPINT/reset { + blehook internal_INT-='ble-edit/exec:gexec/.TRAPINT' +} +function ble-edit/exec:gexec/invoke-hook-with-setexit { + local -a __ble_exec_hook_args + __ble_exec_hook_args=("$@") + ble-edit/exec/eval-with-setexit 'blehook/invoke "${__ble_exec_hook_args[@]}"' +} >&"$_ble_util_fd_tui_stdout" 2>&"$_ble_util_fd_tui_stderr" +function ble-edit/exec:gexec/.TRAPERR { + if [[ $_ble_attached ]]; then + [[ $_ble_edit_exec_inside_userspace ]] || return 126 + [[ $_ble_trap_bash_command != *'return "$_ble_edit_exec_lastexit"'* ]] || return 126 + fi + return 0 +} +blehook internal_ERR!='ble-edit/exec:gexec/.TRAPERR' +_ble_edit_exec_TERM= +function ble-edit/exec:gexec/TERM/is-dirty { + [[ $TERM != "$_ble_edit_exec_TERM" ]] && return 0 + local bindp + ble/util/assign bindp 'builtin bind -p' + [[ $bindp != "$_ble_decode_bind_bindp" ]] +} +function ble-edit/exec:gexec/TERM/leave { + _ble_edit_exec_TERM=$TERM +} +function ble-edit/exec:gexec/TERM/enter { + if [[ $_ble_decode_bind_state != none ]] && ble-edit/exec:gexec/TERM/is-dirty; then + ble/edit/info/immediate-show text 'ble: TERM has changed. rebinding...' + ble/decode/detach + if ! ble/decode/attach; then + ble-detach + ble-edit/bind/.check-detach && return 1 + fi + ble/edit/info/immediate-default + fi +} +function ble-edit/exec:gexec/.begin { + _ble_edit_exec_inside_begin=1 + local IFS=$_ble_term_IFS + _ble_edit_exec_PWD=$PWD + ble-edit/exec:gexec/TERM/leave + ble/term/leave + ble-edit/bind/stdout.on + ble/util/buffer.flush + ble/builtin/trap/install-hook INT # 何故か改めて実行しないと有効にならない + blehook internal_INT!='ble-edit/exec:gexec/.TRAPINT' + ble-edit/exec:gexec/.TRAPDEBUG/restore +} +function ble-edit/exec:gexec/.end { + _ble_edit_exec_inside_begin= + local IFS=$_ble_term_IFS + ble-edit/exec:gexec/.TRAPINT/reset + builtin trap -- - DEBUG + blehook/invoke exec_end + [[ $PWD != "$_ble_edit_exec_PWD" ]] && blehook/invoke CHPWD + ble/util/joblist.flush >&"$_ble_util_fd_tui_stderr" + ble/util/notify-broken-locale + ble-edit/bind/.check-detach && return 0 + ble/term/enter + ble-edit/exec:gexec/TERM/enter || return 0 # rebind に失敗した時 .tail せずに抜ける + ble/util/c2w:auto/check + ble/edit/clear-command-layout + [[ $1 == restore ]] && return 0 # Note: 前回の呼出で .end に失敗した時 #D1170 + ble-edit/bind/.tail # flush will be called here +} +function ble-edit/exec:gexec/.prologue { + _ble_edit_exec_inside_prologue=1 + local IFS=$_ble_term_IFS + _ble_edit_exec_BASH_COMMAND=$1 + _ble_edit_exec_command_id=$2 + BLE_COMMAND_ID=$2 + BLE_PIPESTATUS=("${_ble_edit_exec_PIPESTATUS[@]}") + _ble_edit_exec_BASH_COMMAND_eval=$_ble_edit_exec_BASH_COMMAND + local ret + ble-edit/exec/compose-PIPESTATUS-reproducer && + _ble_edit_exec_BASH_COMMAND_eval="$ret; $_ble_edit_exec_BASH_COMMAND_eval" + ble-edit/restore-PS1 + ble-edit/restore-READLINE + ble-edit/restore-IGNOREEOF + builtin unset -v HISTCMD; ble/history/get-count -v HISTCMD + _ble_edit_exec_TRAPDEBUG_INT= + ble/util/joblist.clear + ble-edit/exec:gexec/invoke-hook-with-setexit internal_PREEXEC "$_ble_edit_exec_BASH_COMMAND" + ble-edit/exec:gexec/invoke-hook-with-setexit PREEXEC "$_ble_edit_exec_BASH_COMMAND" + ble-edit/exec/print-PS0 >&"$_ble_util_fd_tui_stdout" 2>&"$_ble_util_fd_tui_stderr" + ble/exec/time#start + ble/base/restore-BASH_REMATCH +} +function ble-edit/exec:gexec/.restore-lastarg { + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" + _ble_edit_exec_TRAPDEBUG_enabled=1 + _ble_edit_exec_inside_userspace=1 + _ble_exec_time_EPOCHREALTIME_beg=$EPOCHREALTIME + return "$_ble_edit_exec_lastexit" # set $? +} &>/dev/null # set -x 対策 #D0930 +function _ble_edit_exec_gexec__save_lastarg { + _ble_exec_time_EPOCHREALTIME_end=$EPOCHREALTIME \ + _ble_edit_exec_lastexit=$? \ + _ble_edit_exec_lastarg=$_ \ + _ble_edit_exec_PIPESTATUS=("${PIPESTATUS[@]}") \ + _ble_edit_exec_lastparams=("$@") + [[ $_ble_edit_exec_inside_userspace ]] || return "$_ble_edit_exec_lastexit" + _ble_edit_exec_inside_userspace= + _ble_edit_exec_TRAPDEBUG_enabled= + builtin eval -- "$_ble_bash_FUNCNEST_adjust" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_adjust" + ble/base/adjust-bash-options + ble/exec/time#adjust-TIMEFORMAT + ble/fd/save-external-standard-streams 0 4 5 + return "$_ble_edit_exec_lastexit" +} +function ble/variable#load-user-state/variable:_ { + __ble_var_set=set + __ble_var_val=$_ble_edit_exec_lastarg + __ble_var_att= +} +function ble/variable#load-user-state/variable:PIPESTATUS { + __ble_var_set=set + __ble_var_val=("${_ble_edit_exec_PIPESTATUS[@]}") + __ble_var_att=a +} +function _ble_edit_exec_gexec__epilogue { + _ble_exec_time_EPOCHREALTIME_end=${_ble_exec_time_EPOCHREALTIME_end:-$EPOCHREALTIME} \ + _ble_edit_exec_lastexit=$? + [[ $_ble_edit_exec_inside_prologue ]] || return 0 + _ble_edit_exec_inside_userspace= + _ble_edit_exec_TRAPDEBUG_enabled= + builtin eval -- "$_ble_bash_FUNCNEST_adjust" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_adjust" + ble/base/adjust-builtin-wrappers + if [[ $_ble_edit_exec_TRAPDEBUG_INT ]]; then + if ((_ble_edit_exec_lastexit==0)); then + _ble_edit_exec_lastexit=$_ble_edit_exec_TRAPDEBUG_INT + fi + _ble_edit_exec_TRAPDEBUG_INT= + fi + local IFS=$_ble_term_IFS + builtin trap -- - DEBUG + ble/base/adjust-bash-options + ble/base/adjust-BASH_REMATCH + ble-edit/adjust-IGNOREEOF + ble-edit/adjust-READLINE + ble/exec/time#restore-TIMEFORMAT + ble/exec/time#end + ble/util/reset-keymap-of-editing-mode + ble-edit/exec/.adjust-eol + _ble_edit_exec_inside_prologue= + ble/util/buffer.flush + ble-edit/exec:gexec/invoke-hook-with-setexit POSTEXEC "$_ble_edit_exec_BASH_COMMAND" + local msg= + if ((_ble_edit_exec_lastexit)); then + ble-edit/exec:gexec/invoke-hook-with-setexit ERREXEC "$_ble_edit_exec_BASH_COMMAND" + if local ret; ble/edit/marker#get-config exec_errexit_mark; then + ble/util/sprintf ret "$ret" "$_ble_edit_exec_lastexit" + msg=$ret + fi + fi + ble-edit/adjust-PS1 + if ble/exec/time#mark-enabled; then + if local ret; ble/edit/marker#get-config exec_elapsed_mark; then + local format=$ret + ble/exec/time#format-elapsed-time; local ata=$ret + local cpu='--.-' + if ((_ble_exec_time_tot)); then + cpu=$(((_ble_exec_time_usr+_ble_exec_time_sys)*1000/_ble_exec_time_tot)) + cpu=$((cpu/10)).$((cpu%10)) + fi + local ret + ble/util/sprintf ret "$format" "$ata" "$cpu" + msg=$msg$ret + ble/string#ltrim "$_ble_edit_exec_BASH_COMMAND" + msg="$msg $ret" + fi + fi + local ret + ble/edit/marker#instantiate "$msg" bare && ble/util/buffer.print "$ret" + local -a DRAW_BUFF=() + ble/prompt/print-ruler.draw "$_ble_edit_exec_BASH_COMMAND" + ble/canvas/bflush.draw +} +function ble-edit/exec:gexec/.setup { + ((${#_ble_edit_exec_lines[@]})) || [[ ! $_ble_edit_exec_TRAPDEBUG_adjusted ]] || return 1 + local buff='_ble_decode_bind_hook=' ibuff=1 + if [[ ! $_ble_edit_exec_TRAPDEBUG_adjusted ]]; then + buff[ibuff++]='_ble_builtin_trap_DEBUG__initialize force' + buff[ibuff++]=_ble_edit_exec_gexec__TRAPDEBUG_adjust + fi + local count=${#_ble_edit_exec_lines[@]} + if ((count)); then + ble/util/buffer.flush + local q=\' Q="'\''" cmd cmd_id lineno + buff[ibuff++]=ble-edit/exec:gexec/.begin + for cmd in "${_ble_edit_exec_lines[@]}"; do + cmd_id=${cmd%%,*} cmd=${cmd#*,} + lineno=${cmd%%:*} cmd=${cmd#*:} + buff[ibuff++]="ble-edit/exec:gexec/.prologue '${cmd//$q/$Q}' $cmd_id" + buff[ibuff++]='{ time LINENO='$lineno' eval -- "ble-edit/exec:gexec/.restore-lastarg \"\$_ble_edit_exec_lastarg\"' + buff[ibuff++]='$_ble_edit_exec_BASH_COMMAND_eval' + buff[ibuff++]='{ _ble_edit_exec_gexec__save_lastarg \"\$@\"; } 4>&1 5>&2 &>/dev/null' # Note: &>/dev/null は set -x 対策 #D0930 + buff[ibuff++]='" 0<&"$_ble_util_fd_cmd_stdin" 1>&"$_ble_util_fd_cmd_stdout" 2>&"$_ble_util_fd_cmd_stderr"; } 2>| "$_ble_exec_time_TIMEFILE"' + buff[ibuff++]='{ _ble_edit_exec_gexec__epilogue; } 3>&2 &>/dev/null' + done + _ble_edit_exec_lines=() + buff[ibuff++]=_ble_edit_exec_gexec__TRAPDEBUG_adjust + buff[ibuff++]=ble-edit/exec:gexec/.end + fi + if ((ibuff>=2)); then + IFS=$'\n' builtin eval '_ble_decode_bind_hook="${buff[*]}"' + fi + ((count>=1)); return "$?" +} +function ble-edit/exec:gexec/process { + ble-edit/exec:gexec/.setup + return "$?" +} +function ble-edit/exec:gexec/restore-state { + [[ $_ble_edit_exec_inside_prologue ]] && _ble_edit_exec_gexec__epilogue 3>&2 &>/dev/null + [[ $_ble_edit_exec_inside_begin ]] && ble-edit/exec:gexec/.end restore +} +: "${_ble_edit_lineno:=0}" +_ble_prompt_trim_opwd= +function ble/edit/.relocate-textarea { + ble/textarea#render leave + ble/edit/.allocate-textarea "$1" +} +function ble/edit/.allocate-textarea { + local opts=$1 + local -a DRAW_BUFF=() + if [[ :$opts: == *:keep-info:* && $_ble_textarea_panel == 0 ]] && + ! ble/util/joblist.has-events + then + local textarea_height=${_ble_canvas_panel_height[_ble_textarea_panel]} + ble/canvas/panel#increase-height.draw "$_ble_textarea_panel" 1 + ble/canvas/panel#goto.draw "$_ble_textarea_panel" 0 "$textarea_height" sgr0 + ble/canvas/bflush.draw + else + ble/edit/enter-command-layout # #D1800 checked=ble/edit/.relocate-textarea + ble/canvas/panel#goto.draw "$_ble_textarea_panel" "$_ble_textarea_gendx" "$_ble_textarea_gendy" sgr0 + ble/canvas/put.draw "$_ble_term_nl" + ble/canvas/bflush.draw + ble/util/joblist.bflush + [[ :$opts: == *:keep-info:* ]] && ble/edit/leave-command-layout + fi + ((_ble_edit_lineno++)) + _ble_prompt_trim_opwd=$PWD + ble/textarea#invalidate + _ble_canvas_x=0 _ble_canvas_y=0 + _ble_textarea_gendx=0 _ble_textarea_gendy=0 + _ble_canvas_panel_height[_ble_textarea_panel]=1 +} +function ble/widget/.hide-current-line { + local opts=$1 y_erase=0 + [[ :$opts: == *:keep-header:* ]] && y_erase=${_ble_prompt_ps1_data[4]} + local -a DRAW_BUFF=() + if ((y_erase)); then + ble/canvas/panel#clear-after.draw "$_ble_textarea_panel" 0 "$y_erase" + else + ble/canvas/panel#clear.draw "$_ble_textarea_panel" + fi + ble/canvas/panel#goto.draw "$_ble_textarea_panel" 0 "$y_erase" + ble/canvas/bflush.draw + ble/textarea#invalidate + _ble_canvas_x=0 _ble_canvas_y=$y_erase + _ble_textarea_gendx=0 _ble_textarea_gendy=$y_erase + ((_ble_canvas_panel_height[_ble_textarea_panel]=1+y_erase)) +} +function ble/widget/.newline/clear-content { + [[ $_ble_edit_overwrite_mode ]] && + ble/term/cursor-state/reveal + ble-edit/content/reset '' newline + _ble_edit_ind=0 + _ble_edit_mark=0 + _ble_edit_mark_active= + _ble_edit_overwrite_mode= +} +function ble/widget/.newline { + local opts=$1 + _ble_edit_mark_active= + if [[ $_ble_complete_menu_active ]]; then + [[ $_ble_highlight_layer_menu_filter_beg ]] && + ble/textarea#invalidate str # (#D0995) + fi + ble/edit/.allocate-textarea "$opts" # #D1800 checked=.newline + local ret; ble/string#count-char "$_ble_edit_str" $'\n' + ((_ble_edit_LINENO+=1+ret)) + ble/history/onleave.fire + ble/widget/.newline/clear-content +} +function ble/widget/discard-line { + ble-edit/content/clear-arg + [[ $bleopt_history_share ]] && ble/builtin/history/option:n + _ble_edit_line_disabled=1 ble/textarea#render leave + ble/widget/.newline keep-info + ble/history/revert-edits + ble/textarea#render +} +function ble/edit/histexpand/run { + local shopt=$- + set -H + ble/builtin/history/option:p "$command"; local ext=$? + [[ $shopt == *H* ]] || set +H + return "$ext" +} +function ble/edit/histexpand/.impl { + ble/edit/histexpand/run 2>/dev/null; local ext=$? + ((ext)) && ble/util/print "$command" + ble/util/put : + return "$ext" +} +function ble/edit/histexpand { + local command=$1 + if [[ ! ${command//[ ]} ]]; then + ret=$command + return 0 + elif ble/util/assign ret 'ble/edit/histexpand/.impl'; then + ret=${ret%$_ble_term_nl:} + return 0 + else + ret=$command + return 1 + fi +} +_ble_edit_integration_mc_precmd_stop= +function ble/widget/accept-line/.is-mc-init { + [[ $MC_SID == $$ ]] && ((_ble_edit_LINENO<=5)) || return 1 + ((_ble_edit_LINENO==0)) && return 0 + if [[ $_ble_edit_str == *'PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND'* ]]; then + if ble/string#match "$_ble_edit_str" 'pwd>&[0-9]+;kill -STOP \$\$'; then + _ble_edit_integration_mc_precmd_stop=1 + ble/edit/info/set-default clear + fi + return 0 + fi + if ble/string#match "$_ble_edit_str" 'bind -x '\''"\\e\+":"([^"'\'']+)"'\'''; then + function ble/widget/.mc_exec_command { + ble/textarea#redraw + ble/util/buffer.flush + builtin eval -- "$1" + } + local str=${_ble_edit_str//"$BASH_REMATCH"/"ble-bind -f M-+ '.mc_exec_command '\''${BASH_REMATCH[1]}'\'''"} && + [[ $str != "$_ble_edit_str" ]] && + ble-edit/content/reset-and-check-dirty "$str" + fi + return 1 +} +function ble/widget/accept-line { + ble/decode/widget/keymap-dispatch "$@" +} +function ble/widget/default/accept-line/.prepare-verify { + local new_str=$1 new_ind=$2 + ble-edit/content/reset-and-check-dirty "$old_str" + _ble_edit_ind=$old_ind + _ble_edit_line_disabled=1 ble/edit/.relocate-textarea keep-info + ble-edit/content/reset-and-check-dirty "$new_str" + _ble_edit_ind=$new_ind + _ble_edit_mark=0 + _ble_edit_mark_active= + return 0 +} +function ble/widget/default/accept-line { + if [[ :$1: == *:syntax:* ]] || ble/widget/accept-line/.is-mc-init; then + ble-edit/content/update-syntax + if ! ble/syntax:bash/is-complete; then + ble/widget/newline + return "$?" + fi + fi + ble-edit/content/clear-arg + local command=$_ble_edit_str + if [[ ! ${command//["$_ble_term_IFS"]} ]]; then + [[ $bleopt_history_share ]] && + ble/builtin/history/option:n + ble/textarea#render leave + ble/widget/.newline keep-info + ble/prompt/print-ruler.buff '' keep-info + ble/textarea#render + ble/util/buffer.flush + return 0 + fi + local is_line_expanded= + local orig_str=$_ble_edit_str orig_ind=$_ble_edit_ind + if [[ :$bleopt_edit_magic_accept: == *:sabbrev:* ]]; then + local old_str=$_ble_edit_str old_ind=$_ble_edit_ind + if ble/complete/sabbrev/expand; then + if [[ :$bleopt_edit_magic_accept: == *:verify:* ]]; then + ble/widget/default/accept-line/.prepare-verify "$_ble_edit_str" "$_ble_edit_ind" + return 0 + fi + command=$_ble_edit_str + is_line_expanded=1 + elif (($?==147)); then + return 147 # We entered menu-complete + fi + fi + local expand_type + for expand_type in alias autocd; do + if [[ :$bleopt_edit_magic_accept: == *:"$expand_type":* ]]; then + local old_str=$_ble_edit_str old_ind=$_ble_edit_ind + if ble/complete/expand:"$expand_type"; then + if [[ :$bleopt_edit_magic_accept: == *:verify:* ]]; then + ble/widget/default/accept-line/.prepare-verify "$_ble_edit_str" "$_ble_edit_ind" + return 0 + fi + command=$_ble_edit_str + is_line_expanded=1 + fi + fi + done + if [[ -o histexpand || :$bleopt_edit_magic_accept: == *:history:* ]]; then + local old_str=$_ble_edit_str old_ind=$_ble_edit_ind + if local ret; ble/edit/histexpand "$command"; then + local expanded=$ret + else + ble/widget/.internal-print-command \ + 'ble/edit/histexpand/run 1>/dev/null' pre-flush # エラーメッセージを表示 + shopt -q histreedit &>/dev/null || ble/widget/.newline/clear-content + return "$?" + fi + if [[ $expanded != "$command" ]]; then + if shopt -q histverify &>/dev/null; then + ble/widget/default/accept-line/.prepare-verify "$expanded" "${#expanded}" + return 0 + fi + is_line_expanded=1 + command=$expanded + if [[ :$bleopt_edit_magic_accept: == *:history-inline:* ]]; then + ble-edit/content/reset-and-check-dirty "$command" + _ble_edit_ind=${#command} + fi + fi + fi + if [[ $is_line_expanded && :$bleopt_edit_magic_accept: == *:verify-syntax:* ]]; then + if [[ $command != "$_ble_edit_str" ]]; then + ble-edit/content/reset-and-check-dirty "$command" + _ble_edit_ind=${#command} + fi + ble-edit/content/update-syntax + if ! ble/syntax:bash/is-complete; then + local old_str=$orig_str old_ind=$orig_ind + ble/widget/default/accept-line/.prepare-verify "$_ble_edit_str" "$_ble_edit_ind" + return 0 + fi + fi + ble/textarea#render leave + ble-edit/exec/register "$command" + ble/history/add "$command" + local show_expanded + [[ $command != "$_ble_edit_str" ]] && show_expanded=1 + ble/widget/.newline # #D1800 register + if [[ $show_expanded ]]; then + local ret + ble/edit/marker#instantiate 'expand' non-empty + ble/util/buffer.print "$ret $command" + fi +} +function ble/widget/accept-and-next { + ble-edit/content/clear-arg + ble/history/initialize + local index=$_ble_history_INDEX + local count=$_ble_history_COUNT + if ((index+1/dev/null; then + ble-edit/content/update-syntax + ble/syntax:bash/is-complete || return 1 + fi + return 0 +} +function ble/widget/accept-single-line-or { + ble/decode/widget/keymap-dispatch "$@" +} +function ble/widget/default/accept-single-line-or { + if ble-edit/is-single-complete-line; then + ble/widget/accept-line + else + ble/widget/"$@" + fi +} +function ble/widget/accept-single-line-or-newline { + ble/widget/accept-single-line-or newline +} +function ble/widget/edit-and-execute-command.editor { + ret=${bleopt_editor:-${VISUAL:-${EDITOR-}}} + [[ $ret ]] && return 0 + local -a editors=() + if [[ :$opts: == *:vi:* ]] && ble/bin#has vim; then + editors=(vim vi emacs nano) + elif [[ :$opts: == *:emacs:* ]]; then + editors=(emacs nano vim vi) + else + editors=(emacs vim nano vi) + fi + for ret in "${editors[@]}"; do + ble/bin#has "$ret" && return 0 + done + ret=vi + return 1 +} +function ble/widget/edit-and-execute-command.edit { + local content=$1 opts=:$2: + local file=$_ble_base_run/$$.blesh-fc.bash + ble/util/print "$content" >| "$file" + ble/widget/edit-and-execute-command.editor; local editor=$ret + if [[ :$opts: != *:no-newline:* ]]; then + _ble_edit_line_disabled=1 ble/textarea#render leave + ble/widget/.newline # #D1800 (呼び出し元で exec/register) + fi + ble/term/leave + builtin eval -- "$editor"' "$file"'; local ext=$? + ble/term/enter + if ((ext)); then + ret= + ble/widget/.bell + return 127 + fi + ble/util/readfile ret "$file" + return 0 +} +function ble/widget/edit-and-execute-command.impl { + local ret= + ble/widget/edit-and-execute-command.edit "$1" "$2" + local command=$ret + ble/string#match "$command" $'[\n]+$' && + command=${command::${#command}-${#BASH_REMATCH}} + if [[ $command != *[!"$_ble_term_IFS"]* ]]; then + ble/edit/leave-command-layout + ble/widget/.bell + return 1 + fi + ble/edit/marker#instantiate 'fc' non-empty + ble/util/buffer.print "$ret $command" + ble-edit/exec/register "$command" + ble/history/add "$command" +} +function ble/widget/edit-and-execute-command { + ble-edit/content/clear-arg + ble/widget/edit-and-execute-command.impl "$_ble_edit_str" "$1" +} +function ble/widget/insert-comment/.remove-comment { + local comment_begin=$1 + ret= + [[ $comment_begin ]] || return 1 + ble/string#escape-for-extended-regex "$comment_begin"; local rex_comment_begin=$ret + local rex1=$'([ \t]*'$rex_comment_begin$')[^\n]*(\n|$)|[ \t]+(\n|$)|\n' + local rex=$'^('$rex1')*$'; [[ $_ble_edit_str =~ $rex ]] || return 1 + local tail=$_ble_edit_str out= + while [[ $tail && $tail =~ ^$rex1 ]]; do + local rematch1=${BASH_REMATCH[1]} + if [[ $rematch1 ]]; then + out=$out${rematch1%?}${BASH_REMATCH:${#rematch1}} + else + out=$out$BASH_REMATCH + fi + tail=${tail:${#BASH_REMATCH}} + done + [[ $tail ]] && return 1 + ret=$out +} +function ble/widget/insert-comment/.insert { + local arg=$1 + local ret; ble/util/rlvar#read comment-begin '#' + local comment_begin=${ret::1} + local text= + if [[ $arg ]] && ble/widget/insert-comment/.remove-comment "$comment_begin"; then + text=$ret + else + text=$comment_begin${_ble_edit_str//$'\n'/$'\n'"$comment_begin"} + fi + ble-edit/content/reset-and-check-dirty "$text" +} +function ble/widget/insert-comment { + local arg; ble-edit/content/get-arg '' + ble/widget/insert-comment/.insert "$arg" + ble/widget/accept-line +} +function ble/widget/alias-expand-line.proc { + if ((tchild>=0)); then + ble/syntax/tree-enumerate-children \ + ble/widget/alias-expand-line.proc + elif [[ $wtype && ! ${wtype//[0-9]} ]] && ((wtype==_ble_ctx_CMDI)); then + local word=${_ble_edit_str:wbegin:wlen} + local ret; ble/alias#expand "$word" + [[ $word == "$ret" ]] && return 0 + changed=1 + ble/widget/.replace-range "$wbegin" "$((wbegin+wlen))" "$ret" + fi +} +function ble/widget/alias-expand-line { + ble-edit/content/clear-arg + ble-edit/content/update-syntax + local iN= changed= + ble/syntax/tree-enumerate ble/widget/alias-expand-line.proc + [[ $changed ]] && _ble_edit_mark_active= +} +function ble/widget/tilde-expand { + ble-edit/content/clear-arg + ble-edit/content/update-syntax + local len=${#_ble_edit_str} + local i=$len j=$len + while ((--i>=0)); do + ((_ble_syntax_attr[i])) || continue + if ((_ble_syntax_attr[i]==_ble_attr_TILDE)); then + local word=${_ble_edit_str:i:j-i} + builtin eval "local path=$word" + [[ $path != "$word" ]] && + ble/widget/.replace-range "$i" "$j" "$path" + fi + j=$i + done +} +_ble_edit_shell_expand_ExpandWtype=() +function ble/widget/shell-expand-line.initialize { + function ble/widget/shell-expand-line.initialize { return 0; } + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_CMDI]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_ARGI]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_ARGEI]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_ARGVI]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_RDRF]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_RDRD]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_RDRS]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_VALI]=1 + _ble_edit_shell_expand_ExpandWtype[_ble_ctx_CONDI]=1 +} +function ble/widget/shell-expand-line.expand-word { + local word=$1 + ble/widget/shell-expand-line.initialize + if [[ ! ${_ble_edit_shell_expand_ExpandWtype[wtype]} ]]; then + ret=$word + return 0 + fi + ret=$word; [[ $ret == '~'* ]] && ret='\'$word + ble/syntax:bash/simple-word/eval "$ret" noglob + if [[ $word != $ret || ${#ret[@]} -ne 1 ]]; then + [[ $opts == *:quote:* ]] && flags=${flags}q + return 0 + fi + if ((wtype==_ble_ctx_CMDI)); then + ble/alias#expand "$word" + [[ $word != $ret ]] && return 0 + fi + ret=$word +} +function ble/widget/shell-expand-line.proc { + [[ $wtype ]] || return 0 + if [[ ${wtype//[0-9]} ]]; then + ble/syntax/tree-enumerate-children ble/widget/shell-expand-line.proc + return 0 + fi + local word=${_ble_edit_str:wbegin:wlen} + local rex='^[_a-zA-Z][_a-zA-Z0-9]*=+?\(' + if ((wtype==_ble_attr_VAR)) && [[ $word =~ $rex ]]; then + ble/syntax/tree-enumerate-children ble/widget/shell-expand-line.proc + return 0 + fi + local flags= + local -a ret=() words=() + ble/widget/shell-expand-line.expand-word "$word" + words=("${ret[@]}") + [[ ${#words[@]} -eq 1 && $word == "$ret" ]] && return 0 + if ((wtype==_ble_ctx_RDRF||wtype==_ble_ctx_RDRD||wtype==_ble_ctx_RDRS)); then + local IFS=$_ble_term_IFS + words=("${words[*]}") + fi + local q=\' Q="'\''" specialchars='\ ["'\''`$|&;<>()*?!^{,}' + local w index=0 out= + for w in "${words[@]}"; do + ((index++)) && out=$out' ' + [[ $flags == *q* && $w == *["$specialchars"]* ]] && w=$q${w//$q/$Q}$q + out=$out$w + done + changed=1 + ble/widget/.replace-range "$wbegin" "$((wbegin+wlen))" "$out" +} +function ble/widget/shell-expand-line { + local opts=:$1: + ble-edit/content/clear-arg + ble/widget/history-expand-line + ble-edit/content/update-syntax + local iN= changed= + ble/syntax/tree-enumerate ble/widget/shell-expand-line.proc + [[ $changed ]] && _ble_edit_mark_active= +} +_ble_edit_undo=() +_ble_edit_undo_index=0 +_ble_edit_undo_history=() +_ble_edit_undo_hindex= +ble/array#push _ble_textarea_local_VARNAMES \ + _ble_edit_undo \ + _ble_edit_undo_index \ + _ble_edit_undo_history \ + _ble_edit_undo_hindex +function ble-edit/undo/.check-hindex { + local hindex; ble/history/get-index -v hindex + [[ $_ble_edit_undo_hindex == "$hindex" ]] && return 0 + if [[ $_ble_edit_undo_hindex ]]; then + local uindex=${_ble_edit_undo_index:-${#_ble_edit_undo[@]}} + local ret; ble/string#quote-words "$uindex" "${_ble_edit_undo[@]}" + _ble_edit_undo_history[_ble_edit_undo_hindex]=$ret + fi + if [[ ${_ble_edit_undo_history[hindex]} ]]; then + local data; builtin eval -- "data=(${_ble_edit_undo_history[hindex]})" + _ble_edit_undo=("${data[@]:1}") + _ble_edit_undo_index=${data[0]} + else + _ble_edit_undo=() + _ble_edit_undo_index=0 + fi + _ble_edit_undo_hindex=$hindex +} +function ble-edit/undo/clear-all { + _ble_edit_undo=() + _ble_edit_undo_index=0 + _ble_edit_undo_history=() + _ble_edit_undo_hindex= +} +function ble-edit/undo/history-change.hook { + local kind=$1; shift + case $kind in + (delete) + ble/builtin/history/array#delete-hindex _ble_edit_undo_history "$@" + _ble_edit_undo_hindex= ;; + (clear) + ble-edit/undo/clear-all ;; + (insert) + ble/builtin/history/array#insert-range _ble_edit_undo_history "$@" + local beg=$1 len=$2 + [[ $_ble_edit_undo_hindex ]] && + ((_ble_edit_undo_hindex>=beg)) && + ((_ble_edit_undo_hindex+=len)) ;; + esac +} +blehook history_change!=ble-edit/undo/history-change.hook +function ble-edit/undo/.get-current-state { + if ((_ble_edit_undo_index==0)); then + str= + if [[ $_ble_history_prefix || $_ble_history_load_done ]]; then + local index; ble/history/get-index + ble/history/get-entry -v str "$index" + fi + ind=${#entry} + else + local entry=${_ble_edit_undo[_ble_edit_undo_index-1]} + str=${entry#*:} ind=${entry%%:*} + fi +} +function ble-edit/undo/add { + ble-edit/undo/.check-hindex + local str ind; ble-edit/undo/.get-current-state + if [[ $_ble_edit_str != "$str" ]]; then + _ble_edit_undo[_ble_edit_undo_index++]=$_ble_edit_ind:$_ble_edit_str + if ((${#_ble_edit_undo[@]}>_ble_edit_undo_index)); then + _ble_edit_undo=("${_ble_edit_undo[@]::_ble_edit_undo_index}") + fi + elif ((_ble_edit_undo_index>0&&_ble_edit_ind!=${ind##*,})); then + _ble_edit_undo[_ble_edit_undo_index-1]=${ind%%,*},$_ble_edit_ind:$_ble_edit_str + fi +} +function ble-edit/undo/.load { + local point=$bleopt_undo_point + case $point in + (beg|end|first|last|near) ;; + (auto|*) + if local keymap; ble/decode/keymap/get-major-keymap; [[ $keymap == vi_[noxs]map ]]; then + point=near + else + point=beg + fi ;; + esac + if [[ $point == near ]]; then + if [[ :$1: == *:redo:* ]]; then + point=first + else + point=last + fi + fi + local str ind; ble-edit/undo/.get-current-state + if [[ $point == end || $point == beg ]]; then + local old=$_ble_edit_str new=$str ret + if [[ $bleopt_undo_point == end ]]; then + ble/string#common-suffix "${old:_ble_edit_ind}" "$new"; local s1=${#ret} + local old=${old::${#old}-s1} new=${new::${#new}-s1} + ble/string#common-prefix "${old::_ble_edit_ind}" "$new"; local p1=${#ret} + local old=${old:p1} new=${new:p1} + ble/string#common-suffix "$old" "$new"; local s2=${#ret} + local old=${old::${#old}-s2} new=${new::${#new}-s2} + ble/string#common-prefix "$old" "$new"; local p2=${#ret} + else + ble/string#common-prefix "${old::_ble_edit_ind}" "$new"; local p1=${#ret} + local old=${old:p1} new=${new:p1} + ble/string#common-suffix "${old:_ble_edit_ind-p1}" "$new"; local s1=${#ret} + local old=${old::${#old}-s1} new=${new::${#new}-s1} + ble/string#common-prefix "$old" "$new"; local p2=${#ret} + local old=${old:p2} new=${new:p2} + ble/string#common-suffix "$old" "$new"; local s2=${#ret} + fi + local beg=$((p1+p2)) end0=$((${#_ble_edit_str}-s1-s2)) end=$((${#str}-s1-s2)) + ble-edit/content/replace "$beg" "$end0" "${str:beg:end-beg}" + if [[ $bleopt_undo_point == end ]]; then + ind=$end + if ((beg=ucount&&(_ble_edit_undo_index=ucount))) + ble-edit/undo/.load redo +} +function ble-edit/undo/revert { + ble-edit/undo/.check-hindex + ble-edit/undo/add # 最後に add/load してから変更があれば記録 + ((_ble_edit_undo_index)) || return 1 + ((_ble_edit_undo_index=0)) + ble-edit/undo/.load +} +function ble-edit/undo/revert-toggle { + local arg=${1:-1} + ((arg%2==0)) && return 0 + ble-edit/undo/.check-hindex + ble-edit/undo/add # 最後に add/load してから変更があれば記録 + if ((_ble_edit_undo_index)); then + ((_ble_edit_undo_index=0)) + ble-edit/undo/.load + elif ((${#_ble_edit_undo[@]})); then + ((_ble_edit_undo_index=${#_ble_edit_undo[@]})) + ble-edit/undo/.load redo + else + return 1 + fi +} +function ble/widget/undo { + local arg; ble-edit/content/get-arg 1 + ble-edit/undo/undo "$arg" || ble/widget/.bell 'no more older undo history' +} +function ble/widget/redo { + local arg; ble-edit/content/get-arg 1 + ble-edit/undo/redo "$arg" || ble/widget/.bell 'no more recent undo history' +} +function ble/widget/revert { + local arg; ble-edit/content/clear-arg + ble-edit/undo/revert +} +_ble_edit_kbdmacro_record= +_ble_edit_kbdmacro_last=() +_ble_edit_kbdmacro_onplay= +function ble/widget/start-keyboard-macro { + ble/keymap:generic/clear-arg + [[ $_ble_edit_kbdmacro_onplay ]] && return 0 # 再生中は無視 + if ! ble/decode/charlog#start kbd-macro; then + if [[ $_ble_decode_keylog_chars_enabled == kbd-macro ]]; then + ble/widget/.bell 'kbd-macro: recording is already started' + else + ble/widget/.bell 'kbd-macro: the logging system is currently busy' + fi + return 1 + fi + _ble_edit_kbdmacro_record=1 + if [[ $_ble_decode_keymap == emacs ]]; then + ble/keymap:emacs/update-mode-indicator + elif [[ $_ble_decode_keymap == vi_nmap ]]; then + ble/keymap:vi/adjust-command-mode + fi + return 0 +} +function ble/widget/end-keyboard-macro { + ble/keymap:generic/clear-arg + [[ $_ble_edit_kbdmacro_onplay ]] && return 0 # 再生中は無視 + if [[ $_ble_decode_keylog_chars_enabled != kbd-macro ]]; then + ble/widget/.bell 'kbd-macro: recording is not running' + return 1 + fi + _ble_edit_kbdmacro_record= + ble/decode/charlog#end-exclusive-depth1 + _ble_edit_kbdmacro_last=("${ret[@]}") + if [[ $_ble_decode_keymap == emacs ]]; then + ble/keymap:emacs/update-mode-indicator + elif [[ $_ble_decode_keymap == vi_nmap ]]; then + ble/keymap:vi/adjust-command-mode + fi + return 0 +} +function ble/widget/call-keyboard-macro { + local arg; ble-edit/content/get-arg 1 + ble/keymap:generic/clear-arg + ((arg>0)) || return 1 + [[ $_ble_edit_kbdmacro_onplay ]] && return 0 # 再生中は無視 + local _ble_edit_kbdmacro_onplay=1 + if ((arg==1)); then + ble/widget/.MACRO "${_ble_edit_kbdmacro_last[@]}" + else + local -a chars=() + while ((arg-->0)); do + ble/array#push chars "${_ble_edit_kbdmacro_last[@]}" + done + ble/widget/.MACRO "${chars[@]}" + fi + [[ $_ble_decode_keymap == vi_nmap ]] && + ble/keymap:vi/adjust-command-mode +} +function ble/widget/print-keyboard-macro { + ble/keymap:generic/clear-arg + local ret; ble/decode/charlog#encode "${_ble_edit_kbdmacro_last[@]}" + ble/edit/info/show text "kbd-macro: $ret" + [[ $_ble_decode_keymap == vi_nmap ]] && + ble/keymap:vi/adjust-command-mode + return 0 +} +bleopt/declare -v history_default_point 'auto' +function bleopt/check:history_default_point { + case $value in + (begin|end|near|far|preserve|auto) return 0 ;; + (beginning-of-line|end-of-line|preserve-column) return 0 ;; + (beginning-of-logical-line|end-of-logical-line|preserve-logical-column) return 0 ;; + (beginning-of-graphical-line|end-of-graphical-line|preserve-graphical-column) return 0;; + (*) + ble/util/print "bleopt: Unrecognized value history_default_point='$value'." >&2 + return 1 + esac +} +bleopt/declare -o history_preserve_point history_default_point +function bleopt/check:history_preserve_point { + case $value in + (begin|end|near|far|preserve|auto) ;; + (beginning-of-line|end-of-line|preserve-column) ;; + (beginning-of-logical-line|end-of-logical-line|preserve-logical-column) ;; + (beginning-of-graphical-line|end-of-graphical-line|preserve-graphical-column) ;; + ('') value=end ;; + (*) value=preserve ;; + esac + bleopt/declare/.check-renamed-option history_preserve_point history_default_point +} +function ble-edit/history/goto { + ble/history/initialize + local histlen=$_ble_history_COUNT + local index0=$_ble_history_INDEX + local index1=$1 + ((index0==index1)) && return 0 + if ((index1>histlen)); then + index1=$histlen + ble/widget/.bell + elif ((index1<0)); then + index1=0 + ble/widget/.bell + fi + ((index0==index1)) && return 0 + if [[ $bleopt_history_share && ! $_ble_history_prefix && $_ble_decode_keymap != isearch ]]; then + if ((index0==histlen||index1==histlen)); then + ble/builtin/history/option:n + local histlen2=$_ble_history_COUNT + if ((histlen!=histlen2)); then + ble/textarea#invalidate + ble-edit/history/goto "$((index1==histlen?histlen:index1))" "$2" + return "$?" + fi + fi + fi + ble/history/set-edited-entry "$index0" "$_ble_edit_str" + ble/history/onleave.fire + local opts=$2 + if ((index1>=index0)); then + opts=$opts:forward + else + opts=$opts:backward + fi + local point point_x point_opts + ble-edit/history/goto/.prepare-point "$opts" + ble/history/set-index "$index1" + local entry; ble/history/get-edited-entry -v entry "$index1" + ble-edit/content/reset "$entry" history + _ble_edit_ind=0 + _ble_edit_mark=0 + _ble_edit_mark_active= + ble-edit/history/goto/.set-point +} +function ble-edit/history/goto/.prepare-point { + point_opts=$1 + point_x= + local ret + ble/opts#extract-last-optarg "$point_opts" point + [[ $ret ]] || ret=$bleopt_history_default_point + point=$ret + if [[ $point == auto ]]; then + ble/opts#extract-last-optarg "$point_opts" default-point + if [[ $ret ]]; then + point=$ret + else + point=end + fi + fi + case $point in + (near) + if [[ :$point_opts: == *:backward:* ]]; then + point=end + else + point=begin + fi ;; + (far) + if [[ :$point_opts: == *:backward:* ]]; then + point=begin + else + point=end + fi ;; + esac + if [[ :$point_opts: == *:linewise:* ]]; then + case $point in + (begin) point=beginning-of-line ;; + (end) point=end-of-line ;; + (preserve) point=preserve-column ;; + esac + fi + case $point in + (end-of-line|beginning-of-line|preserve-column) + local prefix + if [[ :$point_opts: == *:graphical:* ]]; then + prefix=graphical + elif [[ :$point_opts: == *:logical:* ]]; then + prefix=logical + elif [[ $bleopt_edit_line_type == graphical ]]; then + prefix=graphical + else + prefix=logical + fi + point=${point%-*}-$prefix-${point##*-} ;; + esac + case $point in + (preserve) + point_x=$_ble_edit_ind ;; + (preserve-logical-column) + point_x=${_ble_edit_str::_ble_edit_ind} + point_x=${point_x##*$'\n'} + point_x=${#point_x} ;; + (preserve-graphical-column) + ble/textmap#is-up-to-date || ble/widget/.update-textmap + local x y + ble/textmap#getxy.cur "$_ble_edit_ind" + point_x=$x ;; + (beginning-of-logical-line) + point=preserve-logical-column + point_x=0 ;; + (beginning-of-graphical-line) + point=preserve-graphical-column + point_x=0 ;; + esac +} +function ble-edit/history/goto/.set-point { + local delta=${1:-0} ret + case $point in + (begin) + _ble_edit_ind=0 ;; + (end) + _ble_edit_ind=${#_ble_edit_str} ;; + (end-of-logical-line) + if [[ :$point_opts: == *:backward:* ]]; then + ble-edit/content/find-logical-eol "${#_ble_edit_str}" "$((-delta))" + else + ble-edit/content/find-logical-eol 0 "$delta" + fi + _ble_edit_ind=$ret ;; + (end-of-graphical-line) + ble/textmap#is-up-to-date || ble/widget/.update-textmap + if [[ :$point_opts: == *:backward:* ]]; then + ble-edit/content/find-graphical-eol "${#_ble_edit_str}" "$((-delta))" + else + ble-edit/content/find-graphical-eol "$index" "$delta" + fi + _ble_edit_ind=$ret ;; + (preserve) + _ble_edit_ind=$point_x + if ((_ble_edit_ind>${#_ble_edit_str})); then + _ble_edit_ind=${#_ble_edit_str} + fi ;; + (preserve-logical-column) + if [[ :$point_opts: == *:backward:* ]]; then + ble-edit/content/find-logical-bol 0 "$delta"; local beg=$ret + else + ble-edit/content/find-logical-bol "${#_ble_edit_str}" "$((-delta))"; local beg=$ret + fi + _ble_edit_ind=$beg + if ((point_x)); then + ((_ble_edit_ind+=point_x)) + ble-edit/content/find-logical-eol "$beg" + ((_ble_edit_ind>ret)) && _ble_edit_ind=$ret + fi ;; + (preserve-graphical-column) + ble/textmap#is-up-to-date || ble/widget/.update-textmap + if [[ :$point_opts: == *:backward:* ]]; then + local x y + ble/textmap#getxy.cur "${#_ble_edit_str}" + ((y-=delta)) + else + local y=$delta + fi + local index + ble/textmap#get-index-at "$point_x" "$y" + _ble_edit_ind=$index ;; + esac +} +function ble-edit/history/history-message.hook { + ((_ble_edit_attached)) || return 1 + local message=$1 + if [[ $message ]]; then + ble/edit/info/immediate-show text "$message" + else + ble/edit/info/immediate-default + fi +} +blehook history_message!=ble-edit/history/history-message.hook +function ble/widget/history-next { + if [[ $_ble_history_prefix || $_ble_history_load_done ]]; then + local arg; ble-edit/content/get-arg 1 + ble/history/initialize + ble-edit/history/goto "$((_ble_history_INDEX+arg))" + else + ble-edit/content/clear-arg + ble/widget/.bell + fi +} +function ble/widget/history-prev { + local arg; ble-edit/content/get-arg 1 + ble/history/initialize + ble-edit/history/goto "$((_ble_history_INDEX-arg))" +} +function ble/widget/history-beginning { + ble-edit/content/clear-arg + ble-edit/history/goto 0 +} +function ble/widget/history-end { + ble-edit/content/clear-arg + if [[ $_ble_history_prefix || $_ble_history_load_done ]]; then + ble/history/initialize + ble-edit/history/goto "$_ble_history_COUNT" + else + ble/widget/.bell + fi +} +function ble/widget/history-goto { + local arg; ble-edit/content-get-arg 1 + if ((--arg<0)); then + ble/history/initialize + ((arg+=_ble_history_COUNT)) + fi + ble-edit/history/goto "$arg" +} +function ble/widget/history-expand-line { + ble-edit/content/clear-arg + local ret + ble/edit/histexpand "$_ble_edit_str" || return 1 + local expanded=$ret + [[ $_ble_edit_str == "$expanded" ]] && return 1 + ble-edit/content/reset-and-check-dirty "$expanded" + _ble_edit_ind=${#expanded} + _ble_edit_mark=0 + _ble_edit_mark_active= + return 0 +} +function ble/widget/history-and-alias-expand-line { + ble/widget/history-expand-line + ble/widget/alias-expand-line +} +function ble/widget/history-expand-backward-line { + ble-edit/content/clear-arg + local prevline=${_ble_edit_str::_ble_edit_ind} ret + ble/edit/histexpand "$prevline" || return 1 + local expanded=$ret + [[ $prevline == "$expanded" ]] && return 1 + local ret + ble/string#common-prefix "$prevline" "$expanded"; local dmin=${#ret} + local insert; ble-edit/content/replace-limited "$dmin" "$_ble_edit_ind" "${expanded:dmin}" + ((_ble_edit_ind=dmin+${#insert})) + _ble_edit_mark=0 + _ble_edit_mark_active= + return 0 +} +function ble/widget/magic-space/.expand { + local type=$bleopt_edit_magic_expand + local opts=$bleopt_edit_magic_opts + if [[ :$type: == *:history:* ]]; then + ble/widget/history-expand-backward-line && return 0 + fi + if [[ :$type: == *:sabbrev:* ]]; then + ble/complete/sabbrev/expand type-status; local ext=$? + if ((ext==0||32<=ext&&ext<=126)); then + ((ext==105)) && # 105 = 'i' (inline sabbrev) + [[ :$opts: == *:inline-sabbrev-no-insert:* ]] && + opt_noinsert=1 + return 0 + elif ((ext==147)); then + return 147 # メニュー補完に入った時 + fi + fi + if [[ :$type: == *:alias:* ]]; then + ble/complete/expand:alias && return 0 + fi + if [[ :$type: == *:autocd:* ]]; then + ble/complete/expand:autocd && return 0 + fi + return 1 +} +function ble/widget/magic-space { + [[ $_ble_decode_keymap == vi_imap ]] && + local oind=$_ble_edit_ind ostr=$_ble_edit_str + local arg; ble-edit/content/get-arg '' + local opt_noinsert= + ble/widget/magic-space/.expand; local ext=$? + ((ext==147)) && return "$ext" + if [[ $_ble_decode_keymap == vi_imap && $ostr != "$_ble_edit_str" ]]; then + _ble_edit_ind=$oind _ble_edit_str=$ostr ble/keymap:vi/undo/add more + ble/keymap:vi/undo/add more + fi + if [[ ! $opt_noinsert ]]; then + local -a KEYS=(32) + _ble_edit_arg=$arg + ble/widget/self-insert + fi +} +function ble/widget/magic-slash { + ble/complete/sabbrev/expand wordwise:pattern='~*':strip-slash + (($?==147)) && return 147 # sabbrev/expand の中でメニュー補完に入った時など。 + local -a KEYS=(47) # / + ble/widget/self-insert +} +function ble/highlight/layer:region/mark:search/get-face { face=region_match; } +function ble-edit/isearch/search/.match { + if [[ $flag_icase ]]; then + shopt -s nocasematch + [[ $1 =~ $2 ]]; local ext=$? + shopt -u nocasematch + return "$ext" + fi + [[ $1 =~ $2 ]] +} +function ble-edit/isearch/search/.index { + local target=${1:$3} needle=$2 + if [[ $flag_icase ]]; then + local ret + ble/string#tolower "$target"; target=$ret + ble/string#tolower "$needle"; needle=$ret + fi + local suffix=${target#*"$needle"} + [[ $target != "$suffix" ]] || return 1 + ((end=${#1}-${#suffix})) + ((beg=end-${#needle})) + return 0 +} +function ble-edit/isearch/search/.last-index { + local target=$1 needle=$2 + if [[ $flag_icase ]]; then + local ret + ble/string#tolower "$target"; target=$ret + ble/string#tolower "$needle"; needle=$ret + fi + local prefix=${target%"$needle"*} + [[ $target != "$prefix" ]] || return 1 + beg=${#prefix} + end=$((beg+${#needle})) + return 0 +} +function ble-edit/isearch/search { + local needle=$1 opts=$2 + beg= end= + [[ :$opts: != *:regex:* ]]; local has_regex=$? + [[ :$opts: != *:extend:* ]]; local has_extend=$? + local flag_icase= + [[ :$opts: == *:ignore-case:* ]] && flag_icase=1 + local flag_empty_retry= + if [[ :$opts: == *:-:* ]]; then + local start=$((has_extend?_ble_edit_mark+1:_ble_edit_ind)) + if ((has_regex)); then + ble-edit/isearch/.shift-backward-references + local rex="^.*($needle)" padding=$((${#_ble_edit_str}-start)) + ((padding)) && rex="$rex.{$padding}" + if ble-edit/isearch/search/.match "$_ble_edit_str" "$rex"; then + local rematch1=${BASH_REMATCH[1]} + if [[ $rematch1 || $BASH_REMATCH == "$_ble_edit_str" || :$opts: == *:allow_empty:* ]]; then + ((end=${#BASH_REMATCH}-padding, + beg=end-${#rematch1})) + return 0 + else + flag_empty_retry=1 + fi + fi + else + if [[ $needle ]]; then + ble-edit/isearch/search/.last-index "${_ble_edit_str::start}" "$needle" && return 0 + else + if [[ :$opts: == *:allow_empty:* ]] || ((--start>=0)); then + ((beg=end=start)) + return 0 + fi + fi + fi + elif [[ :$opts: == *:B:* ]]; then + local start=$((has_extend?_ble_edit_ind:_ble_edit_ind-1)) + ((start<0)) && return 1 + if ((has_regex)); then + ble-edit/isearch/.shift-backward-references + local rex="^.{0,$start}($needle)" + ((start==0)) && rex="^($needle)" + if ble-edit/isearch/search/.match "$_ble_edit_str" "$rex"; then + local rematch1=${BASH_REMATCH[1]} + if [[ $rematch1 || :$opts: == *:allow_empty:* ]]; then + ((end=${#BASH_REMATCH}, + beg=end-${#rematch1})) + return 0 + else + flag_empty_retry=1 + fi + fi + else + if [[ $needle ]]; then + ble-edit/isearch/search/.last-index "${_ble_edit_str::start+${#needle}}" "$needle" && return 0 + else + if [[ :$opts: == *:allow_empty:* ]] && ((--start>=0)); then + ((beg=end=start)) + return 0 + fi + fi + fi + else + local start=$((has_extend?_ble_edit_mark:_ble_edit_ind)) + if ((has_regex)); then + ble-edit/isearch/.shift-backward-references + local rex="($needle).*\$" + ((start)) && rex=".{$start}$rex" + if ble-edit/isearch/search/.match "$_ble_edit_str" "$rex"; then + local rematch1=${BASH_REMATCH[1]} + if [[ $rematch1 || :$opts: == *:allow_empty:* ]]; then + ((beg=${#_ble_edit_str}-${#BASH_REMATCH}+start)) + ((end=beg+${#rematch1})) + return 0 + else + flag_empty_retry=1 + fi + fi + else + if [[ $needle ]]; then + ble-edit/isearch/search/.index "$_ble_edit_str" "$needle" "$start" && return 0 + else + if [[ :$opts: == *:allow_empty:* ]] || ((++start<=${#_ble_edit_str})); then + ((beg=end=start)) + return 0 + fi + fi + fi + fi + if [[ $flag_empty_retry ]]; then + if [[ :$opts: == *:[-B]:* ]]; then + if ((--start>=0)); then + local mark=$_ble_edit_mark; ((mark&&mark--)) + local ind=$_ble_edit_ind; ((ind&&ind--)) + opts=$opts:allow_empty + _ble_edit_mark=$mark _ble_edit_ind=$ind ble-edit/isearch/search "$needle" "$opts" + return 0 + fi + else + if ((++start<=${#_ble_edit_str})); then + local mark=$_ble_edit_mark; ((mark<${#_ble_edit_str}&&mark++)) + local ind=$_ble_edit_ind; ((ind<${#_ble_edit_str}&&ind++)) + opts=$opts:allow_empty + _ble_edit_mark=$mark _ble_edit_ind=$ind ble-edit/isearch/search "$needle" "$opts" + return 0 + fi + fi + fi + return 1 +} +function ble-edit/isearch/.shift-backward-references { + local rex_cc='\[[@][^]@]+[@]\]' # [:blank:] [=a=] [.a.] など。 + local rex_bracket_expr='\[\^?]?('${rex_cc//@/:}'|'${rex_cc//@/=}'|'${rex_cc//@/.}'|[^][]|\[[^]:=.])*\[?\]' + local rex='^('$rex_bracket_expr'|\\[^1-8])*\\[1-8]' + local buff= + while [[ $needle =~ $rex ]]; do + local mlen=${#BASH_REMATCH} + buff=$buff${BASH_REMATCH::mlen-1}$((10#0${BASH_REMATCH:mlen-1}+1)) + needle=${needle:mlen} + done + needle=$buff$needle +} +_ble_edit_isearch_opts= +_ble_edit_isearch_str= +_ble_edit_isearch_dir=- +_ble_edit_isearch_arr=() +_ble_edit_isearch_old= +function ble-edit/isearch/status/append-progress-bar { + ble/util/is-unicode-output || return 1 + local pos=$1 count=$2 dir=$3 + [[ :$dir: == *:-:* || :$dir: == *:backward:* ]] && ((pos=count-1-pos)) + local ret; ble/string#create-unicode-progress-bar "$pos" "$count" 5 + text=$text$' \e[1;38;5;69;48;5;253m'$ret$'\e[m ' +} +function ble-edit/isearch/.show-status-with-progress.fib { + local ll rr + if [[ $_ble_edit_isearch_dir == - ]]; then + ll=\<\< rr=" " + else + ll=" " rr=">>" + fi + local index; ble/history/get-index + local histIndex='!'$((index+1)) + local text="(${#_ble_edit_isearch_arr[@]}: $ll $histIndex $rr) \`$_ble_edit_isearch_str'" + if [[ $1 ]]; then + local pos=$1 + local count; ble/history/get-count + text=$text' searching...' + ble-edit/isearch/status/append-progress-bar "$pos" "$count" "$_ble_edit_isearch_dir" + local percentage=$((count?pos*1000/count:1000)) + text=$text" @$pos ($((percentage/10)).$((percentage%10))%)" + fi + ((fib_ntask)) && text="$text *$fib_ntask" + ble/edit/info/show ansi "$text" +} +function ble-edit/isearch/.show-status.fib { + ble-edit/isearch/.show-status-with-progress.fib +} +function ble-edit/isearch/show-status { + local fib_ntask=${#_ble_util_fiberchain[@]} + ble-edit/isearch/.show-status.fib +} +function ble-edit/isearch/erase-status { + ble/edit/info/default +} +function ble-edit/isearch/.set-region { + local beg=$1 end=$2 + if ((beg=0)) && [[ ${_ble_edit_isearch_arr[ilast]} == "$ind:"[-+]":$hash" ]]; then + builtin unset -v "_ble_edit_isearch_arr[$ilast]" + return 0 + fi + local oind; ble/history/get-index -v oind + local obeg=$_ble_edit_ind oend=$_ble_edit_mark + [[ $_ble_edit_mark_active ]] || oend=$obeg + ((obeg>oend)) && local obeg=$oend oend=$obeg + local oneedle=$_ble_edit_isearch_str + local ohash=$obeg:$oend:$oneedle + [[ $ind == "$oind" && $hash == "$ohash" ]] && return 0 + ble/array#push _ble_edit_isearch_arr "$oind:$_ble_edit_isearch_dir:$ohash" +} +function ble-edit/isearch/.goto-match.fib { + local ind=$1 beg=$2 end=$3 needle=$4 + ble-edit/isearch/.push-isearch-array + _ble_edit_isearch_str=$needle + [[ $needle ]] && _ble_edit_isearch_old=$needle + local oind; ble/history/get-index -v oind + ((oind!=ind)) && ble-edit/history/goto "$ind" + ble-edit/isearch/.set-region "$beg" "$end" + ble-edit/isearch/.show-status.fib + ble/textarea#redraw +} +function ble-edit/isearch/.next.fib { + local opts=$1 + if [[ ! $fib_suspend ]]; then + if [[ :$opts: == *:forward:* || :$opts: == *:backward:* ]]; then + if [[ :$opts: == *:forward:* ]]; then + _ble_edit_isearch_dir=+ + else + _ble_edit_isearch_dir=- + fi + fi + local needle=${2-$_ble_edit_isearch_str} + local beg= end= search_opts=$_ble_edit_isearch_dir + if [[ :$opts: == *:append:* ]]; then + search_opts=$search_opts:extend + ble/path#remove opts append + fi + [[ :$opts: == *:ignore-case:* ]] && + search_opts=$search_opts:ignore-case + if [[ $needle ]] && ble-edit/isearch/search "$needle" "$search_opts"; then + local ind; ble/history/get-index -v ind + ble-edit/isearch/.goto-match.fib "$ind" "$beg" "$end" "$needle" + return 0 + fi + fi + ble-edit/isearch/.next-history.fib "$opts" "$needle" +} +function ble-edit/isearch/.next-history.fib { + local opts=$1 + if [[ $fib_suspend ]]; then + local needle=${fib_suspend#*:} isAdd= + local index start; builtin eval -- "${fib_suspend%%:*}" + fib_suspend= + else + local needle=${2-$_ble_edit_isearch_str} isAdd= + [[ :$opts: == *:append:* ]] && isAdd=1 + ble/history/initialize + local start=$_ble_history_INDEX + local index=$start + fi + if ((!isAdd)); then + if [[ $_ble_edit_isearch_dir == - ]]; then + ((index--)) + else + ((index++)) + fi + fi + local isearch_progress_callback=ble-edit/isearch/.show-status-with-progress.fib + local isearch_opts=stop_check:progress + [[ :$opts: == *:ignore-case:* ]] && isearch_opts=$isearch_opts:ignore-case + if [[ $_ble_edit_isearch_dir == - ]]; then + ble/history/isearch-backward-blockwise "$isearch_opts" + else + ble/history/isearch-forward "$isearch_opts" + fi + local ext=$? + if ((ext==0)); then + local str; ble/history/get-edited-entry -v str "$index" + if [[ $needle ]]; then + local ndl=$needle + if [[ :$opts: == *:ignore-case:* ]]; then + local ret + ble/string#tolower "$str"; str=$ret + ble/string#tolower "$ndl"; ndl=$ret + fi + if [[ $_ble_edit_isearch_dir == - ]]; then + local prefix=${str%"$ndl"*} + else + local prefix=${str%%"$ndl"*} + fi + local beg=${#prefix} end=$((${#prefix}+${#ndl})) + else + local beg=${#str} end=${#str} + fi + ble-edit/isearch/.goto-match.fib "$index" "$beg" "$end" "$needle" + elif ((ext==148)); then + fib_suspend="index=$index start=$start:$needle" + return 0 + else + ble/widget/.bell "isearch: \`$needle' not found" + return 0 + fi +} +function ble-edit/isearch/forward.fib { + if [[ ! $_ble_edit_isearch_str ]]; then + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:forward" "$_ble_edit_isearch_old" + else + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:forward" + fi +} +function ble-edit/isearch/backward.fib { + if [[ ! $_ble_edit_isearch_str ]]; then + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:backward" "$_ble_edit_isearch_old" + else + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:backward" + fi +} +function ble-edit/isearch/self-insert.fib { + local needle= + if [[ ! $fib_suspend ]]; then + local code=$1 + ((code==0)) && return 0 + local ret; ble/util/c2s "$code" + needle=$_ble_edit_isearch_str$ret + fi + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:append" "$needle" +} +function ble-edit/isearch/insert-string.fib { + local needle= + [[ ! $fib_suspend ]] && + needle=$_ble_edit_isearch_str$1 + ble-edit/isearch/.next.fib "$_ble_edit_isearch_opts:append" "$needle" +} +function ble-edit/isearch/history-forward.fib { + _ble_edit_isearch_dir=+ + ble-edit/isearch/.next-history.fib "$_ble_edit_isearch_opts" +} +function ble-edit/isearch/history-backward.fib { + _ble_edit_isearch_dir=- + ble-edit/isearch/.next-history.fib "$_ble_edit_isearch_opts" +} +function ble-edit/isearch/history-self-insert.fib { + local needle= + if [[ ! $fib_suspend ]]; then + local code=$1 + ((code==0)) && return 0 + local ret; ble/util/c2s "$code" + needle=$_ble_edit_isearch_str$ret + fi + ble-edit/isearch/.next-history.fib "$_ble_edit_isearch_opts:append" "$needle" +} +function ble-edit/isearch/prev { + local sz=${#_ble_edit_isearch_arr[@]} + ((sz==0)) && return 0 + local ilast=$((sz-1)) + local top=${_ble_edit_isearch_arr[ilast]} + builtin unset -v '_ble_edit_isearch_arr[ilast]' + local ind dir beg end + ind=${top%%:*}; top=${top#*:} + dir=${top%%:*}; top=${top#*:} + beg=${top%%:*}; top=${top#*:} + end=${top%%:*}; top=${top#*:} + _ble_edit_isearch_dir=$dir + ble-edit/history/goto "$ind" + ble-edit/isearch/.set-region "$beg" "$end" + _ble_edit_isearch_str=$top + [[ $top ]] && _ble_edit_isearch_old=$top + ble-edit/isearch/show-status +} +function ble-edit/isearch/process { + local isearch_time=0 + ble/util/fiberchain#resume + ble-edit/isearch/show-status +} +function ble/widget/isearch/forward { + ble/util/fiberchain#push forward + ble-edit/isearch/process +} +function ble/widget/isearch/backward { + ble/util/fiberchain#push backward + ble-edit/isearch/process +} +function ble/widget/isearch/self-insert { + local code; ble/widget/self-insert/.get-code + ((code==0)) && return 0 + ble/util/fiberchain#push "self-insert $code" + ble-edit/isearch/process +} +function ble/widget/isearch/history-forward { + ble/util/fiberchain#push history-forward + ble-edit/isearch/process +} +function ble/widget/isearch/history-backward { + ble/util/fiberchain#push history-backward + ble-edit/isearch/process +} +function ble/widget/isearch/history-self-insert { + local code; ble/widget/self-insert/.get-code + ((code==0)) && return 0 + ble/util/fiberchain#push "history-self-insert $code" + ble-edit/isearch/process +} +function ble/widget/isearch/prev { + local nque + if ((nque=${#_ble_util_fiberchain[@]})); then + local ret; ble/array#pop _ble_util_fiberchain + ble-edit/isearch/process + else + ble-edit/isearch/prev + fi +} +function ble/widget/isearch/.restore-mark-state { + local old_mark_active=${_ble_edit_isearch_save[3]} + if [[ $old_mark_active ]]; then + local index; ble/history/get-index + if ((index==_ble_edit_isearch_save[0])); then + _ble_edit_mark=${_ble_edit_isearch_save[2]} + if [[ $old_mark_active != S ]] || ((_ble_edit_ind==_ble_edit_isearch_save[1])); then + _ble_edit_mark_active=$old_mark_active + fi + fi + fi +} +function ble/widget/isearch/exit.impl { + ble/decode/keymap/pop + _ble_edit_isearch_arr=() + _ble_edit_isearch_dir= + _ble_edit_isearch_str= + ble-edit/isearch/erase-status +} +function ble/widget/isearch/exit-with-region { + ble/widget/isearch/exit.impl + if [[ $_ble_edit_mark_active ]]; then + _ble_edit_mark_active=S + ble/decode/keymap/push selection + fi +} +function ble/widget/isearch/exit { + ble/widget/isearch/exit.impl + _ble_edit_mark_active= + ble/widget/isearch/.restore-mark-state +} +function ble/widget/isearch/cancel { + if ((${#_ble_util_fiberchain[@]})); then + ble/util/fiberchain#clear + ble-edit/isearch/show-status # 進捗状況だけ消去 + else + if ((${#_ble_edit_isearch_arr[@]})); then + local step + ble/string#split step : "${_ble_edit_isearch_arr[0]}" + ble-edit/history/goto "${step[0]}" point=none + fi + ble/widget/isearch/exit.impl + _ble_edit_ind=${_ble_edit_isearch_save[1]} + _ble_edit_mark=${_ble_edit_isearch_save[2]} + _ble_edit_mark_active=${_ble_edit_isearch_save[3]} + fi +} +function ble/widget/isearch/exit-default { + ble/widget/isearch/exit-with-region + ble/decode/widget/redispatch +} +function ble/widget/isearch/accept-line { + if ((${#_ble_util_fiberchain[@]})); then + ble/widget/.bell "isearch: now searching..." + else + ble/widget/isearch/exit + ble-decode-key 13 # RET + fi +} +function ble/widget/isearch/exit-delete-forward-char { + ble/widget/isearch/exit + ble/widget/delete-forward-char +} +function ble/widget/history-isearch.impl { + local opts=$1 + ble/keymap:generic/clear-arg + ble/decode/keymap/push isearch + ble/util/fiberchain#initialize ble-edit/isearch + local index; ble/history/get-index + _ble_edit_isearch_save=("$index" "$_ble_edit_ind" "$_ble_edit_mark" "$_ble_edit_mark_active") + _ble_edit_isearch_opts= + ble/util/rlvar#test search-ignore-case 0 && + _ble_edit_isearch_opts=ignore-case + if [[ :$opts: == *:forward:* ]]; then + _ble_edit_isearch_dir=+ + else + _ble_edit_isearch_dir=- + fi + _ble_edit_isearch_arr=() + _ble_edit_mark=$_ble_edit_ind + ble-edit/isearch/show-status +} +function ble/widget/history-isearch-backward { + ble/widget/history-isearch.impl backward +} +function ble/widget/history-isearch-forward { + ble/widget/history-isearch.impl forward +} +function ble-decode/keymap:isearch/define { + ble-bind -f __defchar__ isearch/self-insert + ble-bind -f __line_limit__ nop + ble-bind -f C-r isearch/backward + ble-bind -f C-s isearch/forward + ble-bind -f 'C-?' isearch/prev + ble-bind -f 'DEL' isearch/prev + ble-bind -f 'C-h' isearch/prev + ble-bind -f 'BS' isearch/prev + ble-bind -f __default__ isearch/exit-default + ble-bind -f 'C-g' isearch/cancel + ble-bind -f 'C-x C-g' isearch/cancel + ble-bind -f 'C-M-g' isearch/cancel + ble-bind -f C-m isearch/exit + ble-bind -f RET isearch/exit + ble-bind -f C-j isearch/accept-line + ble-bind -f C-RET isearch/accept-line +} +_ble_edit_nsearch_input= +_ble_edit_nsearch_needle= +_ble_edit_nsearch_index0= +_ble_edit_nsearch_opts= +_ble_edit_nsearch_loadctx= +_ble_edit_nsearch_stack=() +_ble_edit_nsearch_match= +_ble_edit_nsearch_index= +_ble_edit_nsearch_prev= +function ble/highlight/layer:region/mark:nsearch/get-face { + face=(region_match) + [[ ${_ble_edit_nsearch_loadctx[2]-} ]] && + ble/array#push face region_insert +} +function ble/highlight/layer:region/mark:nsearch/get-selection { + local beg=$_ble_edit_mark + local end=$((_ble_edit_mark+${#_ble_edit_nsearch_needle})) + selection=("$beg" "$end") + local suffix=${_ble_edit_nsearch_loadctx[2]-} + [[ $suffix ]] && ble/array#push selection "$end" "$((${#_ble_edit_str}-${#suffix}))" +} +function ble-edit/nsearch/.show-status.fib { + [[ :$_ble_edit_nsearch_opts: == *:hide-status:* ]] && return 0 + local ll=\<\< rr=">>" # Note: Emacs workaround: '<<' や "<<" と書けない。 + local match=$_ble_edit_nsearch_match index0=$_ble_edit_nsearch_index0 + if ((match>index0)); then + ll=" " + elif ((match=2)); then + local record_type=${_ble_edit_nsearch_stack[nstack-1]%%,*} + if + if [[ $opt_forward ]]; then + [[ $record_type == backward ]] + else + [[ $record_type == forward ]] + fi + then + local ret; ble/array#pop _ble_edit_nsearch_stack + local record line=${ret#*:} + ble/string#split record , "${ret%%:*}" + if [[ $_ble_edit_nsearch_loadctx ]]; then + ble-edit/content/reset-and-check-dirty "$line" + else + ble-edit/history/goto "${record[1]}" point=none + fi + _ble_edit_nsearch_match=${record[1]} + _ble_edit_nsearch_index=${record[1]} + _ble_edit_ind=${record[2]} + _ble_edit_mark=${record[3]} + if ((_ble_edit_mark!=_ble_edit_ind)); then + _ble_edit_mark_active=nsearch + else + _ble_edit_mark_active= + fi + ble-edit/nsearch/.show-status.fib + ble/textarea#redraw + fib_suspend= + return 0 + fi + fi + local index start opt_resume= + if [[ $fib_suspend ]]; then + opt_resume=1 + builtin eval -- "$fib_suspend" + fib_suspend= + else + local index=$_ble_edit_nsearch_index + if ((nstack==1)); then + local index0=$_ble_edit_nsearch_index0 + ((opt_forward?indexindex0)) && + index=$index0 + fi + local start=$index + fi + local needle=$_ble_edit_nsearch_needle + if + if [[ $opt_forward ]]; then + local count; ble/history/get-count + [[ $opt_resume ]] || ((++index)) + ((index<=count)) + else + [[ $opt_resume ]] || ((--index)) + ((index>=0)) + fi + then + local isearch_time=$fib_clock + local isearch_progress_callback=ble-edit/nsearch/.show-status.fib + local isearch_opts=stop_check:progress + [[ :$opts: != *:substr:* ]] && isearch_opts=$isearch_opts:head + [[ :$opts: == *:ignore-case:* ]] && isearch_opts=$isearch_opts:ignore-case + if [[ $opt_forward ]]; then + ble/history/isearch-forward "$isearch_opts"; local ext=$? + else + ble/history/isearch-backward-blockwise "$isearch_opts"; local ext=$? + fi + fib_clock=$isearch_time + else + local ext=1 + fi + if ((ext==0)); then + ble-edit/nsearch/.goto-match "$index" "$opts" + ble-edit/nsearch/.show-status.fib + ble/textarea#redraw + elif ((ext==148)); then + fib_suspend="index=$index start=$start" + return 148 + else + ble/widget/.bell "ble.sh: nsearch: '$needle' not found" + ble-edit/nsearch/.show-status.fib + if [[ $opt_forward ]]; then + local count; ble/history/get-count + ((_ble_edit_nsearch_index=count-1)) + else + ((_ble_edit_nsearch_index=0)) + fi + return "$ext" + fi +} +function ble-edit/nsearch/forward.fib { + ble-edit/nsearch/.search.fib "$_ble_edit_nsearch_opts:forward" +} +function ble-edit/nsearch/backward.fib { + ble-edit/nsearch/.search.fib "$_ble_edit_nsearch_opts:backward" +} +function ble-edit/nsearch/.test { + local str=$1 ndl=$2 opts=$3 + [[ :$opts: == *:ignore-case:* ]] && + shopt -s nocasematch + if [[ :$opts: == *:substr:* ]]; then + [[ $str == *"$ndl"* ]] + else + [[ $str == "$ndl"* ]] + fi; local ext=$? + shopt -u nocasematch + return "$ext" +} +function ble-edit/nsearch/action:load-command/initialize { + [[ $_ble_syntax_lang == bash ]] || return 1 + ble-edit/content/update-syntax + local pos=$_ble_edit_ind + ble/string#match "${_ble_edit_str:pos}" $'^[ \t]+[^ \t\n]' && + ((pos+=${#BASH_REMATCH}-1)) + local comp_cword comp_words comp_line comp_point tree_words + if ble/syntax:bash/extract-command "$pos" treeinfo && ((${#tree_words[@]})); then + local wend=${tree_words[0]%:*} nofs=${tree_words[0]#*:} + ble/string#split-words node "${_ble_syntax_tree[wend-1]}" + local wlen=${node[nofs+1]} + local wbeg=$((wlen<0?wlen:wend-wlen)) + local beg=$wbeg end=${tree_words[${#tree_words[@]}-1]%:*} + ble/string#match "${_ble_edit_str:end}" $'^[ \t]+($|\n)' && + ((end+=${#BASH_REMATCH})) + if ((_ble_edit_ind<=end)) || { ble/string#match "${_ble_edit_str:end:_ble_edit_ind-end}" $'^[[:blank:]\n]+$' && end=$_ble_edit_ind; }; then + if ((beg>=0&&beg " needle || return 1 + _ble_edit_nsearch_input=$needle + elif [[ :$opts: == *:again:* ]]; then + needle=$_ble_edit_nsearch_input + else + local len=$_ble_edit_ind + if [[ $_ble_decode_keymap == vi_[noxs]map ]]; then + ble-edit/content/eolp || ((len++)) + fi + needle=${_ble_edit_str::len} + [[ ${_ble_edit_nsearch_loadctx[0]} ]] && + needle=${needle:_ble_edit_nsearch_loadctx[0]} + fi + _ble_edit_nsearch_needle=$needle + if [[ ! $_ble_edit_nsearch_needle ]]; then + local empty=empty-search + ble/opts#extract-last-optarg "$opts" empty && empty=$ret + case $empty in + (history-move) + if [[ :$opts: == *:forward:* ]]; then + ble/widget/history-next + else + ble/widget/history-prev + fi && _ble_edit_ind=0 + return "$?" ;; + (hide-status) + opts=$opts:hide-status ;; + (emulate-readline) + opts=hide-status:point=end:immediate-accept:$opts ;; + (previous-search) + _ble_edit_nsearch_needle=$_ble_edit_nsearch_prev ;; + esac + fi + _ble_edit_nsearch_prev=$_ble_edit_nsearch_needle + ble/keymap:generic/clear-arg + [[ :$opts: != *:ignore-case:* && :$opts: != *:match-case:* ]] && + ble/util/rlvar#test search-ignore-case 0 && + opts=$opts:ignore-case + _ble_edit_nsearch_stack=() + local index; ble/history/get-index + _ble_edit_nsearch_index0=$index + _ble_edit_nsearch_opts=$opts + ble/path#remove _ble_edit_nsearch_opts forward + ble/path#remove _ble_edit_nsearch_opts backward + _ble_edit_nsearch_match=$index + _ble_edit_nsearch_index=$index + _ble_edit_mark_active= + ble/decode/keymap/push nsearch + if ble-edit/nsearch/.test "$_ble_edit_str" "$_ble_edit_nsearch_needle" "$opts"; then + ble-edit/nsearch/.goto-match '' "$opts" + fi + ble/util/fiberchain#initialize ble-edit/nsearch + if [[ :$opts: == *:forward:* ]]; then + ble/util/fiberchain#push forward + else + ble/util/fiberchain#push backward + fi + ble/util/fiberchain#resume +} +function ble/widget/history-nsearch-backward { + ble/widget/history-search "input:substr:backward:$1" +} +function ble/widget/history-nsearch-forward { + ble/widget/history-search "input:substr:forward:$1" +} +function ble/widget/history-nsearch-backward-again { + ble/widget/history-search "again:substr:backward:$1" +} +function ble/widget/history-nsearch-forward-again { + ble/widget/history-search "again:substr:forward:$1" +} +function ble/widget/history-search-backward { + ble/widget/history-search "backward:$1" +} +function ble/widget/history-search-forward { + ble/widget/history-search "forward:$1" +} +function ble/widget/history-substring-search-backward { + ble/widget/history-search "substr:backward:$1" +} +function ble/widget/history-substring-search-forward { + ble/widget/history-search "substr:forward:$1" +} +function ble/widget/nsearch/forward { + local ntask=${#_ble_util_fiberchain[@]} + if ((ntask>=1)) && [[ ${_ble_util_fiberchain[ntask-1]%%:*} == backward ]]; then + local ret; ble/array#pop _ble_util_fiberchain + else + ble/util/fiberchain#push forward + fi + ble/util/fiberchain#resume +} +function ble/widget/nsearch/backward { + local ntask=${#_ble_util_fiberchain[@]} + if ((ntask>=1)) && [[ ${_ble_util_fiberchain[ntask-1]%%:*} == forward ]]; then + local ret; ble/array#pop _ble_util_fiberchain + else + ble/util/fiberchain#push backward + fi + ble/util/fiberchain#resume +} +function ble/widget/nsearch/.exit { + ble/decode/keymap/pop + _ble_edit_mark_active= + ble-edit/nsearch/erase-status +} +function ble/widget/nsearch/exit { + if [[ :$_ble_edit_nsearch_opts: == *:immediate-accept:* ]]; then + ble/widget/nsearch/accept-line + else + ble/widget/nsearch/.exit + fi +} +function ble/widget/nsearch/exit-default { + ble/widget/nsearch/.exit + ble/decode/widget/redispatch +} +function ble/widget/nsearch/cancel { + if ((${#_ble_util_fiberchain[@]})); then + ble/util/fiberchain#clear + ble-edit/nsearch/show-status + else + ble/widget/nsearch/.exit + local record=${_ble_edit_nsearch_stack[0]} + if [[ $record ]]; then + local line=${record#*:} + ble/string#split record , "${record%%:*}" + if [[ $_ble_edit_nsearch_loadctx ]]; then + ble-edit/content/reset-and-check-dirty "$line" + else + ble-edit/history/goto "$_ble_edit_nsearch_index0" point=none + fi + _ble_edit_ind=${record[2]} + _ble_edit_mark=${record[3]} + fi + fi +} +function ble/widget/nsearch/accept-line { + if ((${#_ble_util_fiberchain[@]})); then + ble/widget/.bell "nsearch: now searching..." + else + ble/widget/nsearch/.exit + ble-decode-key 13 # RET + fi +} +function ble-decode/keymap:nsearch/define { + ble-bind -f __default__ nsearch/exit-default + ble-bind -f __line_limit__ nop + ble-bind -f 'C-g' nsearch/cancel + ble-bind -f 'C-x C-g' nsearch/cancel + ble-bind -f 'C-M-g' nsearch/cancel + ble-bind -f C-m nsearch/exit + ble-bind -f RET nsearch/exit + ble-bind -f C-j nsearch/accept-line + ble-bind -f C-RET nsearch/accept-line + ble-bind -f C-r nsearch/backward + ble-bind -f C-s nsearch/forward + ble-bind -f C-p nsearch/backward + ble-bind -f C-n nsearch/forward + ble-bind -f up nsearch/backward + ble-bind -f down nsearch/forward + ble-bind -f prior nsearch/backward + ble-bind -f next nsearch/forward +} +function ble-decode/keymap:safe/.bind { + [[ $ble_bind_nometa && $1 == *M-* ]] && return 0 + ble-bind -f "$1" "$2" +} +function ble-decode/keymap:safe/bind-common { + ble-decode/keymap:safe/.bind insert 'overwrite-mode' + ble-decode/keymap:safe/.bind __batch_char__ 'batch-insert' + ble-decode/keymap:safe/.bind __defchar__ 'self-insert' + ble-decode/keymap:safe/.bind 'C-q' 'quoted-insert' + ble-decode/keymap:safe/.bind 'C-v' 'quoted-insert' + ble-decode/keymap:safe/.bind 'M-C-m' 'newline' + ble-decode/keymap:safe/.bind 'M-RET' 'newline' + ble-decode/keymap:safe/.bind paste_begin 'bracketed-paste' + ble-decode/keymap:safe/.bind 'C-@' 'set-mark' + ble-decode/keymap:safe/.bind 'C-SP' 'set-mark' + ble-decode/keymap:safe/.bind 'NUL' 'set-mark' + ble-decode/keymap:safe/.bind 'M-SP' 'set-mark' + ble-decode/keymap:safe/.bind 'C-x C-x' 'exchange-point-and-mark' + ble-decode/keymap:safe/.bind 'C-w' 'kill-region-or kill-backward-uword' + ble-decode/keymap:safe/.bind 'M-w' 'copy-region-or copy-backward-uword' + ble-decode/keymap:safe/.bind 'C-y' 'yank' + ble-decode/keymap:safe/.bind 'M-y' 'yank-pop' + ble-decode/keymap:safe/.bind 'M-S-y' 'yank-pop backward' + ble-decode/keymap:safe/.bind 'M-Y' 'yank-pop backward' + ble-decode/keymap:safe/.bind 'S-delete' 'kill-region-or kill-backward-uword' + ble-decode/keymap:safe/.bind 'C-insert' 'copy-region-or copy-backward-uword' + ble-decode/keymap:safe/.bind 'S-insert' 'yank' + ble-decode/keymap:safe/.bind 'M-\' 'delete-horizontal-space' + ble-decode/keymap:selection/bind-shift @marked + ble-decode/keymap:safe/.bind 'C-f' 'forward-char' + ble-decode/keymap:safe/.bind 'C-b' 'backward-char' + ble-decode/keymap:safe/.bind 'right' 'forward-char' + ble-decode/keymap:safe/.bind 'left' 'backward-char' + ble-decode/keymap:safe/.bind 'C-d' 'delete-region-or delete-forward-char' + ble-decode/keymap:safe/.bind 'delete' 'delete-region-or delete-forward-char' + ble-decode/keymap:safe/.bind 'C-?' 'delete-region-or delete-backward-char' + ble-decode/keymap:safe/.bind 'DEL' 'delete-region-or delete-backward-char' + ble-decode/keymap:safe/.bind 'C-h' 'delete-region-or delete-backward-char' + ble-decode/keymap:safe/.bind 'BS' 'delete-region-or delete-backward-char' + ble-decode/keymap:safe/.bind 'C-t' 'transpose-chars' + ble-decode/keymap:safe/.bind 'C-right' 'forward-cword' + ble-decode/keymap:safe/.bind 'C-left' 'backward-cword' + ble-decode/keymap:safe/.bind 'M-right' 'forward-sword' + ble-decode/keymap:safe/.bind 'M-left' 'backward-sword' + ble-decode/keymap:safe/.bind 'M-d' 'kill-forward-cword' + ble-decode/keymap:safe/.bind 'M-h' 'kill-backward-cword' + ble-decode/keymap:safe/.bind 'C-delete' 'delete-forward-cword' + ble-decode/keymap:safe/.bind 'C-_' 'delete-backward-cword' + ble-decode/keymap:safe/.bind 'C-DEL' 'delete-backward-cword' + ble-decode/keymap:safe/.bind 'C-BS' 'delete-backward-cword' + ble-decode/keymap:safe/.bind 'M-delete' 'copy-forward-sword' + ble-decode/keymap:safe/.bind 'M-C-?' 'copy-backward-sword' + ble-decode/keymap:safe/.bind 'M-DEL' 'copy-backward-sword' + ble-decode/keymap:safe/.bind 'M-C-h' 'copy-backward-sword' + ble-decode/keymap:safe/.bind 'M-BS' 'copy-backward-sword' + ble-decode/keymap:safe/.bind 'M-f' 'forward-cword' + ble-decode/keymap:safe/.bind 'M-b' 'backward-cword' + ble-decode/keymap:safe/.bind 'M-c' 'capitalize-eword' + ble-decode/keymap:safe/.bind 'M-l' 'downcase-eword' + ble-decode/keymap:safe/.bind 'M-u' 'upcase-eword' + ble-decode/keymap:safe/.bind 'M-t' 'transpose-ewords' + ble-decode/keymap:safe/.bind 'C-a' 'beginning-of-line' + ble-decode/keymap:safe/.bind 'C-e' 'end-of-line' + ble-decode/keymap:safe/.bind 'home' 'beginning-of-line' + ble-decode/keymap:safe/.bind 'end' 'end-of-line' + ble-decode/keymap:safe/.bind 'M-m' 'non-space-beginning-of-line' + ble-decode/keymap:safe/.bind 'C-p' 'backward-line' # overwritten by bind-history + ble-decode/keymap:safe/.bind 'up' 'backward-line' # overwritten by bind-history + ble-decode/keymap:safe/.bind 'C-n' 'forward-line' # overwritten by bind-history + ble-decode/keymap:safe/.bind 'down' 'forward-line' # overwritten by bind-history + ble-decode/keymap:safe/.bind 'C-k' 'kill-forward-line' + ble-decode/keymap:safe/.bind 'C-u' 'kill-backward-line' + ble-decode/keymap:safe/.bind 'C-home' 'beginning-of-text' + ble-decode/keymap:safe/.bind 'C-end' 'end-of-text' + ble-decode/keymap:safe/.bind 'C-x (' 'start-keyboard-macro' + ble-decode/keymap:safe/.bind 'C-x )' 'end-keyboard-macro' + ble-decode/keymap:safe/.bind 'C-x e' 'call-keyboard-macro' + ble-decode/keymap:safe/.bind 'C-x P' 'print-keyboard-macro' + ble-decode/keymap:safe/.bind 'C-]' 'character-search-forward' + ble-decode/keymap:safe/.bind 'M-C-]' 'character-search-backward' + ble-decode/keymap:safe/.bind 'M-x' 'execute-named-command' +} +function ble-decode/keymap:safe/bind-history { + ble-decode/keymap:safe/.bind 'C-r' 'history-isearch-backward' + ble-decode/keymap:safe/.bind 'C-s' 'history-isearch-forward' + ble-decode/keymap:safe/.bind 'M-<' 'history-beginning' + ble-decode/keymap:safe/.bind 'M->' 'history-end' + ble-decode/keymap:safe/.bind 'C-prior' 'history-beginning' + ble-decode/keymap:safe/.bind 'C-next' 'history-end' + ble-decode/keymap:safe/.bind 'C-up' 'history-prev' + ble-decode/keymap:safe/.bind 'C-down' 'history-next' + ble-decode/keymap:safe/.bind 'C-p' 'backward-line history' + ble-decode/keymap:safe/.bind 'up' 'backward-line history' + ble-decode/keymap:safe/.bind 'C-n' 'forward-line history' + ble-decode/keymap:safe/.bind 'down' 'forward-line history' + ble-decode/keymap:safe/.bind 'prior' 'history-search-backward' # bash-5.2 + ble-decode/keymap:safe/.bind 'next' 'history-search-forward' # bash-5.2 + ble-decode/keymap:safe/.bind 'C-x C-p' 'history-search-backward' + ble-decode/keymap:safe/.bind 'C-x up' 'history-search-backward' + ble-decode/keymap:safe/.bind 'C-x C-n' 'history-search-forward' + ble-decode/keymap:safe/.bind 'C-x down' 'history-search-forward' + ble-decode/keymap:safe/.bind 'C-x p' 'history-substring-search-backward' + ble-decode/keymap:safe/.bind 'C-x n' 'history-substring-search-forward' + ble-decode/keymap:safe/.bind 'C-x <' 'history-nsearch-backward' + ble-decode/keymap:safe/.bind 'C-x >' 'history-nsearch-forward' + ble-decode/keymap:safe/.bind 'C-x ,' 'history-nsearch-backward-again' + ble-decode/keymap:safe/.bind 'C-x .' 'history-nsearch-forward-again' + ble-decode/keymap:safe/.bind 'M-.' 'insert-last-argument' + ble-decode/keymap:safe/.bind 'M-_' 'insert-last-argument' + ble-decode/keymap:safe/.bind 'M-C-y' 'insert-nth-argument' +} +function ble-decode/keymap:safe/bind-complete { + ble-decode/keymap:safe/.bind 'C-i' 'complete' + ble-decode/keymap:safe/.bind 'TAB' 'complete' + ble-decode/keymap:safe/.bind 'M-?' 'complete show_menu' + ble-decode/keymap:safe/.bind 'M-*' 'complete insert_all' + ble-decode/keymap:safe/.bind 'M-{' 'complete insert_braces' + ble-decode/keymap:safe/.bind 'C-TAB' 'menu-complete' + ble-decode/keymap:safe/.bind 'S-C-i' 'menu-complete backward' + ble-decode/keymap:safe/.bind 'S-TAB' 'menu-complete backward' + ble-decode/keymap:safe/.bind 'ac_enter' 'auto-complete-enter' + ble-decode/keymap:safe/.bind 'M-/' 'complete context=filename' + ble-decode/keymap:safe/.bind 'M-~' 'complete context=username' + ble-decode/keymap:safe/.bind 'M-$' 'complete context=variable' + ble-decode/keymap:safe/.bind 'M-@' 'complete context=hostname' + ble-decode/keymap:safe/.bind 'M-!' 'complete context=command' + ble-decode/keymap:safe/.bind 'C-x /' 'complete show_menu:context=filename' + ble-decode/keymap:safe/.bind 'C-x ~' 'complete show_menu:context=username' + ble-decode/keymap:safe/.bind 'C-x $' 'complete show_menu:context=variable' + ble-decode/keymap:safe/.bind 'C-x @' 'complete show_menu:context=hostname' + ble-decode/keymap:safe/.bind 'C-x !' 'complete show_menu:context=command' + ble-decode/keymap:safe/.bind "M-'" 'sabbrev-expand' + ble-decode/keymap:safe/.bind "C-x '" 'sabbrev-expand' + ble-decode/keymap:safe/.bind 'C-x C-r' 'dabbrev-expand' + ble-decode/keymap:safe/.bind 'M-g' 'complete context=glob' + ble-decode/keymap:safe/.bind 'C-x *' 'complete insert_all:context=glob' + ble-decode/keymap:safe/.bind 'C-x g' 'complete show_menu:context=glob' + ble-decode/keymap:safe/.bind 'M-C-i' 'complete context=dynamic-history' + ble-decode/keymap:safe/.bind 'M-TAB' 'complete context=dynamic-history' +} +function ble-decode/keymap:safe/bind-arg { + local append_arg=append-arg${1:+'-or '}$1 + ble-decode/keymap:safe/.bind M-C-u 'universal-arg' + ble-decode/keymap:safe/.bind M-- "$append_arg" + ble-decode/keymap:safe/.bind M-0 "$append_arg" + ble-decode/keymap:safe/.bind M-1 "$append_arg" + ble-decode/keymap:safe/.bind M-2 "$append_arg" + ble-decode/keymap:safe/.bind M-3 "$append_arg" + ble-decode/keymap:safe/.bind M-4 "$append_arg" + ble-decode/keymap:safe/.bind M-5 "$append_arg" + ble-decode/keymap:safe/.bind M-6 "$append_arg" + ble-decode/keymap:safe/.bind M-7 "$append_arg" + ble-decode/keymap:safe/.bind M-8 "$append_arg" + ble-decode/keymap:safe/.bind M-9 "$append_arg" + ble-decode/keymap:safe/.bind C-- "$append_arg" + ble-decode/keymap:safe/.bind C-0 "$append_arg" + ble-decode/keymap:safe/.bind C-1 "$append_arg" + ble-decode/keymap:safe/.bind C-2 "$append_arg" + ble-decode/keymap:safe/.bind C-3 "$append_arg" + ble-decode/keymap:safe/.bind C-4 "$append_arg" + ble-decode/keymap:safe/.bind C-5 "$append_arg" + ble-decode/keymap:safe/.bind C-6 "$append_arg" + ble-decode/keymap:safe/.bind C-7 "$append_arg" + ble-decode/keymap:safe/.bind C-8 "$append_arg" + ble-decode/keymap:safe/.bind C-9 "$append_arg" + ble-decode/keymap:safe/.bind - "$append_arg" + ble-decode/keymap:safe/.bind 0 "$append_arg" + ble-decode/keymap:safe/.bind 1 "$append_arg" + ble-decode/keymap:safe/.bind 2 "$append_arg" + ble-decode/keymap:safe/.bind 3 "$append_arg" + ble-decode/keymap:safe/.bind 4 "$append_arg" + ble-decode/keymap:safe/.bind 5 "$append_arg" + ble-decode/keymap:safe/.bind 6 "$append_arg" + ble-decode/keymap:safe/.bind 7 "$append_arg" + ble-decode/keymap:safe/.bind 8 "$append_arg" + ble-decode/keymap:safe/.bind 9 "$append_arg" +} +function ble/widget/safe/__attach__ { + ble/edit/info/set-default text '' +} +function ble-decode/keymap:safe/define { + local ble_bind_nometa= + ble-decode/keymap:safe/bind-common + ble-decode/keymap:safe/bind-history + ble-decode/keymap:safe/bind-complete + ble-bind -f 'C-d' 'delete-region-or delete-forward-char-or-exit' + ble-bind -f 'SP' magic-space + ble-bind -f '/' magic-slash + ble-bind -f 'M-^' history-expand-line + ble-bind -f __attach__ safe/__attach__ + ble-bind -f __line_limit__ __line_limit__ + ble-bind -f 'C-c' discard-line + ble-bind -f 'C-j' accept-line + ble-bind -f 'C-RET' accept-line + ble-bind -f 'C-m' accept-single-line-or-newline + ble-bind -f 'RET' accept-single-line-or-newline + ble-bind -f 'C-o' accept-and-next + ble-bind -f 'C-x C-e' edit-and-execute-command + ble-bind -f 'M-#' insert-comment + ble-bind -f 'M-C-e' shell-expand-line + ble-bind -f 'M-&' tilde-expand + ble-bind -f 'C-g' bell + ble-bind -f 'C-x C-g' bell + ble-bind -f 'C-M-g' bell + ble-bind -f 'C-l' clear-screen + ble-bind -f 'C-M-l' redraw-line + ble-bind -f 'f1' command-help + ble-bind -f 'C-x C-v' display-shell-version + ble-bind -c 'C-z' fg + ble-bind -f 'M-z' zap-to-char +} +function ble-edit/bind/load-editing-mode:safe { + ble/decode/keymap#load safe +} +ble/util/autoload "lib/keymap.emacs.sh" \ + ble-decode/keymap:emacs/define +ble/util/autoload "lib/keymap.vi.sh" \ + ble-decode/keymap:vi_{i,n,o,x,s,c}map/define +ble/util/autoload "lib/keymap.vi_digraph.sh" \ + ble-decode/keymap:vi_digraph/define +function ble/widget/.change-editing-mode { + [[ $_ble_decode_bind_state == none ]] && return 0 + local mode=$1 + if [[ $bleopt_default_keymap == auto ]]; then + if [[ ! -o $mode ]]; then + set -o "$mode" + ble/decode/reset-default-keymap + ble/decode/detach + ble/decode/attach || ble-detach + fi + else + bleopt default_keymap="$mode" + fi +} +function ble/widget/emacs-editing-mode { + ble/widget/.change-editing-mode emacs +} +function ble/widget/vi-editing-mode { + ble/widget/.change-editing-mode vi +} +_ble_edit_read_accept= +_ble_edit_read_result= +function ble/widget/read/accept { + if [[ $_ble_edit_async_read_prefix ]]; then + local prefix=$_ble_edit_async_read_prefix + local hook=${prefix}_accept_hook; hook=${!hook} + ble/util/set "${prefix}_accept_hook" '' + ble/util/set "${prefix}_cancel_hook" '' + ble/util/set "${prefix}_before_widget" '' + local ret + ble/edit/async-read-mode/accept + [[ ! $hook ]] || "$hook" "$ret" + else + _ble_edit_read_accept=1 + _ble_edit_read_result=$_ble_edit_str + ble/decode/keymap/pop + fi +} +function ble/widget/read/cancel { + if [[ $_ble_edit_async_read_prefix ]]; then + local hook=${_ble_edit_async_read_prefix}_cancel_hook + ble/util/set "${_ble_edit_async_read_prefix}_accept_hook" "${!hook}" + ble/widget/read/accept + else + ble/widget/read/accept + _ble_edit_read_accept=2 + fi +} +function ble/widget/read/delete-forward-char-or-cancel { + if [[ $_ble_edit_str ]]; then + ble/widget/delete-forward-char + else + ble/widget/read/cancel + fi +} +function ble/widget/read/__line_limit__.edit { + local content=$1 + ble/widget/edit-and-execute-command.edit "$content" no-newline; local ext=$? + ((ext==127)) && return "$ext" + ble-edit/content/reset "$ret" + ble/widget/read/accept +} +function ble/widget/read/__line_limit__ { + ble/widget/__line_limit__ read/__line_limit__.edit +} +function ble/widget/read/__before_widget__ { + if [[ $_ble_edit_async_read_prefix ]]; then + local hook=${_ble_edit_async_read_prefix}_before_widget + builtin eval -- "${!hook}" + fi +} +function ble-decode/keymap:read/define { + local ble_bind_nometa= + ble-decode/keymap:safe/bind-common + ble-decode/keymap:safe/bind-history + ble-bind -f __before_widget__ read/__before_widget__ + ble-bind -f __line_limit__ read/__line_limit__ + ble-bind -f 'C-c' read/cancel + ble-bind -f 'C-\' read/cancel + ble-bind -f 'C-m' read/accept + ble-bind -f 'RET' read/accept + ble-bind -f 'C-j' read/accept + ble-bind -f 'C-d' 'delete-region-or read/delete-forward-char-or-cancel' + ble-bind -f 'C-g' bell + ble-bind -f 'C-l' redraw-line + ble-bind -f 'C-M-l' redraw-line + ble-bind -f 'C-x C-v' display-shell-version + ble-bind -f 'C-^' bell +} +_ble_edit_read_history=() +_ble_edit_read_history_edit=() +_ble_edit_read_history_dirt=() +_ble_edit_read_history_index=0 +function ble/builtin/read/.process-option { + case $1 in + (-e) opt_flags=${opt_flags}r ;; + (-i) opt_default=$2 ;; + (-p) opt_prompt=$2 ;; + (-u) opt_fd=$2 + ble/array#push opts_in "$@" ;; + (-t) opt_timeout=$2 ;; + (*) ble/array#push opts "$@" ;; + esac +} +function ble/builtin/read/.read-arguments { + local is_normal_args= + vars=() + opts=() + while (($#)); do + local arg=$1; shift + if [[ $is_normal_args || $arg != -* ]]; then + ble/array#push vars "$arg" + elif [[ $arg == -- ]]; then + is_normal_args=1 + elif [[ $arg == --* ]]; then + case $arg in + (--help) + opt_flags=${opt_flags}H ;; + (*) + ble/util/print "read: unrecognized long option '$arg'" >&2 + opt_flags=${opt_flags}E ;; + esac + else + local i n=${#arg} c + for ((i=1;i&2 + opt_flags=${opt_flags}E + fi + break ;; + ([adinNptu]*) ble/builtin/read/.process-option -$c "${arg:i+1}"; break ;; + ([ers]*) ble/builtin/read/.process-option -$c ;; + (*) + ble/util/print "read: unrecognized option '-$c'" >&2 + opt_flags=${opt_flags}E ;; + esac + done + fi + done +} +function ble/builtin/read/.set-up-textarea { + ble/decode/keymap/push read || return 1 + [[ $_ble_edit_read_context == external ]] && + _ble_canvas_panel_height[0]=0 + if ble/edit/is-command-layout; then + _ble_textarea_panel=0 + else + _ble_textarea_panel=1 + fi + _ble_canvas_panel_focus=$_ble_textarea_panel + ble/textarea#invalidate + ble/edit/info/set-default ansi '' + _ble_edit_PS1=$opt_prompt + _ble_prompt_ps1_data=(0 '' '' 0 0 0 32 0 "" "") + _ble_edit_dirty_observer=() + ble/widget/.newline/clear-content + _ble_edit_arg= + ble-edit/content/reset "$opt_default" newline + _ble_edit_ind=${#opt_default} + ble-edit/undo/clear-all + ble/history/set-prefix _ble_edit_read_ + _ble_syntax_lang=text + _ble_edit_dirty_syntax_end0=1 # force ble/syntax/parse + _ble_highlight_layer_list=(plain region overwrite_mode disabled) + return 0 +} +function ble/builtin/read/TRAPWINCH { + local IFS=$_ble_term_IFS + ble/application/onwinch +} +function ble/builtin/read/.loop { + set +m # ジョブ管理を無効にする + shopt -u failglob + _ble_edit_async_read_prefix= + local ret; ble/canvas/panel/save-position; local pos0=$ret + ble/builtin/read/.set-up-textarea || return 1 + ble/builtin/trap/install-hook WINCH readline + blehook internal_WINCH=ble/builtin/read/TRAPWINCH + local ret= timeout= + if [[ $opt_timeout ]]; then + ble/util/clock; local start_time=$ret + ((start_time&&(start_time-=_ble_util_clock_reso-1))) + if [[ $opt_timeout == *.* ]]; then + local mantissa=${opt_timeout%%.*} + local fraction=${opt_timeout##*.}000 + ((timeout=mantissa*1000+10#0${fraction::3})) + else + ((timeout=opt_timeout*1000)) + fi + ((timeout<0)) && timeout= + fi + ble/application/render + local _ble_decode_input_count=0 + local ble_decode_char_nest= + local -a _ble_decode_char_buffer=() + local char= + local _ble_edit_read_accept= + local _ble_edit_read_result= + while [[ ! $_ble_edit_read_accept ]]; do + local timeout_option= + if [[ $timeout ]]; then + if ((_ble_bash>=40000)); then + local timeout_frac=000$((timeout%1000)) + timeout_option="-t $((timeout/1000)).${timeout_frac:${#timeout_frac}-3}" + else + timeout_option="-t $((timeout/1000))" + fi + fi + IFS= ble/bash/read -d '' -n 1 $timeout_option char "${opts_in[@]}"; local ext=$? + if ((ext>128)); then + _ble_edit_read_accept=142 + break + fi + if [[ $timeout ]]; then + ble/util/clock; local current_time=$ret + ((timeout-=current_time-start_time)) + if ((timeout<=0)); then + _ble_edit_read_accept=142 + break + fi + start_time=$current_time + fi + ble/util/s2c "$char" + ble-decode-char "$ret" + [[ $_ble_edit_read_accept ]] && break + ble/util/is-stdin-ready 0 && continue + ble-edit/content/check-limit + ble-decode/.hook/erase-progress + ble/application/render + done + if [[ $_ble_edit_read_context == internal ]]; then + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$_ble_textarea_panel" 0 + ble/canvas/panel/load-position.draw "$pos0" + ble/canvas/bflush.draw + else + if ((_ble_edit_read_accept==1)); then + ble/edit/.relocate-textarea # #D1800 (既に外部状態なのでOK) + else + _ble_edit_line_disabled=1 ble/edit/.relocate-textarea # #D1800 (既に外部状態なのでOK) + fi + fi + ble/util/buffer.flush + ble/term/visible-bell/erase + if ((_ble_edit_read_accept==1)); then + local q=\' Q="'\''" + printf %s "__ble_input='${_ble_edit_read_result//$q/$Q}'" + elif ((_ble_edit_read_accept==142)); then + return "$ext" + else + return 1 + fi +} +function ble/builtin/read/.impl { + local -a opts=() vars=() opts_in=() + local opt_flags= opt_prompt= opt_default= opt_timeout= opt_fd=0 + local rex1='^[0-9]+(\.[0-9]*)?$|^\.[0-9]+$' rex2='^[0.]+$' + [[ $TMOUT =~ $rex1 && ! ( $TMOUT =~ $rex2 ) ]] && opt_timeout=$TMOUT + ble/builtin/read/.read-arguments "$@" + if [[ $opt_flags == *[HE]* ]]; then + if [[ $opt_flags == *H* ]]; then + builtin read --help + elif [[ $opt_flags == *E* ]]; then + builtin read --usage 2>&1 1>/dev/null | ble/bin/grep ^read >&2 + fi + return 2 + fi + if ! [[ $opt_flags == *r* && -t $opt_fd ]]; then + [[ $opt_prompt ]] && ble/array#push opts -p "$opt_prompt" + [[ $opt_timeout ]] && ble/array#push opts -t "$opt_timeout" + __ble_args=("${opts[@]}" "${opts_in[@]}" -- "${vars[@]}") + __ble_command='ble/bash/read "${__ble_args[@]}"' + return 0 + fi + ble/decode/keymap#load read + local result _ble_edit_read_context=$_ble_term_state + ble/util/buffer.flush + [[ $_ble_edit_read_context == external ]] && ble/term/enter # 外側にいたら入る + result=$(ble/builtin/read/.loop); local ext=$? + [[ $_ble_edit_read_context == external ]] && ble/term/leave # 元の状態に戻る + [[ $_ble_edit_read_context == internal ]] && ((_ble_canvas_panel_height[1]=0)) + if ((ext==0)); then + builtin eval -- "$result" + __ble_args=("${opts[@]}" -- "${vars[@]}") + __ble_command='ble/bash/read "${__ble_args[@]}" <<< "$__ble_input"' + fi + return "$ext" +} +function ble/builtin/read { + if [[ $_ble_decode_bind_state == none ]]; then + builtin read "$@" + return "$?" + fi + local _ble_local_set _ble_local_shopt + ble/base/.adjust-bash-options _ble_local_set _ble_local_shopt + [[ $_ble_builtin_read_hook ]] && + builtin eval -- "$_ble_builtin_read_hook" + local __ble_command= __ble_args= __ble_input= + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && ble/base/adjust-BASH_REMATCH + ble/builtin/read/.impl "$@"; local __ble_ext=$? + [[ ! $_ble_attached || $_ble_edit_exec_inside_userspace ]] && ble/base/restore-BASH_REMATCH + ble/base/.restore-bash-options _ble_local_set _ble_local_shopt + [[ $__ble_command ]] || return "$__ble_ext" + builtin eval -- "$__ble_command" +} +function read { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/builtin/read "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +_ble_edit_async_read_prefix= +_ble_edit_async_read_accept_hook= +_ble_edit_async_read_cancel_hook= +_ble_edit_async_read_before_widget= +_ble_edit_async_read_history=() +_ble_edit_async_read_history_edit=() +_ble_edit_async_read_history_dirt=() +_ble_edit_async_read_history_index=0 +function ble/edit/async-read-mode { + local hook=$1 prefix=${2:-_ble_edit_async_read} keymap=${3:-read} + ble/util/assert '[[ ! $_ble_edit_async_read_prefix ]]' 'it is already inside the async-read mode.' || return 1 + _ble_edit_async_read_prefix=$prefix + ble/util/set "${prefix}_accept_hook" "$hook" + ble/util/set "${prefix}_cancel_hook" '' + if ((_ble_textarea_panel==0)); then + ble/textarea#render + else + ble/textarea#invalidate + fi + ble/textarea#save-state "$prefix" + ble/util/save-vars "$prefix" _ble_canvas_panel_focus + ble/util/set "${prefix}_history_prefix" "$_ble_history_prefix" + ble/decode/keymap/push "$keymap" + ble/edit/info/default text '' + _ble_textarea_panel=1 + _ble_canvas_panel_focus=1 + ble/textarea#invalidate + _ble_edit_PS1=$PS2 + _ble_prompt_ps1_data=(0 '' '' 0 0 0 32 0 '' '') + _ble_edit_dirty_observer=() + ble/widget/.newline/clear-content + _ble_edit_arg= + ble-edit/undo/clear-all + ble/history/set-prefix "$prefix" + _ble_syntax_lang=text + _ble_edit_dirty_syntax_end0=1 # force ble/syntax/parse + _ble_highlight_layer_list=(plain region overwrite_mode) + return 147 +} +function ble/edit/async-read-mode/accept { + local prefix=$_ble_edit_async_read_prefix + ble/util/assert '[[ $prefix ]]' 'it is not inside the async-read mode.' || return 1 + ret=$_ble_edit_str + [[ $ret ]] && ble/history/add "$ret" # Note: cancel でも登録する + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$_ble_textarea_panel" 0 + ble/canvas/bflush.draw + ble/textarea#restore-state "$prefix" + ble/textarea#clear-state "$prefix" + ble/util/restore-vars "$prefix" _ble_canvas_panel_focus + [[ $_ble_edit_overwrite_mode ]] && ble/util/buffer "$_ble_term_civis" + local old_history_prefix_ref=${prefix}_history_prefix + ble/history/set-prefix "${!old_history_prefix_ref}" + ble/decode/keymap/pop + _ble_edit_async_read_prefix= +} +_ble_edit_async_read_is_cancel_key[63|_ble_decode_Ctrl]=1 # C-? +_ble_edit_async_read_is_cancel_key[127]=1 # DEL +_ble_edit_async_read_is_cancel_key[104|_ble_decode_Ctrl]=1 # C-h +_ble_edit_async_read_is_cancel_key[8]=1 # BS +function ble/edit/async-read-mode/empty-cancel.hook { + if [[ ! $_ble_edit_str ]] && ((_ble_edit_async_read_is_cancel_key[KEYS[0]])); then + ble/widget/read/cancel + ble/decode/widget/suppress-widget + fi +} +function ble/widget/command-help/.read-man { + local -x _ble_local_tmpfile; ble/util/assign/mktmp + local pager="sh -c 'cat >| \"\$_ble_local_tmpfile\"'" + MANPAGER=$pager PAGER=$pager MANOPT= man "$@" 2>/dev/null; local ext=$? # 668ms + ble/util/readfile man_content "$_ble_local_tmpfile" # 80ms + ble/util/assign/rmtmp + return "$ext" +} +function ble/widget/command-help/.locate-in-man-bash { + local command=$1 + local ret rex + local pager; ble/util/get-pager pager + local pager_cmd=${pager%%["$_ble_term_IFS"]*} + [[ ${pager_cmd##*/} == less ]] || return 1 + local awk=ble/bin/awk; ble/bin#has gawk && awk=gawk + local man_content; ble/widget/command-help/.read-man bash || return 1 # 733ms (3 fork: man, sh, cat) + local cmd_awk + case $command in + ('function') cmd_awk='name () compound-command' ;; + ('until') cmd_awk=while ;; + ('command') cmd_awk='command [' ;; + ('source') cmd_awk=. ;; + ('typeset') cmd_awk=declare ;; + ('readarray') cmd_awk=mapfile ;; + ('[') cmd_awk=test ;; + (*) cmd_awk=$command ;; + esac + ble/string#escape-for-awk-regex "$cmd_awk"; local rex_awk=$ret + rex='\b$'; [[ $awk == gawk && $cmd_awk =~ $rex ]] && rex_awk=$rex_awk'\y' + local LC_ALL= LC_COLLATE=C 2>/dev/null + local rex_esc=$'(\e\\[[ -?]*[@-~]||.\b)' cr=$'\r' # disable=#D1440 + local awk_script='{ + gsub(/'"$rex_esc"'/, ""); + if (!par && $0 ~ /^['"$_ble_term_blank"']*'"$rex_awk"'/) { print NR; exit; } + par = !($0 ~ /^['"$_ble_term_blank"']*$/); + }' + local awk_out; ble/util/assign awk_out '"$awk" "$awk_script" 2>/dev/null <<< "$man_content"' || return 1 # 206ms (1 fork) + local iline=${awk_out%$'\n'}; [[ $iline ]] || return 1 + ble/string#escape-for-extended-regex "$command"; local rex_ext=$ret + rex='\b$'; [[ $command =~ $rex ]] && rex_ext=$rex_ext'\b' + rex='^\b'; [[ $command =~ $rex ]] && rex_ext="($rex_esc|\b)$rex_ext" + local manpager="$pager -r +'/$rex_ext$cr$((iline-1))g'" + builtin eval -- "$manpager" <<< "$man_content"; local ext=$? # 1 fork + ble/util/unlocal LC_COLLATE LC_ALL 2>/dev/null + return "$ext" +} +function ble/widget/command-help/.show-bash-script { + local _ble_local_pipeline=$1 + local -x LESS="${LESS:+$LESS }-r" # Note: Bash のバグで tempenv builtin eval は消滅するので #D1438 + ble/bin#has source-highlight && + _ble_local_pipeline='source-highlight -s sh -f esc | '$_ble_local_pipeline + builtin eval -- "$_ble_local_pipeline" +} +function ble/widget/command-help/.locate-function-in-source { + local func=$1 source lineno line + ble/function#get-source-and-lineno "$func" || return 1 + [[ -f $source && -s $source ]] || return 1 # pipe 等は読み取らない + local pager; ble/util/get-pager pager + local pager_cmd=${pager%%["$_ble_term_IFS"]*} + [[ ${pager_cmd##*/} == less ]] || return 1 + ble/util/assign line 'ble/bin/sed -n "${lineno}{p;q;}" "$source"' + [[ $line == *"$func"* ]] || return 1 + ble/widget/command-help/.show-bash-script '"$pager" +"${lineno}g"' < "$source" +} +function ble/widget/command-help.core { + ble/function#try ble/cmdinfo/help:"$command" && return 0 + ble/function#try ble/cmdinfo/help "$command" && return 0 + if [[ $type == builtin || $type == keyword ]]; then + ble/widget/command-help/.locate-in-man-bash "$command" && return 0 + elif [[ $type == function ]]; then + ble/widget/command-help/.locate-function-in-source "$command" && return 0 + local def; ble/function#getdef "$command" + ble/widget/command-help/.show-bash-script ble/util/pager <<< "$def" && return 0 + fi + if ble/is-function ble/bin/man; then + MANOPT= ble/bin/man "${command##*/}" 2>/dev/null && return 0 + fi + if local content; ble/util/assign content '"$command" --help 2>&1' && [[ $content ]]; then + ble/util/print "$content" | ble/util/pager + return 0 + fi + ble/util/print "ble: help of \`$command' not found" >&2 + return 1 +} +function ble/widget/command-help/.type/.resolve-alias { + local literal=$1 command=$2 type=alias + local last_literal=$1 last_command=$2 + while + [[ $command == "$literal" ]] || break # Note: type=alias + local alias_def + ble/util/assign alias_def "alias $command" + builtin unalias "$command" + builtin eval "alias_def=${alias_def#*=}" # remove quote + literal=${alias_def%%["$_ble_term_IFS"]*} command= type= + local ret; ble/syntax:bash/simple-word/safe-eval "$literal" nonull || break # Note: type= + command=$ret + ble/util/type type "$command" + [[ $type ]] || break # Note: type= + last_literal=$literal + last_command=$command + [[ $type == alias ]] + do ((1)); done + if [[ ! $type || $type == alias ]]; then + literal=$last_literal + command=$last_command + builtin unalias "$command" &>/dev/null + ble/util/type type "$command" + fi + local q="'" Q="'\''" + printf "type='%s'\n" "${type//$q/$Q}" + printf "literal='%s'\n" "${literal//$q/$Q}" + printf "command='%s'\n" "${command//$q/$Q}" + return 0 +} 2>/dev/null +function ble/widget/command-help/.type { + local literal=$1 + type= command= + local ret; ble/syntax:bash/simple-word/safe-eval "$literal" nonull || return 1; command=$ret + ble/util/type type "$command" + if [[ $type == alias ]]; then + builtin eval -- "$(ble/widget/command-help/.type/.resolve-alias "$literal" "$command")" # subshell + fi + if [[ $type == keyword && $command != "$literal" ]]; then + if [[ $command == %* ]] && jobs -- "$command" &>/dev/null; then + type=jobs + else + type=${type[1]} + [[ $type ]] || return 1 + fi + fi +} +function ble/widget/command-help.impl { + local literal=$1 + if [[ ! $literal ]]; then + ble/widget/.bell + return 1 + fi + local type command; ble/widget/command-help/.type "$literal" + if [[ ! $type ]]; then + ble/widget/.bell "command \`$command' not found" + return 1 + fi + ble/widget/external-command ble/widget/command-help.core +} +function ble/widget/command-help { + ble-edit/content/clear-arg + local comp_cword comp_words comp_line comp_point + if ble/syntax:bash/extract-command "$_ble_edit_ind"; then + local cmd=${comp_words[0]} + else + local args; ble/string#split-words args "$_ble_edit_str" + local cmd=${args[0]} + fi + ble/widget/command-help.impl "$cmd" +} +function ble-edit/bind/stdout.on { return 0; } +function ble-edit/bind/stdout.off { ble/util/buffer.flush; } +function ble-edit/bind/stdout.finalize { return 0; } +if [[ $bleopt_internal_suppress_bash_output ]]; then + _ble_edit_io_fname2=$_ble_base_run/$$.stderr + function ble-edit/bind/stdout.on { + exec 2>&"$_ble_util_fd_tui_stderr" + } + function ble-edit/bind/stdout.off { + ble/util/buffer.flush + ble-edit/io/check-stderr + exec 2>>"$_ble_edit_io_fname2" + } + function ble-edit/bind/stdout.finalize { + ble-edit/bind/stdout.on + [[ -f $_ble_edit_io_fname2 ]] && >| "$_ble_edit_io_fname2" + } + function ble-edit/io/check-stderr { + local file=${1:-$_ble_edit_io_fname2} + if ble/is-function ble/term/visible-bell; then + if [[ -f $file && -s $file ]]; then + local message= line + while IFS= ble/bash/read line || [[ $line ]]; do + if [[ $line == 'bash: '* || $line == "${BASH##*/}: "* || $line == "ble.sh ("*"): "* ]]; then + message="$message${message:+; }$line" + fi + done < "$file" + [[ $message ]] && ble/term/visible-bell "$message" + >| "$file" + fi + fi + } + if ((_ble_bash<40000)); then + function ble-edit/io/TRAPUSR1 { + [[ $_ble_term_state == internal ]] || return 1 + _ble_decode_bind__uvwflag= + ble/decode/readline/adjust-uvw + local FUNCNEST= + local IFS=$_ble_term_IFS + local file=$_ble_edit_io_fname2.proc + if [[ -s $file ]]; then + local content cmd processed_eof=1 + ble/util/readfile content "$file" + >| "$file" + ble/string#split-words content "$content" + for cmd in "${content[@]}"; do + case $cmd in + (eof) + _ble_decode_hook 4 + builtin eval -- "$_ble_decode_bind_hook" + processed_eof=1 ;; + esac + done + if [[ $processed_eof ]]; then + return 126 + fi + fi + } + blehook/declare internal_USR1 + blehook internal_USR1!=ble-edit/io/TRAPUSR1 + ble/builtin/trap/install-hook USR1 + function ble-edit/io/check-ignoreeof-message { + local line=$1 + [[ ( $bleopt_internal_ignoreeof_trap && $line == *$bleopt_internal_ignoreeof_trap* ) || + $line == *'Use "exit" to leave the shell.'* || + $line == *'ログアウトする為には exit を入力して下さい'* || + $line == *'シェルから脱出するには "exit" を使用してください。'* || + $line == *'シェルから脱出するのに "exit" を使いなさい.'* || + $line == *'Gebruik Kaart na Los Tronk'* ]] && return 0 + [[ $line == *exit* ]] && ble/bin/grep -q -F "$line" "$_ble_base"/lib/core-edit.ignoreeof-messages.txt + } + function ble-edit/io/check-ignoreeof-loop { + local line opts=:$1: + while IFS= ble/bash/read line; do + if [[ $line == *[^$_ble_term_IFS]* ]]; then + ble/util/print "$line" >> "$_ble_edit_io_fname2" + fi + if ble-edit/io/check-ignoreeof-message "$line"; then + ble/util/print eof >> "$_ble_edit_io_fname2.proc" + kill -USR1 $$ + ble/util/msleep 100 # 連続で送ると bash が落ちるかも (落ちた事はないが念の為) + fi + done + } &>/dev/null + ble/bin/rm -f "$_ble_edit_io_fname2.pipe" + if ble/bin/mkfifo "$_ble_edit_io_fname2.pipe" 2>/dev/null; then + { + ble-edit/io/check-ignoreeof-loop fifo < "$_ble_edit_io_fname2.pipe" & disown + } &>/dev/null + ble/fd#alloc _ble_edit_io_fd2 '> "$_ble_edit_io_fname2.pipe"' + function ble-edit/bind/stdout.off { + ble/util/buffer.flush + ble-edit/io/check-stderr + exec 2>&"$_ble_edit_io_fd2" + } + elif . "$_ble_base/lib/init-msys1.sh"; ble-edit/io:msys1/start-background; then + function ble-edit/bind/stdout.off { + ble/util/buffer.flush + ble-edit/io/check-stderr + exec 2>/dev/null + exec 2>>"$_ble_edit_io_fname2.buff" + } + fi + fi +fi +[[ ${_ble_edit_detach_flag-} != reload ]] && + _ble_edit_detach_flag= +function ble-edit/bind/.exit-TRAPRTMAX { + local FUNCNEST= + ble/base/unload + builtin exit 0 +} +function ble-edit/bind/.check-detach { + if [[ ! -o emacs && ! -o vi ]]; then + local ret + ble/edit/marker#instantiate 'unsupported' error:non-empty + ble/util/print "$ret Sorry, ble.sh is supported only with some editing mode (set -o emacs/vi)." >&2 + ble-detach + fi + [[ $_ble_edit_detach_flag == prompt-attach ]] && return 1 + if [[ $_ble_edit_detach_flag || ! $_ble_attached ]]; then + type=$_ble_edit_detach_flag + _ble_edit_detach_flag= + local attached=$_ble_attached + [[ $attached ]] && ble-detach/impl + if [[ $type == exit ]]; then + local ret + ble/edit/marker#instantiate-config exec_exit_mark && + ble-detach/message "$ret" + builtin trap 'ble-edit/bind/.exit-TRAPRTMAX' RTMAX + kill -RTMAX $$ + else + local ret + ble/edit/marker#instantiate 'detached' non-empty + ble-detach/message \ + ${ret+"$ret"} \ + "Please run \`stty sane' to recover the correct TTY state." + if ((_ble_bash>=40000)); then + READLINE_LINE=' stty sane;' READLINE_POINT=11 READLINE_MARK=0 + printf %s "$READLINE_LINE" + fi + fi + if [[ $attached ]]; then + ble/base/restore-BASH_REMATCH + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" # これ以降関数は呼び出せない + else + ble-edit/exec:"$bleopt_internal_exec_type"/.prologue + _ble_edit_exec_inside_prologue= + fi + return 0 + else + local state=$_ble_decode_bind_state + if [[ ( $state == emacs || $state == vi ) && ! -o $state ]]; then + ble/decode/reset-default-keymap + ble/decode/detach + if ! ble/decode/attach; then + ble-detach + ble-edit/bind/.check-detach # 改めて終了処理 + return "$?" + fi + fi + return 1 + fi +} +if ((_ble_bash>=40100)); then + function ble-edit/bind/.head/adjust-bash-rendering { + ble/textarea#redraw-cache + ble/util/buffer.flush + } +else + function ble-edit/bind/.head/adjust-bash-rendering { + ((_ble_canvas_y++,_ble_canvas_x=0)) + local -a DRAW_BUFF=() + ble/canvas/panel#goto.draw "$_ble_textarea_panel" "${_ble_textarea_cur[0]}" "${_ble_textarea_cur[1]}" + ble/canvas/flush.draw + } +fi +function ble-edit/bind/.head { + ble-edit/bind/stdout.on + ble/base/recover-bash-options + [[ $bleopt_internal_suppress_bash_output ]] || + ble-edit/bind/.head/adjust-bash-rendering +} +function ble-edit/bind/.tail-without-draw { + ble-edit/bind/stdout.off +} +if ((_ble_bash>=40000)); then + function ble-edit/bind/.tail { + ble/application/render + ble/util/idle.do + ble/textarea#adjust-for-bash-bind # bash-4.0+ + ble-edit/bind/stdout.off + } +else + function ble-edit/bind/.tail { + ble/application/render + ble/util/idle.do + ble-edit/bind/stdout.off + } +fi +function ble-decode/PROLOGUE { + ble-edit/exec:gexec/restore-state + ble-edit/bind/.head + ble/decode/readline/adjust-uvw + ble/term/enter +} +function ble-decode/EPILOGUE { + if ((_ble_bash>=40000)); then + if ble/decode/has-input && ! ble-edit/exec/has-pending-commands; then + ble-edit/bind/.tail-without-draw + return 0 + fi + fi + ble-edit/content/check-limit + ble-edit/exec:"$bleopt_internal_exec_type"/process && return 0 + ble-edit/bind/.tail + return 0 +} +function ble/widget/.internal-print-command { + local _ble_local_command=$1 _ble_command_opts=$2 + _ble_edit_line_disabled=1 ble/edit/.relocate-textarea # #D1800 pair=leave-command-layout + [[ :$_ble_command_opts: != *:pre-flush:* ]] || ble/util/buffer.flush + BASH_COMMAND=$_ble_local_command builtin eval -- "$_ble_local_command" + ble/edit/leave-command-layout # #D1800 pair=ble/edit/.relocate-textarea + [[ :$_ble_command_opts: != *:post-flush:* ]] || ble/util/buffer.flush +} +function ble/widget/print { + ble-edit/content/clear-arg + local message="$*" lines + [[ ${message//["$_ble_term_IFS"]} ]] || return 1 + lines=("$@") + if [[ ! ${_ble_attached-} || ${_ble_edit_exec_inside_begin-} ]]; then + ble/util/print-lines "${lines[@]}" + else + ble/widget/.internal-print-command ' + ble/util/buffer.print-lines "${lines[@]}" + ble/util/buffer.flush' pre-flush + fi +} +function ble/widget/internal-command { + ble-edit/content/clear-arg + local command=$1 + [[ ${command//[$_ble_term_IFS]} ]] || return 1 + ble/widget/.internal-print-command "$command" +} +function ble/widget/external-command { + ble-edit/content/clear-arg + local _ble_local_command=$1 + [[ ${_ble_local_command//[$_ble_term_IFS]} ]] || return 1 + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + ble/textarea#invalidate + local -a DRAW_BUFF=() + ble/canvas/panel#set-height.draw "$_ble_textarea_panel" 0 + ble/canvas/panel#goto.draw "$_ble_textarea_panel" 0 0 sgr0 + ble/canvas/bflush.draw + ble/term/leave + ble/util/buffer.flush + BASH_COMMAND=$_ble_local_command builtin eval -- "$_ble_local_command"; local ext=$? + ble/term/enter + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout + return "$ext" +} +function ble/widget/execute-command { + ble-edit/content/clear-arg + local command=$1 + if [[ $command != *[!"$_ble_term_IFS"]* ]]; then + _ble_edit_line_disabled=1 ble/edit/.relocate-textarea keep-info + return 1 + fi + _ble_edit_line_disabled=1 ble/edit/.relocate-textarea # #D1800 pair=exec/register + ble-edit/exec/register "$command" +} +function ble/widget/.SHELL_COMMAND { ble/widget/execute-command "$@"; } +function ble/widget/.EDIT_COMMAND { + local command=$1 + local -x READLINE_LINE=$_ble_edit_str + local -x READLINE_POINT=$_ble_edit_ind + local -x READLINE_MARK=$_ble_edit_mark + [[ $_ble_edit_arg ]] && + local -x READLINE_ARGUMENT=$_ble_edit_arg + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + ble/widget/.hide-current-line keep-header + ble-edit/restore-PS1 + ble/term/leave-for-widget + builtin eval -- "$command"; local ext=$? + ble/term/enter-for-widget + ble-edit/adjust-PS1 + ble-edit/content/clear-arg + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout + [[ $READLINE_LINE != "$_ble_edit_str" ]] && + ble-edit/content/reset-and-check-dirty "$READLINE_LINE" + ((_ble_edit_ind=READLINE_POINT)) + ((_ble_edit_mark=READLINE_MARK)) + local N=${#_ble_edit_str} + ((_ble_edit_ind<0?_ble_edit_ind=0:(_ble_edit_ind>N&&(_ble_edit_ind=N)))) + ((_ble_edit_mark<0?_ble_edit_mark=0:(_ble_edit_mark>N&&(_ble_edit_mark=N)))) + if [[ $_ble_decode_keymap == vi_nmap ]]; then + if [[ $KEYMAP == vi_nmap ]]; then + ble/keymap:vi/adjust-command-mode + else + ble/keymap:vi/needs-eol-fix && ((_ble_edit_ind--)) + fi + fi + return "$ext" +} +function ble-decode/INITIALIZE_DEFMAP { + local ret + bleopt/get:default_keymap; local defmap=$ret + if ble-edit/bind/load-editing-mode "$defmap"; then + local base_keymap=$defmap + [[ $defmap == vi ]] && base_keymap=vi_imap + builtin eval -- "$2=\$base_keymap" + ble/decode/is-keymap "$base_keymap" && return 0 + fi + ble/edit/marker#instantiate "The definition of the default keymap \"$defmap\" is not found. ble.sh uses \"safe\" keymap instead." error + local msg=$ret + ble/edit/enter-command-layout # #D1800 pair=leave-command-layout + ble/widget/.hide-current-line + local -a DRAW_BUFF=() + ble/canvas/put.draw "$_ble_term_cr$_ble_term_el$msg$_ble_term_nl" + ble/canvas/bflush.draw + ble/util/buffer.flush + ble/edit/leave-command-layout # #D1800 pair=enter-command-layout + ble-edit/bind/load-editing-mode safe && + ble/decode/keymap#load safe && + builtin eval -- "$2=safe" && + bleopt_default_keymap=safe +} +function ble-edit/bind/load-editing-mode { + local name=$1 + if ble/is-function ble-edit/bind/load-editing-mode:"$name"; then + ble-edit/bind/load-editing-mode:"$name" + else + ble/util/import "$_ble_base/lib/keymap.$name.sh" + fi +} +function ble-edit/bind/clear-keymap-definition-loader { + builtin unset -f ble-edit/bind/load-editing-mode:safe + builtin unset -f ble-edit/bind/load-editing-mode:emacs + builtin unset -f ble-edit/bind/load-editing-mode:vi +} +function ble-edit/initialize { + ble/prompt/initialize +} +function ble-edit/attach { + _ble_builtin_trap_DEBUG__initialize + [[ $_ble_builtin_trap_DEBUG_userTrapInitialized ]] && + _ble_edit_exec_gexec__TRAPDEBUG_adjust + ble-edit/attach/.attach + _ble_canvas_x=0 _ble_canvas_y=0 + ble/util/buffer "$_ble_term_cr" +} +function ble-edit/detach { + ble-edit/bind/stdout.finalize + ble-edit/attach/.detach + ble-edit/exec:gexec/.TRAPDEBUG/restore +} +ble/function#trace ble-edit/attach +function ble/util/message/handler:edit/append-line { + local data=${1%$'\n'}; data=${data#$'\n'} + [[ ${_ble_edit_str##*$'\n'} ]] && data=$'\n'$data + local len=${#_ble_edit_str} + ble-edit/content/replace-limited "$len" "$len" "$data" nobell + _ble_edit_ind=${#_ble_edit_str} + return 0 +} +function ble-append-line { + local data="${*-}" + [[ $data ]] || return 0 + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/util/message.post "$$" precmd edit/append-line "$data" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} +function ble/cmdspec/initialize { ble-import "$_ble_base/lib/core-cmdspec.sh"; } +ble/is-function ble/util/idle.push && ble-import -d "$_ble_base/lib/core-cmdspec.sh" +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_cmdspec_opts}" +function ble/cmdspec/opts { + local spec=$1 command; shift + for command; do + local spec1=$spec + if [[ $spec1 == +* ]]; then + local ret= + ble/gdict#get _ble_cmdspec_opts "$command" "$spec1" + spec1=${ret:+$ret:}${spec1:1} + fi + ble/gdict#set _ble_cmdspec_opts "$command" "$spec1" + done +} +function ble/cmdspec/opts#load { + cmdspec_opts=$2 + local ret= + if ble/gdict#get _ble_cmdspec_opts "$1" || + { [[ $1 == */*[!/] ]] && ble/gdict#get _ble_cmdspec_opts "${1##*/}"; } + then + cmdspec_opts=$ret + fi +} +_ble_syntax_VARNAMES=( + _ble_syntax_text + _ble_syntax_lang + _ble_syntax_stat + _ble_syntax_nest + _ble_syntax_tree + _ble_syntax_attr + _ble_syntax_attr_umin + _ble_syntax_attr_umax + _ble_syntax_word_umin + _ble_syntax_word_umax + _ble_syntax_vanishing_word_umin + _ble_syntax_vanishing_word_umax + _ble_syntax_dbeg + _ble_syntax_dend) +_ble_syntax_lang=bash +function ble/syntax/initialize-vars { + _ble_syntax_text= + _ble_syntax_lang=bash + _ble_syntax_stat=() + _ble_syntax_nest=() + _ble_syntax_tree=() + _ble_syntax_attr=() + _ble_syntax_attr_umin=-1 _ble_syntax_attr_umax=-1 + _ble_syntax_word_umin=-1 _ble_syntax_word_umax=-1 + _ble_syntax_vanishing_word_umin=-1 + _ble_syntax_vanishing_word_umax=-1 + _ble_syntax_dbeg=-1 _ble_syntax_dend=-1 +} +function ble/highlight/layer:syntax/update { return 0; } +function ble/highlight/layer:syntax/getg { return 0; } +function ble/syntax:bash/is-complete { return 0; } +ble/util/autoload "$_ble_base/lib/core-syntax.sh" \ + ble/syntax/parse \ + ble/syntax/highlight \ + ble/syntax/tree-enumerate \ + ble/syntax/tree-enumerate-children \ + ble/syntax/completion-context/generate \ + ble/syntax/highlight/cmdtype \ + ble/syntax/highlight/cmdtype1 \ + ble/syntax/highlight/filetype \ + ble/syntax/highlight/getg-from-filename \ + ble/syntax:bash/extract-command \ + ble/syntax:bash/simple-word/eval \ + ble/syntax:bash/simple-word/evaluate-path-spec \ + ble/syntax:bash/simple-word/is-never-word \ + ble/syntax:bash/simple-word/is-simple \ + ble/syntax:bash/simple-word/is-simple-or-open-simple \ + ble/syntax:bash/simple-word/reconstruct-incomplete-word \ + ble/syntax:bash/simple-word/get-rex_element +bleopt/declare -v syntax_debug '' +bleopt/declare -v filename_ls_colors '' +bleopt/declare -v highlight_syntax 1 +bleopt/declare -v highlight_filename 1 +bleopt/declare -v highlight_variable 1 +bleopt/declare -v highlight_timeout_sync 50 +bleopt/declare -v highlight_timeout_async 5000 +bleopt/declare -v highlight_eval_word_limit 200 +bleopt/declare -v syntax_eval_polling_interval 50 +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_syntax_highlight_filetype}" +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_syntax_highlight_lscolors_ext}" +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_syntax_highlight_lscolors_suffix}" +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_syntax_bash_simple_eval}" +builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_syntax_bash_simple_eval_full}" +function ble/syntax/attr2g { ble/color/initialize-faces && ble/syntax/attr2g "$@"; } +function ble/syntax/defface.onload { + function ble/syntax/attr2g { + local iface=${_ble_syntax_attr2iface[$1]:-_ble_faces__syntax_default} + g=${_ble_faces[iface]} + } + ble/color/defface syntax_default none + ble/color/defface syntax_command fg=brown + ble/color/defface syntax_quoted fg=green + ble/color/defface syntax_quotation fg=green,bold + ble/color/defface syntax_escape fg=magenta + ble/color/defface syntax_expr fg=33 + ble/color/defface syntax_error bg=203,fg=231 # bg=224 + ble/color/defface syntax_varname fg=202 + ble/color/defface syntax_delimiter bold + ble/color/defface syntax_param_expansion fg=133 + ble/color/defface syntax_history_expansion bg=94,fg=231 + ble/color/defface syntax_function_name fg=99,bold # fg=133 + ble/color/defface syntax_comment fg=242 + ble/color/defface syntax_glob fg=198,bold + ble/color/defface syntax_brace fg=37,bold + ble/color/defface syntax_tilde fg=63,bold + ble/color/defface syntax_document fg=100 + ble/color/defface syntax_document_begin fg=100,bold + ble/color/defface command_builtin_dot fg=red,bold + ble/color/defface command_builtin fg=red + ble/color/defface command_alias fg=teal + ble/color/defface command_function fg=99 # fg=133 + ble/color/defface command_file fg=green + ble/color/defface command_keyword fg=blue + ble/color/defface command_jobs fg=red,bold + ble/color/defface command_directory fg=33,underline + ble/color/defface command_suffix fg=231,bg=28 + ble/color/defface command_suffix_new fg=231,bg=124 + ble/color/defface filename_directory underline,fg=33 + ble/color/defface filename_directory_sticky underline,fg=231,bg=26 + ble/color/defface filename_link underline,fg=teal + ble/color/defface filename_orphan underline,fg=16,bg=224 + ble/color/defface filename_setuid underline,fg=black,bg=220 + ble/color/defface filename_setgid underline,fg=black,bg=191 + ble/color/defface filename_executable underline,fg=green + ble/color/defface filename_other underline + ble/color/defface filename_socket underline,fg=cyan,bg=black + ble/color/defface filename_pipe underline,fg=lime,bg=black + ble/color/defface filename_character underline,fg=231,bg=black + ble/color/defface filename_block underline,fg=yellow,bg=black + ble/color/defface filename_warning underline,fg=red + ble/color/defface filename_url underline,fg=blue + ble/color/defface filename_ls_colors underline + ble/color/defface varname_unset fg=245 + ble/color/defface varname_empty fg=31 + ble/color/defface varname_number fg=64 + ble/color/defface varname_expr fg=99,bold + ble/color/defface varname_array fg=orange,bold + ble/color/defface varname_hash fg=70,bold + ble/color/defface varname_readonly fg=200 + ble/color/defface varname_transform fg=29,bold + ble/color/defface varname_export fg=200,bold + ble/color/defface varname_new fg=34 + ble/color/defface argument_option fg=teal + ble/color/defface argument_error fg=black,bg=225 +} +blehook/eval-after-load color_defface ble/syntax/defface.onload +function ble/syntax/import { + ble/util/import "$_ble_base/lib/core-syntax.sh" +} +ble-import -d lib/core-syntax +ble/is-function ble/util/idle.push && ble-import -d "$_ble_base/lib/core-complete.sh" +ble/util/autoload "$_ble_base/lib/core-complete.sh" \ + ble/widget/complete \ + ble/widget/menu-complete \ + ble/widget/auto-complete-enter \ + ble/widget/sabbrev-expand \ + ble/widget/dabbrev-expand +function ble-sabbrev { + local arg print= + for arg; do + if [[ $arg != -* && $arg != *=* ]]; then + print=1 + break + fi + done + if (($#==0)) || [[ $print ]]; then + ble-import lib/core-complete && ble-sabbrev "$@" + return "$?" + fi + local ret; ble/string#quote-command "$FUNCNAME" "$@" + blehook/eval-after-load complete "$ret" +} +if ! declare -p _ble_complete_sabbrev &>/dev/null; then # reload #D0875 + _ble_complete_sabbrev_version=0 + builtin eval -- "${_ble_util_gdict_declare//NAME/_ble_complete_sabbrev}" +fi +bleopt/declare -n complete_polling_cycle 50 +bleopt/declare -o complete_stdin_frequency complete_polling_cycle +bleopt/declare -v complete_limit '' +bleopt/declare -v complete_limit_auto 2000 +bleopt/declare -v complete_limit_auto_menu 100 +bleopt/declare -v complete_timeout_auto 5000 +bleopt/declare -v complete_timeout_compvar 200 +bleopt/declare -v complete_ambiguous 1 +bleopt/declare -v complete_contract_function_names 1 +bleopt/declare -v complete_auto_complete 1 +bleopt/declare -v complete_auto_complete_opts '' +bleopt/declare -n complete_auto_delay 1 +bleopt/declare -v complete_auto_wordbreaks "$_ble_term_IFS" +bleopt/declare -v complete_auto_menu '' +bleopt/declare -v complete_allow_reduction '' +bleopt/declare -v complete_requote_threshold 0 +bleopt/declare -o complete_auto_history +function bleopt/check:complete_auto_history { + if [[ $value ]]; then + bleopt complete_auto_complete_opts-=history-disabled + else + bleopt complete_auto_complete_opts+=history-disabled + fi + return 1 +} +bleopt/declare -n complete_menu_style align-nowrap +function bleopt/check:complete_menu_style { + [[ $value == desc-raw ]] && value=desc + if ! ble/is-function ble/complete/menu-style:"$value"/construct-page; then + ble/util/print-lines \ + "bleopt: Invalid value complete_menu_style='$value'." \ + " A function 'ble/complete/menu-style:$value/construct-page' is not defined." >&2 + return 1 + fi + return 0 +} +ble/util/autoload "$_ble_base/lib/core-complete.sh" \ + ble/complete/menu-style:{align,dense}{,-nowrap}/construct-page \ + ble/complete/menu-style:linewise/construct-page \ + ble/complete/menu-style:desc{,-text,-raw}/construct-page +bleopt/declare -v complete_menu_complete 1 +bleopt/declare -v complete_menu_complete_opts 'insert-selection' +bleopt/declare -v complete_menu_filter 1 +bleopt/declare -v complete_menu_maxlines '-1' +function bleopt/check:complete_menu_complete_opts { + if [[ :$value: == *:hidden:* && :$value: != *:insert-selection:* ]]; then + value=$value:insert-selection + fi + return 0 +} +bleopt/declare -v complete_skip_matched on +bleopt/declare -v complete_menu_color on +bleopt/declare -v complete_menu_color_match on +function ble/complete/.init-bind-readline-variables { + local _ble_local_rlvars; ble/util/rlvar#load + ble/util/rlvar#bind-bleopt skip-completed-text complete_skip_matched bool + ble/util/rlvar#bind-bleopt colored-stats complete_menu_color bool + ble/util/rlvar#bind-bleopt colored-completion-prefix complete_menu_color_match bool + builtin unset -f "$FUNCNAME" +} +ble/complete/.init-bind-readline-variables +bleopt/declare -v menu_prefix '' +bleopt/declare -v menu_align_prefix '' +bleopt/declare -n menu_align_min 4 +bleopt/declare -n menu_align_max 20 +bleopt/declare -o complete_menu_align menu_align_max +bleopt/declare -v menu_dense_prefix '' +bleopt/declare -v menu_linewise_prefix '' +bleopt/declare -v menu_desc_prefix '' +bleopt/declare -v menu_desc_multicolumn_width 65 +ble/util/autoload "$_ble_base/lib/core-complete.sh" \ + ble/complete/menu#start \ + ble-decode/keymap:menu/define \ + ble-decode/keymap:auto_complete/define \ + ble-decode/keymap:menu_complete/define \ + ble-decode/keymap:dabbrev/define \ + ble/complete/sabbrev/expand \ + ble/complete/expand:alias \ + ble/complete/expand:autocd +bleopt/declare -v complete_source_sabbrev_opts '' +bleopt/declare -v complete_source_sabbrev_ignore '' +_ble_complete_source_sabbrev_ignore=() +function bleopt/check:complete_source_sabbrev_ignore { + if [[ $value ]]; then + ble/string#split _ble_complete_source_sabbrev_ignore : "$value" + else + _ble_complete_source_sabbrev_ignore=() + fi +} +ble/color/defface auto_complete bg=254,fg=238 +ble/color/defface cmdinfo_cd_cdpath fg=26,bg=155 +ble/color/defface menu_filter_fixed bold +ble/color/defface menu_filter_input fg=16,bg=229 +ble/color/defface menu_desc_default none +ble/color/defface menu_desc_type ref:syntax_delimiter +ble/color/defface menu_desc_quote ref:syntax_quoted +ble/color/defface menu_complete_match bold +ble/color/defface menu_complete_selected reverse +ble/util/autoload "$_ble_base/lib/core-debug.sh" \ + ble/debug/print-variables \ + ble/debug/stopwatch/start \ + ble/debug/stopwatch/stop \ + ble/debug/profiler/start \ + ble/debug/profiler/stop \ + ble/debug/xtrace.advice +bleopt/declare -v debug_profiler_opts line:func +bleopt/declare -n debug_profiler_tree_threshold 5.0 +function ble/contrib/integration:bash-preexec/loader { + if [[ ${bash_preexec_imported-${__bp_imported}} ]]; then + blehook ATTACH-=ble/contrib/integration:bash-preexec/loader + blehook POSTEXEC-=ble/contrib/integration:bash-preexec/loader + if ble/util/import/is-loaded contrib/bash-preexec; then + ble/contrib/integration:bash-preexec/attach.hook + else + ble-import contrib/integration/bash-preexec + fi + fi +} +if [[ ${bash_preexec_imported-${__bp_imported}} ]]; then + ble-import contrib/integration/bash-preexec +else + blehook ATTACH!=ble/contrib/integration:bash-preexec/loader + blehook POSTEXEC!=ble/contrib/integration:bash-preexec/loader +fi +ble/function#try ble/util/idle.push ble/base/clean-up-runtime-directory +bleopt -I +ble/bin#freeze-utility-path ble +function ble/dispatch/.help { + ble/util/print-lines \ + 'usage: ble [SUBCOMMAND [ARGS...]]' \ + '' \ + 'SUBCOMMAND' \ + ' # Manage ble.sh' \ + ' attach ... alias of ble-attach' \ + ' detach ... alias of ble-detach' \ + ' update ... alias of ble-update' \ + ' reload ... alias of ble-reload' \ + ' help ... Show this help' \ + ' version ... Show version' \ + ' check ... Run unit tests' \ + '' \ + ' # Configuration' \ + ' opt ... alias of bleopt' \ + ' bind ... alias of ble-bind' \ + ' face ... alias of ble-face' \ + ' hook ... alias of blehook' \ + ' sabbrev ... alias of ble-sabbrev' \ + ' palette ... alias of ble-color-show' \ + '' \ + ' # Diagnostics' \ + ' summary ... Summarize the current shell setup' \ + '' +} +function ble/dispatch:summary { + ble/widget/display-shell-version +} +function ble/dispatch { + if (($#==0)); then + [[ $_ble_attached && ! $_ble_edit_exec_inside_userspace ]] + return "$?" + fi + local cmd=$1; shift + case $cmd in + (attach) ble-attach "$@" ;; + (detach) ble-detach "$@" ;; + (update) ble-update "$@" ;; + (reload) ble-reload "$@" ;; + (face) ble-face "$@" ;; + (bind) ble-bind "$@" ;; + (opt) bleopt "$@" ;; + (hook) blehook "$@" ;; + (sabbrev) ble-sabbrev "$@" ;; + (palette) ble-palette "$@" ;; + (help|--help) ble/dispatch/.help "$@" ;; + (version|--version) ble/util/print "ble.sh, version $BLE_VERSION (noarch)" ;; + (check|--test) ble/base/sub:test "$@" ;; + (*) + if ble/string#match "$cmd" '^[-a-zA-Z0-9]+$'; then + if ble/is-function ble/dispatch:"$cmd"; then + ble/dispatch:"$cmd" "$@" + return "$?" + elif ble/is-function "ble-$cmd"; then + "ble-$cmd" "$@" + return "$?" + fi + fi + if ble/is-function ble/bin/ble; then + ble/bin/ble "$cmd" "$@" + return "$?" + fi + ble/util/print "ble (ble.sh): unrecognized subcommand '$cmd'." >&2 + return 2 + esac +} +function ble { + case ${1-} in + (attach|detach|update|reload) + "ble-$@" ;; + (*) + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/dispatch "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" ;; + esac +} +_ble_base_rcfile= +_ble_base_rcfile_initialized= +function ble/base/load-rcfile { + [[ $_ble_base_rcfile_initialized ]] && return 0 + _ble_base_rcfile_initialized=1 + if [[ ! $_ble_base_rcfile ]]; then + { _ble_base_rcfile=$HOME/.blerc; [[ -f $_ble_base_rcfile ]]; } || + { _ble_base_rcfile=${XDG_CONFIG_HOME:-$HOME/.config}/blesh/init.sh; [[ -f $_ble_base_rcfile ]]; } || + _ble_base_rcfile=$HOME/.blerc + fi + if [[ -s $_ble_base_rcfile ]]; then + source -- "$_ble_base_rcfile" + blehook/.compatibility-ble-0.3/check + fi +} +function ble/base/attach/.needs-prompt-attach { + local ext=1 + [[ $1 == *:force:* ]] && return 1 + if [[ ${IN_NIX_SHELL-} && "${BASH_SOURCE[*]}" == */rc ]]; then + ext=0 + fi + if [[ ${VSCODE_INJECTION-} ]]; then + ext=0 + elif [[ ${kitty_bash_inject-} ]]; then + ext=0 + elif [[ ${ghostty_bash_inject-} || ${__ghostty_bash_flags-} ]]; then + ext=0 + fi + return "$ext" +} +function ble-attach { + if (($# >= 2)); then + builtin printf '%s\n' \ + 'usage: ble-attach [opts]' \ + 'Attach to ble.sh.' >&2 + [[ $1 != --help ]] && return 2 + return 0 + fi + if [[ $_ble_edit_detach_flag ]]; then + case $_ble_edit_detach_flag in + (exit) return 0 ;; + (*) _ble_edit_detach_flag= ;; # cancel "detach" + esac + fi + [[ ! $_ble_attached ]] || return 0 + _ble_attached=1 + BLE_ATTACHED=1 + builtin eval -- "$_ble_bash_FUNCNEST_adjust" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_adjust" + ble/base/adjust-builtin-wrappers + ble/base/adjust-bash-options + ble/base/adjust-BASH_REMATCH + if ble/base/attach/.needs-prompt-attach; then + ble/base/install-prompt-attach + _ble_attached= + BLE_ATTACHED= + ble/base/restore-BASH_REMATCH + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" + return 0 + fi + ble/fd/save-external-standard-streams + exec 0<&"$_ble_util_fd_tui_stdin" + exec 1>&"$_ble_util_fd_tui_stdout" + exec 2>&"$_ble_util_fd_tui_stderr" + ble/util/notify-broken-locale + ble/term/initialize # 0.4ms + ble/term/attach noflush # 2.5ms (起動時のずれ防止の為 stty -echo は早期に) + ble/canvas/attach # 1.8ms (requests for char_width_mode=auto) + ble/util/buffer.flush # 0.3ms + ble-edit/initialize # 0.3ms + ble-edit/attach # 2.1ms (_ble_edit_PS1 他の初期化) + ble_attach_first_prompt=1 \ + ble/canvas/panel/render # 42ms + ble/util/buffer.flush # 0.2ms + local IFS=$_ble_term_IFS + ble/decode/initialize # 7ms + ble/decode/reset-default-keymap # 264ms (keymap/vi.sh) + if ! ble/decode/attach; then # 53ms + _ble_attached= + BLE_ATTACHED= + ble-edit/detach + ble/term/leave + ble/base/restore-BASH_REMATCH + ble/base/restore-bash-options + ble/base/restore-builtin-wrappers + ble/base/restore-POSIXLY_CORRECT + builtin eval -- "$_ble_bash_FUNCNEST_restore" + return 1 + fi + ble/history:bash/reset # 27s for bash-3.0 + ble-edit/restore-PS1 + blehook/invoke ATTACH + ble-edit/adjust-PS1 + ble/textarea#redraw + ble/edit/info/default + ble-edit/bind/.tail +} +function ble-detach { + if (($#)); then + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/base/print-usage-for-no-argument-command 'Detach from ble.sh.' "$@" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + return 2 + fi + [[ $_ble_attached && ! $_ble_edit_detach_flag ]] || return 1 + _ble_edit_detach_flag=${1:-detach} # schedule detach +} +function ble-detach/impl { + [[ $_ble_attached ]] || return 1 + _ble_attached= + BLE_ATTACHED= + blehook/invoke DETACH + ble-edit/detach + ble/decode/detach + READLINE_LINE='' READLINE_POINT=0 +} +function ble-detach/message { + ble/util/buffer.print-lines "$@" + ble/util/buffer.flush + ble/edit/info/clear + ble/textarea#render + ble/util/buffer.flush +} +function ble/base/unload-for-reload { + if [[ $_ble_attached ]]; then + ble-detach/impl + local ret + ble/edit/marker#instantiate 'reload' && + ble/util/print "$ret" >&"$_ble_util_fd_tui_stderr" + [[ $_ble_edit_detach_flag ]] || + _ble_edit_detach_flag=reload + fi + local _ble_bash=$_ble_bash + ble/base/unload reload + return 0 +} +function ble/base/unload { + ble/util/is-running-in-subshell && return 1 + local IFS=$_ble_term_IFS + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_adjust" + ble/base/adjust-builtin-wrappers + ble/base/adjust-bash-options + ble/base/adjust-BASH_REMATCH + ble-edit/bind/clear-keymap-definition-loader + ble/widget/.bell/.clear-DECSCNM + ble/decode/keymap#unload + ble/term/stty/TRAPEXIT "$1" + ble/term/leave + ble/util/buffer.flush + blehook/invoke unload + ble/builtin/trap/finalize "$1" + ble/util/import/finalize + ble/base/clean-up-runtime-directory finalize + ble/fd#finalize # this is used by the above function + ble/base/clear-version-variables + return 0 +} 0<&"$_ble_util_fd_tui_stdin" 1>&"$_ble_util_fd_tui_stdout" 2>&"$_ble_util_fd_tui_stderr" +_ble_base_attach_from_prompt= +((${#_ble_base_attach_PROMPT_COMMAND[@]})) || + _ble_base_attach_PROMPT_COMMAND=() +function ble/base/install-prompt-attach { + [[ ! $_ble_base_attach_from_prompt ]] || return 0 + _ble_base_attach_from_prompt=1 + if ((_ble_bash>=50100)); then + ((${#PROMPT_COMMAND[@]})) || PROMPT_COMMAND[0]= + local prompt_command=ble/base/attach-from-PROMPT_COMMAND + if ((_ble_bash>=50300)); then + local prompt_command_new=ble::base::attach-from-PROMPT_COMMAND + ble/function#copy "$prompt_command" "$prompt_command_new" && + prompt_command=$prompt_command_new + fi + ble/array#push PROMPT_COMMAND "$prompt_command" + if [[ $_ble_edit_detach_flag == reload ]]; then + _ble_edit_detach_flag=prompt-attach + blehook internal_PRECMD!=ble/base/attach-from-PROMPT_COMMAND + fi + else + local save_index=${#_ble_base_attach_PROMPT_COMMAND[@]} + _ble_base_attach_PROMPT_COMMAND[save_index]=${PROMPT_COMMAND-} + ble/function#lambda PROMPT_COMMAND ' + local _ble_local_lastexit=$? _ble_local_lastarg=$_ + builtin eval -- "$_ble_bash_FUNCNEST_adjust" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_adjust" + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + ble/base/attach-from-PROMPT_COMMAND '"$save_index"' "'"$FUNCNAME"'"' + ble/function#trace "$PROMPT_COMMAND" + if [[ $_ble_edit_detach_flag == reload ]]; then + _ble_edit_detach_flag=prompt-attach + blehook internal_PRECMD!="$PROMPT_COMMAND" + fi + fi +} +_ble_base_attach_from_prompt_lastexit= +_ble_base_attach_from_prompt_lastarg= +_ble_base_attach_from_prompt_PIPESTATUS=() +function ble/base/attach-from-PROMPT_COMMAND { + { + _ble_base_attach_from_prompt_lastexit=$? \ + _ble_base_attach_from_prompt_lastarg=$_ \ + _ble_base_attach_from_prompt_PIPESTATUS=("${PIPESTATUS[@]}") + builtin eval -- "$_ble_bash_FUNCNEST_adjust" + if ((BASH_LINENO[${#BASH_LINENO[@]}-1]>=1)); then + _ble_edit_exec_lastexit=$_ble_base_attach_from_prompt_lastexit + _ble_edit_exec_lastarg=$_ble_base_attach_from_prompt_lastarg + _ble_edit_exec_PIPESTATUS=("${_ble_base_attach_from_prompt_PIPESTATUS[@]}") + _ble_edit_exec_BASH_COMMAND=$FUNCNAME + fi + local is_last_PROMPT_COMMAND=1 + if (($#==0)); then + if local ret; ble/array#index PROMPT_COMMAND "$FUNCNAME"; then + local keys; keys=("${!PROMPT_COMMAND[@]}") + ((ret==keys[${#keys[@]}-1])) || is_last_PROMPT_COMMAND= + ble/idict#replace PROMPT_COMMAND "$FUNCNAME" + fi + blehook internal_PRECMD-="$FUNCNAME" || ((1)) # set -e 対策 + else + local save_index=$1 lambda=$2 + local PROMPT_COMMAND=${_ble_base_attach_PROMPT_COMMAND[save_index]} + local ble_base_attach_from_prompt_command=processing + ble/prompt/update/.eval-prompt_command 2>&"$_ble_util_fd_tui_stderr" + ble/util/unlocal ble_base_attach_from_prompt_command + _ble_base_attach_PROMPT_COMMAND[save_index]=$PROMPT_COMMAND + ble/util/unlocal PROMPT_COMMAND + blehook internal_PRECMD-="$lambda" || ((1)) # set -e 対策 + if [[ $PROMPT_COMMAND == "$lambda" ]]; then + PROMPT_COMMAND=${_ble_base_attach_PROMPT_COMMAND[save_index]} + else + is_last_PROMPT_COMMAND= + fi + [[ ${ble_base_attach_from_prompt_command-} != processing ]] || return 0 + fi + [[ $_ble_base_attach_from_prompt ]] || return 0 + _ble_base_attach_from_prompt= + if [[ $is_last_PROMPT_COMMAND ]]; then + ble-edit/exec:gexec/invoke-hook-with-setexit internal_PRECMD + ble-edit/exec:gexec/invoke-hook-with-setexit PRECMD + _ble_prompt_hash=$COLUMNS:$_ble_edit_lineno:prompt_attach + fi + } 2>/dev/null # set -x 対策 #D0930 + ble-attach force; local ext=$? + builtin eval -- "$_ble_bash_FUNCNEST_local_adjust" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + ble/util/joblist.flush &>/dev/null + ble/util/joblist.check + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_leave" + builtin eval -- "$_ble_bash_FUNCNEST_local_leave" + return "$?" +} +function ble/base/process-blesh-arguments { + local opts=$_ble_base_arguments_opts + local attach=$_ble_base_arguments_attach + local inputrc=$_ble_base_arguments_inputrc + _ble_base_rcfile=$_ble_base_arguments_rcfile + _ble_decode_initialize_inputrc=$inputrc + ble/base/load-rcfile # blerc + ble/util/invoke-hook BLE_ONLOAD + case $attach in + (attach) ble-attach ;; + (prompt) ble/base/install-prompt-attach ;; + (none) ;; + (*) ble/util/print "ble.sh: unrecognized attach method --attach='$attach'." ;; + esac +} +function ble/base/sub:test { + local error= logfile= + [[ ${LANG-} ]] || local LANG=en_US.UTF-8 + ble-import lib/core-test + if (($#==0)); then + set -- bash main util canvas decode edit syntax complete keymap.vi + local timestamp + ble/util/strftime -v timestamp '%Y%m%d.%H%M%S' + logfile=$_ble_base_cache/test.$timestamp.log + >| "$logfile" + ble/test/log#open "$logfile" + fi + if ((!_ble_make_command_check_count)); then + ble/test/log "MACHTYPE: $MACHTYPE" + ble/test/log "BLE_VERSION: $BLE_VERSION" + fi + ble/test/log "BASH_VERSION: $BASH_VERSION" + local line='locale:' var ret + for var in LANG "${!LC_@}"; do + ble/string#quote-word "${!var}" + line="$line $var=$ret" + done + ble/test/log "$line" + local _ble_test_section_failure_count=0 + local section + for section; do + local file=$_ble_base/lib/test-$section.sh + if [[ -f $file ]]; then + source -- "$file" + else + ble/test/log "ERROR: Test '$section' is not defined." + error=1 + fi + done + ((_ble_test_section_failure_count)) && error=1 + if [[ $logfile ]]; then + ble/test/log#close + ble/util/print "ble.sh: The test log was saved to '${_ble_term_setaf[4]}$logfile$_ble_term_sgr0'." + fi + [[ ! $error ]] +} +function ble/base/sub:update { ble-update; } +function ble/base/sub:clear-cache { + (shopt -u failglob; ble/bin/rm -rf "$_ble_base_cache"/*) +} +function ble/base/sub:install { + local insdir=${1:-${XDG_DATA_HOME:-$HOME/.local/share}}/blesh + local dir=$insdir sudo= + [[ $dir == /* ]] || dir=./$dir + while [[ $dir && ! -d $dir ]]; do + dir=${dir%/*} + done + [[ $dir ]] || dir=/ + if ! [[ -r $dir && -w $dir && -x $dir ]]; then + if ((EUID!=0)) && [[ ! -O $dir ]] && ble/bin#has sudo; then + sudo=1 + else + ble/util/print "ble.sh --install: $dir: permission denied" >&2 + return 1 + fi + fi + if [[ ${_ble_base_repository-} == release:nightly-* ]]; then + if [[ $insdir == "$_ble_base" ]]; then + ble/util/print "ble.sh --install: already installed" >&2 + return 1 + fi + local ret + ble/string#quote-word "$insdir"; local qinsdir=$ret + ble/string#quote-word "$_ble_base"; local qbase=$ret + if [[ $sudo ]]; then + ble/util/print "\$ sudo mkdir -p $qinsdir" + sudo mkdir -p "$insdir" + ble/util/print "\$ sudo cp -Rf $qbase/* $qinsdir/" + sudo cp -Rf "$_ble_base"/* "$insdir/" + ble/util/print "\$ sudo rm -rf $qinsdir/{cache.d,run}" + sudo rm -rf "$insdir"/{cache.d,run} + else + ble/util/print "\$ mkdir -p $qinsdir" + ble/bin/mkdir -p "$insdir" + ble/util/print "\$ cp -Rf $qbase/* $qinsdir/" + ble/bin/cp -Rf "$_ble_base"/* "$insdir/" + ble/util/print "\$ rm -rf $qinsdir/cache.d/*" + ble/bin/rm -rf "$insdir/cache.d"/* + fi + elif local make; ble-update/.check-build-dependencies && ble-update/.check-repository; then + ( ble/util/print "cd into $_ble_base_repository..." >&2 && + builtin cd "$_ble_base_repository" && + ble-update/.make ${sudo:+--sudo} install INSDIR="$insdir" ) + else + ble/util/print "ble.sh --install: not supported." >&2 + return 1 + fi +} +function ble/base/sub:lib { return 0; } # do nothing +ble/function#trace ble-attach +ble/function#trace ble +ble/function#trace ble/dispatch +ble/function#trace ble/base/attach-from-PROMPT_COMMAND +ble/function#trace ble/base/unload +ble-import -f lib/_package +if [[ $_ble_init_command ]]; then + ble/base/sub:"${_ble_init_command[@]}"; _ble_init_exit=$? + [[ $_ble_init_attached ]] && ble-attach + ble/util/setexit "$_ble_init_exit" +else + ble/base/process-blesh-arguments "$@" +fi +ble/init/clean-up check-attach 2>/dev/null # set -x 対策 #D0930 +{ builtin eval "return $? || exit $?"; } 2>/dev/null # set -x 対策 #D0930 diff --git a/.local/share/blesh/contrib/airline/alduin.bash b/.local/share/blesh/contrib/airline/alduin.bash new file mode 100644 index 0000000..897e893 --- /dev/null +++ b/.local/share/blesh/contrib/airline/alduin.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/alduin.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Author: Danilo Augusto +# Script: Alduin (vim-airline version) +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:alduin/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=222,bg=60 # fg=#ffdf87,bg=#5f5f87 + ble-face -s vim_airline_a_inactive fg=241,bg=138 # fg=#666666,bg=#af8787 + ble-face -s vim_airline_a_insert fg=231,bg=105 # fg=#ffffff,bg=#878787 + ble-face -s vim_airline_a_replace fg=101,bg=234 # fg=#87875f,bg=#1c1c1c + ble-face -s vim_airline_a_visual fg=231,bg=101 # fg=#ffffff,bg=#87875f + ble-face -s vim_airline_b fg=231,bg=138 # fg=#ffffff,bg=#af8787 + ble-face -s vim_airline_b_inactive fg=180,bg=235 # fg=#dfaf87,bg=#2a2a2a + ble-face -s vim_airline_c fg=180,bg=240 # fg=#dfaf87,bg=#545454 + ble-face -s vim_airline_c_inactive fg=180,bg=235 # fg=#dfaf87,bg=#2a2a2a + ble-face -s vim_airline_c_inactive_modified fg=222,bg=16 # fg=#ffdf87,bg=#000000 + ble-face -s vim_airline_c_insert fg=231,bg=138 # fg=#ffffff,bg=#af8787 + ble-face -s vim_airline_c_insert_modified fg=222,bg=16 # fg=#ffdf87,bg=#000000 + ble-face -s vim_airline_c_normal_modified fg=222,bg=16 # fg=#ffdf87,bg=#000000 + ble-face -s vim_airline_c_replace_modified fg=222,bg=16 # fg=#ffdf87,bg=#000000 + ble-face -s vim_airline_c_visual fg=231,bg=138 # fg=#ffffff,bg=#af8787 + ble-face -s vim_airline_c_visual_modified fg=222,bg=16 # fg=#ffdf87,bg=#000000 +} diff --git a/.local/share/blesh/contrib/airline/angr.bash b/.local/share/blesh/contrib/airline/angr.bash new file mode 100644 index 0000000..a39fd41 --- /dev/null +++ b/.local/share/blesh/contrib/airline/angr.bash @@ -0,0 +1,31 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/angr.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Color palette + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:angr/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=24 # fg=#303030,bg=#005f87 + ble-face -s vim_airline_a_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_a_insert fg=238,bg=110 # fg=#444444,bg=#87afd7 + ble-face -s vim_airline_a_replace fg=236,bg=174 # fg=#303030,bg=#d78787 + ble-face -s vim_airline_a_visual fg=236,bg=182 # fg=#303030,bg=#d7afd7 + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b2b2b2,bg=#3a3a3a + ble-face -s vim_airline_b_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c_inactive_modified fg=216,bg=16 # fg=#ffaf87,bg=#000000 + ble-face -s vim_airline_c_insert fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_insert_modified fg=216,bg=238 # fg=#ffaf87,bg=#444444 + ble-face -s vim_airline_c_normal_modified fg=216,bg=238 # fg=#ffaf87,bg=#444444 + ble-face -s vim_airline_c_replace fg=174,bg=238 # fg=#d78787,bg=#444444 + ble-face -s vim_airline_c_replace_modified fg=216,bg=238 # fg=#ffaf87,bg=#444444 + ble-face -s vim_airline_c_visual fg=182,bg=238 # fg=#d7afd7,bg=#444444 + ble-face -s vim_airline_c_visual_modified fg=216,bg=238 # fg=#ffaf87,bg=#444444 + ble-face -s vim_airline_error fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/apprentice.bash b/.local/share/blesh/contrib/airline/apprentice.bash new file mode 100644 index 0000000..98fef75 --- /dev/null +++ b/.local/share/blesh/contrib/airline/apprentice.bash @@ -0,0 +1,34 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/apprentice.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline theme for Apprentice +# +# Author: pt307 (based on work by romainl) +# License: MIT License + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:apprentice/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=101 # fg=#262626,bg=#87875f + ble-face -s vim_airline_a_inactive fg=235,bg=240 # fg=#262626,bg=#585858 + ble-face -s vim_airline_a_insert fg=235,bg=65 # fg=#262626,bg=#5f875f + ble-face -s vim_airline_a_replace fg=235,bg=131 # fg=#262626,bg=#af5f5f + ble-face -s vim_airline_a_visual fg=235,bg=229 # fg=#262626,bg=#ffffaf + ble-face -s vim_airline_b fg=235,bg=240 # fg=#262626,bg=#585858 + ble-face -s vim_airline_b_inactive fg=240,bg=235 # fg=#585858,bg=#262626 + ble-face -s vim_airline_c fg=250,bg=235 # fg=#bcbcbc,bg=#262626 + ble-face -s vim_airline_c_inactive fg=240,bg=235 # fg=#585858,bg=#262626 + ble-face -s vim_airline_c_inactive_modified fg=208,bg=16 # fg=#ff8700,bg=#000000 + ble-face -s vim_airline_c_insert_modified fg=208,bg=16 # fg=#ff8700,bg=#000000 + ble-face -s vim_airline_c_normal_modified fg=208,bg=16 # fg=#ff8700,bg=#000000 + ble-face -s vim_airline_c_replace_modified fg=208,bg=16 # fg=#ff8700,bg=#000000 + ble-face -s vim_airline_c_visual_modified fg=208,bg=16 # fg=#ff8700,bg=#000000 + ble-face -s vim_airline_error fg=235,bg=131 # fg=#262626,bg=#af5f5f + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_inactive_modified fg=235,bg=131 # fg=#262626,bg=#af5f5f + ble-face -s vim_airline_warning fg=235,bg=208 # fg=#262626,bg=#ff8700 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_warning_inactive_modified fg=235,bg=208 # fg=#262626,bg=#ff8700 +} diff --git a/.local/share/blesh/contrib/airline/atomic.bash b/.local/share/blesh/contrib/airline/atomic.bash new file mode 100644 index 0000000..fdfd2f8 --- /dev/null +++ b/.local/share/blesh/contrib/airline/atomic.bash @@ -0,0 +1,42 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/atomic.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +#---------------------------------------------------------------- +# ___ __ _ +# / | / /_____ ____ ___ (_)____ +# / /| |/ __/ __ \/ __ `__ \/ / ___/ +# / ___ / /_/ /_/ / / / / / / / /__ +# /_/ |_\__/\____/_/ /_/ /_/_/\___/ +# +#---------------------------------------------------------------- +# Theme : Atomic +# Version : 2.1.0 +# License : MIT +# Author : Gerard Bajona +# URL : https://github.com/gerardbm/atomic +# ---------------------------------------------------------------- +# Colors will be adapted to the current colorscheme. For better +# contrast use the atomic colorscheme: it has ten color palettes +# with sixteen colors selected procedurally (algorithms). +# +# Atomic colorscheme: https://github.com/gerardbm/vim-atomic +# ---------------------------------------------------------------- + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:atomic/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_inactive fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_a_insert fg=231,bg=29 # fg=#ffffff,bg=#2e8b57 + ble-face -s vim_airline_a_replace fg=16,bg=231 # fg=#000000,bg=#ffffff + ble-face -s vim_airline_a_visual fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_b fg=231,bg=124 # fg=#ffffff,bg=#a52a2a + ble-face -s vim_airline_b_inactive fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_inactive fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_insert fg=29,bg=231 # fg=#2e8b57,bg=#ffffff + ble-face -s vim_airline_c_replace fg=231,bg=16 # fg=#ffffff,bg=#000000 + ble-face -s vim_airline_c_visual fg=196,bg=231 # fg=#ff0000,bg=#ffffff +} diff --git a/.local/share/blesh/contrib/airline/ayu_dark.bash b/.local/share/blesh/contrib/airline/ayu_dark.bash new file mode 100644 index 0000000..8e60b28 --- /dev/null +++ b/.local/share/blesh/contrib/airline/ayu_dark.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ayu_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Normal mode +# (Dark) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ayu_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=149 # fg=#3d424d,bg=#c2d94c + ble-face -s vim_airline_a_inactive fg=149,bg=233 # fg=#c2d94c,bg=#0a0e14 + ble-face -s vim_airline_a_insert fg=238,bg=74 # fg=#3d424d,bg=#39bae6 + ble-face -s vim_airline_a_replace fg=238,bg=203 # fg=#3d424d,bg=#ff3333 + ble-face -s vim_airline_a_visual fg=238,bg=209 # fg=#3d424d,bg=#ff8f40 + ble-face -s vim_airline_b fg=149,bg=238 # fg=#c2d94c,bg=#304357 + ble-face -s vim_airline_b_inactive fg=149,bg=233 # fg=#c2d94c,bg=#0a0e14 + ble-face -s vim_airline_b_insert fg=74,bg=238 # fg=#39bae6,bg=#304357 + ble-face -s vim_airline_b_replace fg=149,bg=238 # fg=#c2d94c,bg=#304357 + ble-face -s vim_airline_b_visual fg=209,bg=238 # fg=#ff8f40,bg=#304357 + ble-face -s vim_airline_c fg=149,bg=233 # fg=#b3b1ad,bg=#0a0e14 + ble-face -s vim_airline_c_inactive fg=149,bg=233 # fg=#c2d94c,bg=#0a0e14 + ble-face -s vim_airline_z_replace fg=238,bg=149 # fg=#3d424d,bg=#c2d94c +} diff --git a/.local/share/blesh/contrib/airline/ayu_light.bash b/.local/share/blesh/contrib/airline/ayu_light.bash new file mode 100644 index 0000000..af5f3e3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/ayu_light.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ayu_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Normal mode +# (Dark) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ayu_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=66,bg=106 # fg=#6c7680,bg=#86b300 + ble-face -s vim_airline_a_inactive fg=106,bg=231 # fg=#86b300,bg=#fafafa + ble-face -s vim_airline_a_insert fg=66,bg=74 # fg=#6c7680,bg=#55b4d4 + ble-face -s vim_airline_a_replace fg=66,bg=196 # fg=#6c7680,bg=#f51818 + ble-face -s vim_airline_a_visual fg=66,bg=209 # fg=#6c7680,bg=#fa8d3e + ble-face -s vim_airline_b fg=106,bg=66 # fg=#86b300,bg=#6c7680 + ble-face -s vim_airline_b_inactive fg=106,bg=231 # fg=#86b300,bg=#fafafa + ble-face -s vim_airline_b_insert fg=74,bg=66 # fg=#55b4d4,bg=#6c7680 + ble-face -s vim_airline_b_replace fg=106,bg=66 # fg=#86b300,bg=#6c7680 + ble-face -s vim_airline_b_visual fg=209,bg=66 # fg=#fa8d3e,bg=#6c7680 + ble-face -s vim_airline_c fg=66,bg=231 # fg=#6c7680,bg=#fafafa + ble-face -s vim_airline_c_inactive fg=106,bg=231 # fg=#86b300,bg=#fafafa + ble-face -s vim_airline_z_replace fg=66,bg=106 # fg=#6c7680,bg=#86b300 +} diff --git a/.local/share/blesh/contrib/airline/ayu_mirage.bash b/.local/share/blesh/contrib/airline/ayu_mirage.bash new file mode 100644 index 0000000..4c83199 --- /dev/null +++ b/.local/share/blesh/contrib/airline/ayu_mirage.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ayu_mirage.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Normal mode +# (Dark) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ayu_mirage/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=150 # fg=#212733,bg=#bbe67e + ble-face -s vim_airline_a_inactive fg=150,bg=17 # fg=#bbe67e,bg=#212733 + ble-face -s vim_airline_a_insert fg=17,bg=117 # fg=#212733,bg=#80d4ff + ble-face -s vim_airline_a_replace fg=17,bg=204 # fg=#212733,bg=#f07178 + ble-face -s vim_airline_a_visual fg=17,bg=215 # fg=#212733,bg=#ffae57 + ble-face -s vim_airline_b fg=150,bg=17 # fg=#bbe67e,bg=#212733 + ble-face -s vim_airline_b_insert fg=117,bg=17 # fg=#80d4ff,bg=#212733 + ble-face -s vim_airline_b_replace fg=150,bg=17 # fg=#bbe67e,bg=#212733 + ble-face -s vim_airline_b_visual fg=215,bg=17 # fg=#ffae57,bg=#212733 + ble-face -s vim_airline_c fg=253,bg=17 # fg=#e6e1cf,bg=#212733 + ble-face -s vim_airline_c_inactive fg=150,bg=17 # fg=#bbe67e,bg=#212733 + ble-face -s vim_airline_z_replace fg=17,bg=150 # fg=#212733,bg=#bbe67e +} diff --git a/.local/share/blesh/contrib/airline/badwolf.bash b/.local/share/blesh/contrib/airline/badwolf.bash new file mode 100644 index 0000000..d8137c8 --- /dev/null +++ b/.local/share/blesh/contrib/airline/badwolf.bash @@ -0,0 +1,32 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/badwolf.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:badwolf/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=154 # fg=#141413,bg=#aeee00 + ble-face -s vim_airline_a_inactive fg=235,bg=238 # fg=#242321,bg=#45413b + ble-face -s vim_airline_a_insert fg=233,bg=39 # fg=#141413,bg=#0a9dff + ble-face -s vim_airline_a_replace fg=233,bg=217 # fg=#141413,bg=#ff9eb8 + ble-face -s vim_airline_a_visual fg=233,bg=214 # fg=#141413,bg=#ffa724 + ble-face -s vim_airline_b fg=222,bg=238 # fg=#f4cf86,bg=#45413b + ble-face -s vim_airline_b_inactive fg=235,bg=238 # fg=#242321,bg=#45413b + ble-face -s vim_airline_b_insert fg=222,bg=27 # fg=#f4cf86,bg=#005fff + ble-face -s vim_airline_b_normal_modified fg=222,bg=241 # fg=#f4cf86,bg=#666462 + ble-face -s vim_airline_b_visual fg=16,bg=221 # fg=#000000,bg=#fade3e + ble-face -s vim_airline_c fg=121,bg=235 # fg=#8cffba,bg=#242321 + ble-face -s vim_airline_c_inactive fg=235,bg=238 # fg=#242321,bg=#45413b + ble-face -s vim_airline_c_inactive_modified fg=214,bg=16 # fg=#ffa724,bg=#000000 + ble-face -s vim_airline_c_insert fg=39,bg=235 # fg=#0a9dff,bg=#242321 + ble-face -s vim_airline_c_insert_modified fg=214,bg=238 # fg=#ffa724,bg=#45413b + ble-face -s vim_airline_c_normal_modified fg=214,bg=238 # fg=#ffa724,bg=#45413b + ble-face -s vim_airline_c_replace_modified fg=214,bg=238 # fg=#ffa724,bg=#45413b + ble-face -s vim_airline_c_visual fg=16,bg=137 # fg=#000000,bg=#b88853 + ble-face -s vim_airline_c_visual_modified fg=16,bg=173 # fg=#000000,bg=#c7915b + ble-face -s vim_airline_term_normal_modified fg=121,bg=235 # fg=#8cffba,bg=#242321 + ble-face -s vim_airline_term_visual_modified fg=16,bg=221 # fg=#000000,bg=#fade3e + ble-face -s vim_airline_z_replace fg=233,bg=39 # fg=#141413,bg=#0a9dff +} diff --git a/.local/share/blesh/contrib/airline/base16.bash b/.local/share/blesh/contrib/airline/base16.bash new file mode 100644 index 0000000..51ae37c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=196,bg=231 # fg=#ff0000,bg=#ffffff + ble-face -s vim_airline_a_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_replace fg=196,bg=196 # fg=#ff0000,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=196,bg=201 # fg=#ff0000,bg=#ff00ff + ble-face -s vim_airline_b fg=16,bg=252 # fg=#000000,bg=#d3d3d3 + ble-face -s vim_airline_b_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_c_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_insert_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_replace_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_visual_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_error fg=196,bg=231 # fg=#ff0000,bg=#ffffff + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/base16_3024.bash b/.local/share/blesh/contrib/airline/base16_3024.bash new file mode 100644 index 0000000..2d8bb3f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_3024.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_3024.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 3024 Scheme by Jan T. Sott (http://github.com/idleberg) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_3024/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=35 # fg=#3a3432,bg=#01a252 + ble-face -s vim_airline_a_inactive fg=248,bg=237 # fg=#a5a2a2,bg=#3a3432 + ble-face -s vim_airline_a_insert fg=237,bg=38 # fg=#3a3432,bg=#01a0e4 + ble-face -s vim_airline_a_replace fg=237,bg=160 # fg=#3a3432,bg=#db2d20 + ble-face -s vim_airline_a_visual fg=237,bg=132 # fg=#3a3432,bg=#a16a94 + ble-face -s vim_airline_b fg=189,bg=238 # fg=#d6d5d4,bg=#4a4543 + ble-face -s vim_airline_b_inactive fg=248,bg=237 # fg=#a5a2a2,bg=#3a3432 + ble-face -s vim_airline_c fg=182,bg=237 # fg=#e8bbd0,bg=#3a3432 + ble-face -s vim_airline_c_inactive fg=248,bg=237 # fg=#a5a2a2,bg=#3a3432 +} diff --git a/.local/share/blesh/contrib/airline/base16_adwaita.bash b/.local/share/blesh/contrib/airline/base16_adwaita.bash new file mode 100644 index 0000000..52068da --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_adwaita.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_adwaita.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Adwaita Scheme by Rory Bradford (https://github.com/roryrjb) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_adwaita/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=84 # fg=#33393b,bg=#6fee91 + ble-face -s vim_airline_a_inactive fg=251,bg=237 # fg=#c5c6c5,bg=#33393b + ble-face -s vim_airline_a_insert fg=237,bg=97 # fg=#33393b,bg=#916fb4 + ble-face -s vim_airline_a_replace fg=237,bg=214 # fg=#33393b,bg=#ffa500 + ble-face -s vim_airline_a_visual fg=237,bg=204 # fg=#33393b,bg=#ee6f91 + ble-face -s vim_airline_b fg=188,bg=239 # fg=#d3d4d5,bg=#4b5356 + ble-face -s vim_airline_b_inactive fg=251,bg=237 # fg=#c5c6c5,bg=#33393b + ble-face -s vim_airline_c fg=227,bg=237 # fg=#ffff60,bg=#33393b + ble-face -s vim_airline_c_inactive fg=251,bg=237 # fg=#c5c6c5,bg=#33393b +} diff --git a/.local/share/blesh/contrib/airline/base16_apathy.bash b/.local/share/blesh/contrib/airline/base16_apathy.bash new file mode 100644 index 0000000..85d1cfa --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_apathy.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_apathy.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Apathy Scheme by Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_apathy/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=96 # fg=#0b342d,bg=#883e96 + ble-face -s vim_airline_a_inactive fg=109,bg=22 # fg=#81b5ac,bg=#0b342d + ble-face -s vim_airline_a_insert fg=22,bg=101 # fg=#0b342d,bg=#96883e + ble-face -s vim_airline_a_replace fg=22,bg=66 # fg=#0b342d,bg=#3e9688 + ble-face -s vim_airline_a_visual fg=22,bg=65 # fg=#0b342d,bg=#4c963e + ble-face -s vim_airline_b fg=152,bg=23 # fg=#a7cec8,bg=#184e45 + ble-face -s vim_airline_b_inactive fg=109,bg=22 # fg=#81b5ac,bg=#0b342d + ble-face -s vim_airline_c fg=66,bg=22 # fg=#3e7996,bg=#0b342d + ble-face -s vim_airline_c_inactive fg=109,bg=22 # fg=#81b5ac,bg=#0b342d +} diff --git a/.local/share/blesh/contrib/airline/base16_ashes.bash b/.local/share/blesh/contrib/airline/base16_ashes.bash new file mode 100644 index 0000000..bc84259 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_ashes.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_ashes.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Ashes Scheme by Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_ashes/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=115 # fg=#393f45,bg=#95c7ae + ble-face -s vim_airline_a_inactive fg=252,bg=238 # fg=#c7ccd1,bg=#393f45 + ble-face -s vim_airline_a_insert fg=238,bg=140 # fg=#393f45,bg=#ae95c7 + ble-face -s vim_airline_a_replace fg=238,bg=180 # fg=#393f45,bg=#c7ae95 + ble-face -s vim_airline_a_visual fg=238,bg=175 # fg=#393f45,bg=#c795ae + ble-face -s vim_airline_b fg=254,bg=61 # fg=#dfe2e5,bg=#565e65 + ble-face -s vim_airline_b_inactive fg=252,bg=238 # fg=#c7ccd1,bg=#393f45 + ble-face -s vim_airline_c fg=186,bg=238 # fg=#c7c795,bg=#393f45 + ble-face -s vim_airline_c_inactive fg=252,bg=238 # fg=#c7ccd1,bg=#393f45 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_cave.bash b/.local/share/blesh/contrib/airline/base16_atelier_cave.bash new file mode 100644 index 0000000..57aa8c1 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_cave.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_cave.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Cave vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_cave/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=244 # fg=#26232a,bg=#7e7887 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#26232a,bg=#26232a + ble-face -s vim_airline_a_insert fg=235,bg=30 # fg=#26232a,bg=#2a9292 + ble-face -s vim_airline_a_replace fg=235,bg=98 # fg=#26232a,bg=#955ae7 + ble-face -s vim_airline_a_visual fg=235,bg=131 # fg=#26232a,bg=#aa573c + ble-face -s vim_airline_b fg=244,bg=240 # fg=#7e7887,bg=#585260 + ble-face -s vim_airline_b_inactive fg=244,bg=235 # fg=#7e7887,bg=#26232a + ble-face -s vim_airline_c fg=244,bg=235 # fg=#7e7887,bg=#26232a + ble-face -s vim_airline_c_inactive fg=245,bg=235 # fg=#8b8792,bg=#26232a + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#efecf4,bg=#26232a + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#efecf4,bg=#26232a + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#efecf4,bg=#26232a + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#efecf4,bg=#26232a +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_cave_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_cave_light.bash new file mode 100644 index 0000000..ef2386c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_cave_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_cave_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Cave Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_cave_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=241 # fg=#e2dfe7,bg=#655f6d + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e2dfe7,bg=#e2dfe7 + ble-face -s vim_airline_a_insert fg=254,bg=30 # fg=#e2dfe7,bg=#2a9292 + ble-face -s vim_airline_a_replace fg=254,bg=98 # fg=#e2dfe7,bg=#955ae7 + ble-face -s vim_airline_a_visual fg=254,bg=131 # fg=#e2dfe7,bg=#aa573c + ble-face -s vim_airline_b fg=241,bg=245 # fg=#655f6d,bg=#8b8792 + ble-face -s vim_airline_b_inactive fg=241,bg=254 # fg=#655f6d,bg=#e2dfe7 + ble-face -s vim_airline_c fg=241,bg=254 # fg=#655f6d,bg=#e2dfe7 + ble-face -s vim_airline_c_inactive fg=240,bg=254 # fg=#585260,bg=#e2dfe7 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#19171c,bg=#e2dfe7 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#19171c,bg=#e2dfe7 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#19171c,bg=#e2dfe7 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#19171c,bg=#e2dfe7 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_dune.bash b/.local/share/blesh/contrib/airline/base16_atelier_dune.bash new file mode 100644 index 0000000..17db305 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_dune.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_dune.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Dune vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_dune/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=246 # fg=#292824,bg=#999580 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#292824,bg=#292824 + ble-face -s vim_airline_a_insert fg=235,bg=71 # fg=#292824,bg=#60ac39 + ble-face -s vim_airline_a_replace fg=235,bg=134 # fg=#292824,bg=#b854d4 + ble-face -s vim_airline_a_visual fg=235,bg=130 # fg=#292824,bg=#b65611 + ble-face -s vim_airline_b fg=246,bg=242 # fg=#999580,bg=#6e6b5e + ble-face -s vim_airline_b_inactive fg=246,bg=235 # fg=#999580,bg=#292824 + ble-face -s vim_airline_c fg=246,bg=235 # fg=#999580,bg=#292824 + ble-face -s vim_airline_c_inactive fg=144,bg=235 # fg=#a6a28c,bg=#292824 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#fefbec,bg=#292824 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#fefbec,bg=#292824 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#fefbec,bg=#292824 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#fefbec,bg=#292824 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_dune_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_dune_light.bash new file mode 100644 index 0000000..2b7b8ce --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_dune_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_dune_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Dune Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_dune_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=253,bg=101 # fg=#e8e4cf,bg=#7d7a68 + ble-face -s vim_airline_a_inactive fg=253,bg=253 # fg=#e8e4cf,bg=#e8e4cf + ble-face -s vim_airline_a_insert fg=253,bg=71 # fg=#e8e4cf,bg=#60ac39 + ble-face -s vim_airline_a_replace fg=253,bg=134 # fg=#e8e4cf,bg=#b854d4 + ble-face -s vim_airline_a_visual fg=253,bg=130 # fg=#e8e4cf,bg=#b65611 + ble-face -s vim_airline_b fg=101,bg=144 # fg=#7d7a68,bg=#a6a28c + ble-face -s vim_airline_b_inactive fg=101,bg=253 # fg=#7d7a68,bg=#e8e4cf + ble-face -s vim_airline_c fg=101,bg=253 # fg=#7d7a68,bg=#e8e4cf + ble-face -s vim_airline_c_inactive fg=242,bg=253 # fg=#6e6b5e,bg=#e8e4cf + ble-face -s vim_airline_c_insert_modified fg=234,bg=253 # fg=#20201d,bg=#e8e4cf + ble-face -s vim_airline_c_normal_modified fg=234,bg=253 # fg=#20201d,bg=#e8e4cf + ble-face -s vim_airline_c_replace_modified fg=234,bg=253 # fg=#20201d,bg=#e8e4cf + ble-face -s vim_airline_c_visual_modified fg=234,bg=253 # fg=#20201d,bg=#e8e4cf +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_estuary.bash b/.local/share/blesh/contrib/airline/base16_atelier_estuary.bash new file mode 100644 index 0000000..2cde666 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_estuary.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_estuary.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Estuary vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_estuary/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=52,bg=244 # fg=#302f27,bg=#878573 + ble-face -s vim_airline_a_inactive fg=52,bg=52 # fg=#302f27,bg=#302f27 + ble-face -s vim_airline_a_insert fg=52,bg=100 # fg=#302f27,bg=#7d9726 + ble-face -s vim_airline_a_replace fg=52,bg=66 # fg=#302f27,bg=#5f9182 + ble-face -s vim_airline_a_visual fg=52,bg=136 # fg=#302f27,bg=#ae7313 + ble-face -s vim_airline_b fg=244,bg=240 # fg=#878573,bg=#5f5e4e + ble-face -s vim_airline_b_inactive fg=244,bg=52 # fg=#878573,bg=#302f27 + ble-face -s vim_airline_c fg=244,bg=52 # fg=#878573,bg=#302f27 + ble-face -s vim_airline_c_inactive fg=245,bg=52 # fg=#929181,bg=#302f27 + ble-face -s vim_airline_c_insert_modified fg=255,bg=52 # fg=#f4f3ec,bg=#302f27 + ble-face -s vim_airline_c_normal_modified fg=255,bg=52 # fg=#f4f3ec,bg=#302f27 + ble-face -s vim_airline_c_replace_modified fg=255,bg=52 # fg=#f4f3ec,bg=#302f27 + ble-face -s vim_airline_c_visual_modified fg=255,bg=52 # fg=#f4f3ec,bg=#302f27 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_estuary_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_estuary_light.bash new file mode 100644 index 0000000..7991bad --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_estuary_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_estuary_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Estuary Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_estuary_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=241 # fg=#e7e6df,bg=#6c6b5a + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e7e6df,bg=#e7e6df + ble-face -s vim_airline_a_insert fg=254,bg=100 # fg=#e7e6df,bg=#7d9726 + ble-face -s vim_airline_a_replace fg=254,bg=66 # fg=#e7e6df,bg=#5f9182 + ble-face -s vim_airline_a_visual fg=254,bg=136 # fg=#e7e6df,bg=#ae7313 + ble-face -s vim_airline_b fg=241,bg=245 # fg=#6c6b5a,bg=#929181 + ble-face -s vim_airline_b_inactive fg=241,bg=254 # fg=#6c6b5a,bg=#e7e6df + ble-face -s vim_airline_c fg=241,bg=254 # fg=#6c6b5a,bg=#e7e6df + ble-face -s vim_airline_c_inactive fg=240,bg=254 # fg=#5f5e4e,bg=#e7e6df + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#22221b,bg=#e7e6df + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#22221b,bg=#e7e6df + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#22221b,bg=#e7e6df + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#22221b,bg=#e7e6df +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_forest.bash b/.local/share/blesh/contrib/airline/base16_atelier_forest.bash new file mode 100644 index 0000000..3382a81 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_forest.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_forest.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Forest vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_forest/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=138 # fg=#2c2421,bg=#9c9491 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#2c2421,bg=#2c2421 + ble-face -s vim_airline_a_insert fg=235,bg=100 # fg=#2c2421,bg=#7b9726 + ble-face -s vim_airline_a_replace fg=235,bg=62 # fg=#2c2421,bg=#6666ea + ble-face -s vim_airline_a_visual fg=235,bg=166 # fg=#2c2421,bg=#df5320 + ble-face -s vim_airline_b fg=138,bg=241 # fg=#9c9491,bg=#68615e + ble-face -s vim_airline_b_inactive fg=138,bg=235 # fg=#9c9491,bg=#2c2421 + ble-face -s vim_airline_c fg=138,bg=235 # fg=#9c9491,bg=#2c2421 + ble-face -s vim_airline_c_inactive fg=248,bg=235 # fg=#a8a19f,bg=#2c2421 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#f1efee,bg=#2c2421 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#f1efee,bg=#2c2421 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#f1efee,bg=#2c2421 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#f1efee,bg=#2c2421 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_forest_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_forest_light.bash new file mode 100644 index 0000000..90043eb --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_forest_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_forest_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Forest Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_forest_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=95 # fg=#e6e2e0,bg=#766e6b + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e6e2e0,bg=#e6e2e0 + ble-face -s vim_airline_a_insert fg=254,bg=100 # fg=#e6e2e0,bg=#7b9726 + ble-face -s vim_airline_a_replace fg=254,bg=62 # fg=#e6e2e0,bg=#6666ea + ble-face -s vim_airline_a_visual fg=254,bg=166 # fg=#e6e2e0,bg=#df5320 + ble-face -s vim_airline_b fg=95,bg=248 # fg=#766e6b,bg=#a8a19f + ble-face -s vim_airline_b_inactive fg=95,bg=254 # fg=#766e6b,bg=#e6e2e0 + ble-face -s vim_airline_c fg=95,bg=254 # fg=#766e6b,bg=#e6e2e0 + ble-face -s vim_airline_c_inactive fg=241,bg=254 # fg=#68615e,bg=#e6e2e0 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#1b1918,bg=#e6e2e0 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#1b1918,bg=#e6e2e0 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#1b1918,bg=#e6e2e0 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#1b1918,bg=#e6e2e0 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_heath.bash b/.local/share/blesh/contrib/airline/base16_atelier_heath.bash new file mode 100644 index 0000000..4a425e9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_heath.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_heath.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Heath vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_heath/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=139 # fg=#292329,bg=#9e8f9e + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#292329,bg=#292329 + ble-face -s vim_airline_a_insert fg=235,bg=101 # fg=#292329,bg=#918b3b + ble-face -s vim_airline_a_replace fg=235,bg=97 # fg=#292329,bg=#7b59c0 + ble-face -s vim_airline_a_visual fg=235,bg=130 # fg=#292329,bg=#a65926 + ble-face -s vim_airline_b fg=139,bg=241 # fg=#9e8f9e,bg=#695d69 + ble-face -s vim_airline_b_inactive fg=139,bg=235 # fg=#9e8f9e,bg=#292329 + ble-face -s vim_airline_c fg=139,bg=235 # fg=#9e8f9e,bg=#292329 + ble-face -s vim_airline_c_inactive fg=248,bg=235 # fg=#ab9bab,bg=#292329 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#f7f3f7,bg=#292329 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#f7f3f7,bg=#292329 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#f7f3f7,bg=#292329 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#f7f3f7,bg=#292329 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_heath_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_heath_light.bash new file mode 100644 index 0000000..9190a97 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_heath_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_heath_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Heath Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_heath_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=252,bg=96 # fg=#d8cad8,bg=#776977 + ble-face -s vim_airline_a_inactive fg=252,bg=252 # fg=#d8cad8,bg=#d8cad8 + ble-face -s vim_airline_a_insert fg=252,bg=101 # fg=#d8cad8,bg=#918b3b + ble-face -s vim_airline_a_replace fg=252,bg=97 # fg=#d8cad8,bg=#7b59c0 + ble-face -s vim_airline_a_visual fg=252,bg=130 # fg=#d8cad8,bg=#a65926 + ble-face -s vim_airline_b fg=96,bg=248 # fg=#776977,bg=#ab9bab + ble-face -s vim_airline_b_inactive fg=96,bg=252 # fg=#776977,bg=#d8cad8 + ble-face -s vim_airline_c fg=96,bg=252 # fg=#776977,bg=#d8cad8 + ble-face -s vim_airline_c_inactive fg=241,bg=252 # fg=#695d69,bg=#d8cad8 + ble-face -s vim_airline_c_insert_modified fg=234,bg=252 # fg=#1b181b,bg=#d8cad8 + ble-face -s vim_airline_c_normal_modified fg=234,bg=252 # fg=#1b181b,bg=#d8cad8 + ble-face -s vim_airline_c_replace_modified fg=234,bg=252 # fg=#1b181b,bg=#d8cad8 + ble-face -s vim_airline_c_visual_modified fg=234,bg=252 # fg=#1b181b,bg=#d8cad8 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_lakeside.bash b/.local/share/blesh/contrib/airline/base16_atelier_lakeside.bash new file mode 100644 index 0000000..1fa943d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_lakeside.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_lakeside.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Lakeside vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_lakeside/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=67 # fg=#1f292e,bg=#7195a8 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#1f292e,bg=#1f292e + ble-face -s vim_airline_a_insert fg=235,bg=65 # fg=#1f292e,bg=#568c3b + ble-face -s vim_airline_a_replace fg=235,bg=61 # fg=#1f292e,bg=#6b6bb8 + ble-face -s vim_airline_a_visual fg=235,bg=94 # fg=#1f292e,bg=#935c25 + ble-face -s vim_airline_b fg=67,bg=60 # fg=#7195a8,bg=#516d7b + ble-face -s vim_airline_b_inactive fg=67,bg=235 # fg=#7195a8,bg=#1f292e + ble-face -s vim_airline_c fg=67,bg=235 # fg=#7195a8,bg=#1f292e + ble-face -s vim_airline_c_inactive fg=109,bg=235 # fg=#7ea2b4,bg=#1f292e + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#ebf8ff,bg=#1f292e + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#ebf8ff,bg=#1f292e + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#ebf8ff,bg=#1f292e + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#ebf8ff,bg=#1f292e +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_lakeside_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_lakeside_light.bash new file mode 100644 index 0000000..5377473 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_lakeside_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_lakeside_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Lakeside Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_lakeside_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=153,bg=66 # fg=#c1e4f6,bg=#5a7b8c + ble-face -s vim_airline_a_inactive fg=153,bg=153 # fg=#c1e4f6,bg=#c1e4f6 + ble-face -s vim_airline_a_insert fg=153,bg=65 # fg=#c1e4f6,bg=#568c3b + ble-face -s vim_airline_a_replace fg=153,bg=61 # fg=#c1e4f6,bg=#6b6bb8 + ble-face -s vim_airline_a_visual fg=153,bg=94 # fg=#c1e4f6,bg=#935c25 + ble-face -s vim_airline_b fg=66,bg=109 # fg=#5a7b8c,bg=#7ea2b4 + ble-face -s vim_airline_b_inactive fg=66,bg=153 # fg=#5a7b8c,bg=#c1e4f6 + ble-face -s vim_airline_c fg=66,bg=153 # fg=#5a7b8c,bg=#c1e4f6 + ble-face -s vim_airline_c_inactive fg=60,bg=153 # fg=#516d7b,bg=#c1e4f6 + ble-face -s vim_airline_c_insert_modified fg=234,bg=153 # fg=#161b1d,bg=#c1e4f6 + ble-face -s vim_airline_c_normal_modified fg=234,bg=153 # fg=#161b1d,bg=#c1e4f6 + ble-face -s vim_airline_c_replace_modified fg=234,bg=153 # fg=#161b1d,bg=#c1e4f6 + ble-face -s vim_airline_c_visual_modified fg=234,bg=153 # fg=#161b1d,bg=#c1e4f6 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_plateau.bash b/.local/share/blesh/contrib/airline/base16_atelier_plateau.bash new file mode 100644 index 0000000..1bca55b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_plateau.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_plateau.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Plateau vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_plateau/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=243 # fg=#292424,bg=#7e7777 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#292424,bg=#292424 + ble-face -s vim_airline_a_insert fg=235,bg=66 # fg=#292424,bg=#4b8b8b + ble-face -s vim_airline_a_replace fg=235,bg=98 # fg=#292424,bg=#8464c4 + ble-face -s vim_airline_a_visual fg=235,bg=131 # fg=#292424,bg=#b45a3c + ble-face -s vim_airline_b fg=243,bg=240 # fg=#7e7777,bg=#585050 + ble-face -s vim_airline_b_inactive fg=243,bg=235 # fg=#7e7777,bg=#292424 + ble-face -s vim_airline_c fg=243,bg=235 # fg=#7e7777,bg=#292424 + ble-face -s vim_airline_c_inactive fg=105,bg=235 # fg=#8a8585,bg=#292424 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#f4ecec,bg=#292424 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#f4ecec,bg=#292424 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#f4ecec,bg=#292424 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#f4ecec,bg=#292424 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_plateau_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_plateau_light.bash new file mode 100644 index 0000000..021c3a2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_plateau_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_plateau_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Plateau Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_plateau_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=63 # fg=#e7dfdf,bg=#655d5d + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e7dfdf,bg=#e7dfdf + ble-face -s vim_airline_a_insert fg=254,bg=66 # fg=#e7dfdf,bg=#4b8b8b + ble-face -s vim_airline_a_replace fg=254,bg=98 # fg=#e7dfdf,bg=#8464c4 + ble-face -s vim_airline_a_visual fg=254,bg=131 # fg=#e7dfdf,bg=#b45a3c + ble-face -s vim_airline_b fg=63,bg=105 # fg=#655d5d,bg=#8a8585 + ble-face -s vim_airline_b_inactive fg=63,bg=254 # fg=#655d5d,bg=#e7dfdf + ble-face -s vim_airline_c fg=63,bg=254 # fg=#655d5d,bg=#e7dfdf + ble-face -s vim_airline_c_inactive fg=240,bg=254 # fg=#585050,bg=#e7dfdf + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#1b1818,bg=#e7dfdf + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#1b1818,bg=#e7dfdf + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#1b1818,bg=#e7dfdf + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#1b1818,bg=#e7dfdf +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_savanna.bash b/.local/share/blesh/contrib/airline/base16_atelier_savanna.bash new file mode 100644 index 0000000..ef9bb71 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_savanna.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_savanna.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Savanna vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_savanna/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=244 # fg=#232a25,bg=#78877d + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#232a25,bg=#232a25 + ble-face -s vim_airline_a_insert fg=235,bg=65 # fg=#232a25,bg=#489963 + ble-face -s vim_airline_a_replace fg=235,bg=67 # fg=#232a25,bg=#55859b + ble-face -s vim_airline_a_visual fg=235,bg=131 # fg=#232a25,bg=#9f713c + ble-face -s vim_airline_b fg=244,bg=240 # fg=#78877d,bg=#526057 + ble-face -s vim_airline_b_inactive fg=244,bg=235 # fg=#78877d,bg=#232a25 + ble-face -s vim_airline_c fg=244,bg=235 # fg=#78877d,bg=#232a25 + ble-face -s vim_airline_c_inactive fg=245,bg=235 # fg=#87928a,bg=#232a25 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#ecf4ee,bg=#232a25 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#ecf4ee,bg=#232a25 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#ecf4ee,bg=#232a25 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#ecf4ee,bg=#232a25 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_savanna_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_savanna_light.bash new file mode 100644 index 0000000..a2dbcc3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_savanna_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_savanna_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Savanna Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_savanna_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=241 # fg=#dfe7e2,bg=#5f6d64 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#dfe7e2,bg=#dfe7e2 + ble-face -s vim_airline_a_insert fg=254,bg=65 # fg=#dfe7e2,bg=#489963 + ble-face -s vim_airline_a_replace fg=254,bg=67 # fg=#dfe7e2,bg=#55859b + ble-face -s vim_airline_a_visual fg=254,bg=131 # fg=#dfe7e2,bg=#9f713c + ble-face -s vim_airline_b fg=241,bg=245 # fg=#5f6d64,bg=#87928a + ble-face -s vim_airline_b_inactive fg=241,bg=254 # fg=#5f6d64,bg=#dfe7e2 + ble-face -s vim_airline_c fg=241,bg=254 # fg=#5f6d64,bg=#dfe7e2 + ble-face -s vim_airline_c_inactive fg=240,bg=254 # fg=#526057,bg=#dfe7e2 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#171c19,bg=#dfe7e2 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#171c19,bg=#dfe7e2 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#171c19,bg=#dfe7e2 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#171c19,bg=#dfe7e2 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_seaside.bash b/.local/share/blesh/contrib/airline/base16_atelier_seaside.bash new file mode 100644 index 0000000..3cb7039 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_seaside.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_seaside.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Seaside vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_seaside/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=106 # fg=#242924,bg=#809980 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#242924,bg=#242924 + ble-face -s vim_airline_a_insert fg=235,bg=34 # fg=#242924,bg=#29a329 + ble-face -s vim_airline_a_replace fg=235,bg=129 # fg=#242924,bg=#ad2bee + ble-face -s vim_airline_a_visual fg=235,bg=94 # fg=#242924,bg=#87711d + ble-face -s vim_airline_b fg=106,bg=241 # fg=#809980,bg=#5e6e5e + ble-face -s vim_airline_b_inactive fg=106,bg=235 # fg=#809980,bg=#242924 + ble-face -s vim_airline_c fg=106,bg=235 # fg=#809980,bg=#242924 + ble-face -s vim_airline_c_inactive fg=108,bg=235 # fg=#8ca68c,bg=#242924 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#f4fbf4,bg=#242924 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#f4fbf4,bg=#242924 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#f4fbf4,bg=#242924 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#f4fbf4,bg=#242924 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_seaside_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_seaside_light.bash new file mode 100644 index 0000000..c0ca2a2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_seaside_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_seaside_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Seaside Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_seaside_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=191,bg=65 # fg=#cfe8cf,bg=#687d68 + ble-face -s vim_airline_a_inactive fg=191,bg=191 # fg=#cfe8cf,bg=#cfe8cf + ble-face -s vim_airline_a_insert fg=191,bg=34 # fg=#cfe8cf,bg=#29a329 + ble-face -s vim_airline_a_replace fg=191,bg=129 # fg=#cfe8cf,bg=#ad2bee + ble-face -s vim_airline_a_visual fg=191,bg=94 # fg=#cfe8cf,bg=#87711d + ble-face -s vim_airline_b fg=65,bg=108 # fg=#687d68,bg=#8ca68c + ble-face -s vim_airline_b_inactive fg=65,bg=191 # fg=#687d68,bg=#cfe8cf + ble-face -s vim_airline_c fg=65,bg=191 # fg=#687d68,bg=#cfe8cf + ble-face -s vim_airline_c_inactive fg=241,bg=191 # fg=#5e6e5e,bg=#cfe8cf + ble-face -s vim_airline_c_insert_modified fg=233,bg=191 # fg=#131513,bg=#cfe8cf + ble-face -s vim_airline_c_normal_modified fg=233,bg=191 # fg=#131513,bg=#cfe8cf + ble-face -s vim_airline_c_replace_modified fg=233,bg=191 # fg=#131513,bg=#cfe8cf + ble-face -s vim_airline_c_visual_modified fg=233,bg=191 # fg=#131513,bg=#cfe8cf +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool.bash b/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool.bash new file mode 100644 index 0000000..1474b3b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_sulphurpool.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Sulphurpool vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_sulphurpool/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=103 # fg=#293256,bg=#898ea4 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#293256,bg=#293256 + ble-face -s vim_airline_a_insert fg=23,bg=137 # fg=#293256,bg=#ac9739 + ble-face -s vim_airline_a_replace fg=23,bg=68 # fg=#293256,bg=#6679cc + ble-face -s vim_airline_a_visual fg=23,bg=166 # fg=#293256,bg=#c76b29 + ble-face -s vim_airline_b fg=103,bg=60 # fg=#898ea4,bg=#5e6687 + ble-face -s vim_airline_b_inactive fg=103,bg=23 # fg=#898ea4,bg=#293256 + ble-face -s vim_airline_c fg=103,bg=23 # fg=#898ea4,bg=#293256 + ble-face -s vim_airline_c_inactive fg=109,bg=23 # fg=#979db4,bg=#293256 + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#f5f7ff,bg=#293256 + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#f5f7ff,bg=#293256 + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#f5f7ff,bg=#293256 + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#f5f7ff,bg=#293256 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool_light.bash b/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool_light.bash new file mode 100644 index 0000000..535b97f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelier_sulphurpool_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelier_sulphurpool_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atelier Sulphurpool Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Bram de Haan (http://atelierbramdehaan.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelier_sulphurpool_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=189,bg=66 # fg=#dfe2f1,bg=#6b7394 + ble-face -s vim_airline_a_inactive fg=189,bg=189 # fg=#dfe2f1,bg=#dfe2f1 + ble-face -s vim_airline_a_insert fg=189,bg=137 # fg=#dfe2f1,bg=#ac9739 + ble-face -s vim_airline_a_replace fg=189,bg=68 # fg=#dfe2f1,bg=#6679cc + ble-face -s vim_airline_a_visual fg=189,bg=166 # fg=#dfe2f1,bg=#c76b29 + ble-face -s vim_airline_b fg=66,bg=109 # fg=#6b7394,bg=#979db4 + ble-face -s vim_airline_b_inactive fg=66,bg=189 # fg=#6b7394,bg=#dfe2f1 + ble-face -s vim_airline_c fg=66,bg=189 # fg=#6b7394,bg=#dfe2f1 + ble-face -s vim_airline_c_inactive fg=60,bg=189 # fg=#5e6687,bg=#dfe2f1 + ble-face -s vim_airline_c_insert_modified fg=17,bg=189 # fg=#202746,bg=#dfe2f1 + ble-face -s vim_airline_c_normal_modified fg=17,bg=189 # fg=#202746,bg=#dfe2f1 + ble-face -s vim_airline_c_replace_modified fg=17,bg=189 # fg=#202746,bg=#dfe2f1 + ble-face -s vim_airline_c_visual_modified fg=17,bg=189 # fg=#202746,bg=#dfe2f1 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelierdune.bash b/.local/share/blesh/contrib/airline/base16_atelierdune.bash new file mode 100644 index 0000000..2f45dff --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelierdune.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelierdune.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Atelier Dune Scheme by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelierdune/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=71 # fg=#292824,bg=#60ac39 + ble-face -s vim_airline_a_inactive fg=144,bg=235 # fg=#a6a28c,bg=#292824 + ble-face -s vim_airline_a_insert fg=235,bg=68 # fg=#292824,bg=#6684e1 + ble-face -s vim_airline_a_replace fg=235,bg=167 # fg=#292824,bg=#d73737 + ble-face -s vim_airline_a_visual fg=235,bg=134 # fg=#292824,bg=#b854d4 + ble-face -s vim_airline_b fg=253,bg=242 # fg=#e8e4cf,bg=#6e6b5e + ble-face -s vim_airline_b_inactive fg=144,bg=235 # fg=#a6a28c,bg=#292824 + ble-face -s vim_airline_c fg=130,bg=235 # fg=#b65611,bg=#292824 + ble-face -s vim_airline_c_inactive fg=144,bg=235 # fg=#a6a28c,bg=#292824 + ble-face -s vim_airline_error fg=231,bg=167 # fg=#fefbec,bg=#d73737 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=235,bg=178 # fg=#292824,bg=#cfb017 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelierforest.bash b/.local/share/blesh/contrib/airline/base16_atelierforest.bash new file mode 100644 index 0000000..ba6b9a0 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelierforest.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelierforest.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Atelier Forest Scheme by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelierforest/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=71 # fg=#2c2421,bg=#5ab738 + ble-face -s vim_airline_a_inactive fg=248,bg=235 # fg=#a8a19f,bg=#2c2421 + ble-face -s vim_airline_a_insert fg=235,bg=68 # fg=#2c2421,bg=#407ee7 + ble-face -s vim_airline_a_replace fg=235,bg=197 # fg=#2c2421,bg=#f22c40 + ble-face -s vim_airline_a_visual fg=235,bg=62 # fg=#2c2421,bg=#6666ea + ble-face -s vim_airline_b fg=254,bg=241 # fg=#e6e2e0,bg=#68615e + ble-face -s vim_airline_b_inactive fg=248,bg=235 # fg=#a8a19f,bg=#2c2421 + ble-face -s vim_airline_c fg=166,bg=235 # fg=#df5320,bg=#2c2421 + ble-face -s vim_airline_c_inactive fg=248,bg=235 # fg=#a8a19f,bg=#2c2421 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelierheath.bash b/.local/share/blesh/contrib/airline/base16_atelierheath.bash new file mode 100644 index 0000000..d980649 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelierheath.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelierheath.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Atelier Heath Scheme by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelierheath/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=65 # fg=#292329,bg=#379a37 + ble-face -s vim_airline_a_inactive fg=248,bg=235 # fg=#ab9bab,bg=#292329 + ble-face -s vim_airline_a_insert fg=235,bg=63 # fg=#292329,bg=#516aec + ble-face -s vim_airline_a_replace fg=235,bg=166 # fg=#292329,bg=#ca402b + ble-face -s vim_airline_a_visual fg=235,bg=97 # fg=#292329,bg=#7b59c0 + ble-face -s vim_airline_b fg=252,bg=241 # fg=#d8cad8,bg=#695d69 + ble-face -s vim_airline_b_inactive fg=248,bg=235 # fg=#ab9bab,bg=#292329 + ble-face -s vim_airline_c fg=130,bg=235 # fg=#a65926,bg=#292329 + ble-face -s vim_airline_c_inactive fg=248,bg=235 # fg=#ab9bab,bg=#292329 +} diff --git a/.local/share/blesh/contrib/airline/base16_atelierlakeside.bash b/.local/share/blesh/contrib/airline/base16_atelierlakeside.bash new file mode 100644 index 0000000..158311c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelierlakeside.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelierlakeside.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Atelier Lakeside Scheme by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelierlakeside/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=65 # fg=#1f292e,bg=#568c3b + ble-face -s vim_airline_a_inactive fg=109,bg=235 # fg=#7ea2b4,bg=#1f292e + ble-face -s vim_airline_a_insert fg=235,bg=31 # fg=#1f292e,bg=#257fad + ble-face -s vim_airline_a_replace fg=235,bg=161 # fg=#1f292e,bg=#d22d72 + ble-face -s vim_airline_a_visual fg=235,bg=61 # fg=#1f292e,bg=#5d5db1 + ble-face -s vim_airline_b fg=153,bg=60 # fg=#c1e4f6,bg=#516d7b + ble-face -s vim_airline_b_inactive fg=109,bg=235 # fg=#7ea2b4,bg=#1f292e + ble-face -s vim_airline_c fg=94,bg=235 # fg=#935c25,bg=#1f292e + ble-face -s vim_airline_c_inactive fg=109,bg=235 # fg=#7ea2b4,bg=#1f292e +} diff --git a/.local/share/blesh/contrib/airline/base16_atelierseaside.bash b/.local/share/blesh/contrib/airline/base16_atelierseaside.bash new file mode 100644 index 0000000..cc6232b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atelierseaside.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atelierseaside.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Atelier Seaside Scheme by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atelierseaside/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=34 # fg=#242924,bg=#29a329 + ble-face -s vim_airline_a_inactive fg=108,bg=235 # fg=#8ca68c,bg=#242924 + ble-face -s vim_airline_a_insert fg=235,bg=63 # fg=#242924,bg=#3d62f5 + ble-face -s vim_airline_a_replace fg=235,bg=161 # fg=#242924,bg=#e6193c + ble-face -s vim_airline_a_visual fg=235,bg=129 # fg=#242924,bg=#ad2bee + ble-face -s vim_airline_b fg=191,bg=241 # fg=#cfe8cf,bg=#5e6e5e + ble-face -s vim_airline_b_inactive fg=108,bg=235 # fg=#8ca68c,bg=#242924 + ble-face -s vim_airline_c fg=94,bg=235 # fg=#87711d,bg=#242924 + ble-face -s vim_airline_c_inactive fg=108,bg=235 # fg=#8ca68c,bg=#242924 +} diff --git a/.local/share/blesh/contrib/airline/base16_atlas.bash b/.local/share/blesh/contrib/airline/base16_atlas.bash new file mode 100644 index 0000000..985522e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_atlas.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_atlas.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Atlas vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alex Lende (https://ajlende.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_atlas/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=246 # fg=#00384d,bg=#869696 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#00384d,bg=#00384d + ble-face -s vim_airline_a_insert fg=23,bg=107 # fg=#00384d,bg=#7fc06e + ble-face -s vim_airline_a_replace fg=23,bg=97 # fg=#00384d,bg=#9a70a4 + ble-face -s vim_airline_a_visual fg=23,bg=209 # fg=#00384d,bg=#f08e48 + ble-face -s vim_airline_b fg=246,bg=66 # fg=#869696,bg=#517f8d + ble-face -s vim_airline_b_inactive fg=246,bg=23 # fg=#869696,bg=#00384d + ble-face -s vim_airline_c fg=246,bg=23 # fg=#869696,bg=#00384d + ble-face -s vim_airline_c_inactive fg=144,bg=23 # fg=#a1a19a,bg=#00384d + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#fafaf8,bg=#00384d + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#fafaf8,bg=#00384d + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#fafaf8,bg=#00384d + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#fafaf8,bg=#00384d +} diff --git a/.local/share/blesh/contrib/airline/base16_bespin.bash b/.local/share/blesh/contrib/airline/base16_bespin.bash new file mode 100644 index 0000000..bf38499 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_bespin.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_bespin.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Bespin Scheme by Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_bespin/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=58,bg=70 # fg=#36312e,bg=#54be0d + ble-face -s vim_airline_a_inactive fg=106,bg=58 # fg=#8a8986,bg=#36312e + ble-face -s vim_airline_a_insert fg=58,bg=74 # fg=#36312e,bg=#5ea6ea + ble-face -s vim_airline_a_replace fg=58,bg=167 # fg=#36312e,bg=#cf6a4c + ble-face -s vim_airline_a_visual fg=58,bg=139 # fg=#36312e,bg=#9b859d + ble-face -s vim_airline_b fg=144,bg=60 # fg=#9d9b97,bg=#5e5d5c + ble-face -s vim_airline_b_inactive fg=106,bg=58 # fg=#8a8986,bg=#36312e + ble-face -s vim_airline_c fg=173,bg=58 # fg=#cf7d34,bg=#36312e + ble-face -s vim_airline_c_inactive fg=106,bg=58 # fg=#8a8986,bg=#36312e +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal.bash b/.local/share/blesh/contrib/airline/base16_black_metal.bash new file mode 100644 index 0000000..efe0aca --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=174 # fg=#121212,bg=#dd9999 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_bathory.bash b/.local/share/blesh/contrib/airline/base16_black_metal_bathory.bash new file mode 100644 index 0000000..6de3f96 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_bathory.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_bathory.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Bathory) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_bathory/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=222 # fg=#121212,bg=#fbcb97 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_burzum.bash b/.local/share/blesh/contrib/airline/base16_black_metal_burzum.bash new file mode 100644 index 0000000..b469f85 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_burzum.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_burzum.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Burzum) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_burzum/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=194 # fg=#121212,bg=#ddeecc + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_dark_funeral.bash b/.local/share/blesh/contrib/airline/base16_black_metal_dark_funeral.bash new file mode 100644 index 0000000..87f02d7 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_dark_funeral.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_dark_funeral.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Dark Funeral) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_dark_funeral/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=189 # fg=#121212,bg=#d0dfee + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_gorgoroth.bash b/.local/share/blesh/contrib/airline/base16_black_metal_gorgoroth.bash new file mode 100644 index 0000000..c41320a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_gorgoroth.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_gorgoroth.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Gorgoroth) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_gorgoroth/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=138 # fg=#121212,bg=#9b8d7f + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_immortal.bash b/.local/share/blesh/contrib/airline/base16_black_metal_immortal.bash new file mode 100644 index 0000000..c3911cb --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_immortal.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_immortal.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Immortal) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_immortal/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=103 # fg=#121212,bg=#7799bb + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_khold.bash b/.local/share/blesh/contrib/airline/base16_black_metal_khold.bash new file mode 100644 index 0000000..9403421 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_khold.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_khold.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Khold) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_khold/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=230 # fg=#121212,bg=#eceee3 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_marduk.bash b/.local/share/blesh/contrib/airline/base16_black_metal_marduk.bash new file mode 100644 index 0000000..214c13e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_marduk.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_marduk.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Marduk) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_marduk/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=248 # fg=#121212,bg=#a5aaa7 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_mayhem.bash b/.local/share/blesh/contrib/airline/base16_black_metal_mayhem.bash new file mode 100644 index 0000000..6768fe4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_mayhem.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_mayhem.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Mayhem) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_mayhem/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=230 # fg=#121212,bg=#f3ecd4 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_nile.bash b/.local/share/blesh/contrib/airline/base16_black_metal_nile.bash new file mode 100644 index 0000000..f71d799 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_nile.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_nile.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Nile) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_nile/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=138 # fg=#121212,bg=#aa9988 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_black_metal_venom.bash b/.local/share/blesh/contrib/airline/base16_black_metal_venom.bash new file mode 100644 index 0000000..9efaf19 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_black_metal_venom.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_black_metal_venom.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Black Metal (Venom) vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By metalelf0 (https://github.com/metalelf0) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_black_metal_venom/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#121212,bg=#121212 + ble-face -s vim_airline_a_insert fg=233,bg=255 # fg=#121212,bg=#f8f7f2 + ble-face -s vim_airline_a_replace fg=233,bg=247 # fg=#121212,bg=#999999 + ble-face -s vim_airline_a_visual fg=233,bg=248 # fg=#121212,bg=#aaaaaa + ble-face -s vim_airline_b fg=247,bg=235 # fg=#999999,bg=#222222 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c fg=247,bg=233 # fg=#999999,bg=#121212 + ble-face -s vim_airline_c_inactive fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_insert_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_normal_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_replace_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 + ble-face -s vim_airline_c_visual_modified fg=251,bg=233 # fg=#c1c1c1,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/base16_brewer.bash b/.local/share/blesh/contrib/airline/base16_brewer.bash new file mode 100644 index 0000000..878991d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_brewer.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_brewer.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Brewer Scheme by Timothée Poisot (http://github.com/tpoisot) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_brewer/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=71 # fg=#2e2f30,bg=#31a354 + ble-face -s vim_airline_a_inactive fg=250,bg=17 # fg=#b7b8b9,bg=#2e2f30 + ble-face -s vim_airline_a_insert fg=17,bg=67 # fg=#2e2f30,bg=#3182bd + ble-face -s vim_airline_a_replace fg=17,bg=160 # fg=#2e2f30,bg=#e31a1c + ble-face -s vim_airline_a_visual fg=17,bg=97 # fg=#2e2f30,bg=#756bb1 + ble-face -s vim_airline_b fg=253,bg=239 # fg=#dadbdc,bg=#515253 + ble-face -s vim_airline_b_inactive fg=250,bg=17 # fg=#b7b8b9,bg=#2e2f30 + ble-face -s vim_airline_c fg=166,bg=17 # fg=#e6550d,bg=#2e2f30 + ble-face -s vim_airline_c_inactive fg=250,bg=17 # fg=#b7b8b9,bg=#2e2f30 +} diff --git a/.local/share/blesh/contrib/airline/base16_bright.bash b/.local/share/blesh/contrib/airline/base16_bright.bash new file mode 100644 index 0000000..7ff5915 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_bright.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_bright.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Bright Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_bright/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=149 # fg=#303030,bg=#a1c659 + ble-face -s vim_airline_a_inactive fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_a_insert fg=236,bg=74 # fg=#303030,bg=#6fb3d2 + ble-face -s vim_airline_a_replace fg=236,bg=196 # fg=#303030,bg=#fb0120 + ble-face -s vim_airline_a_visual fg=236,bg=176 # fg=#303030,bg=#d381c3 + ble-face -s vim_airline_b fg=255,bg=239 # fg=#f5f5f5,bg=#505050 + ble-face -s vim_airline_b_inactive fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_c fg=202,bg=236 # fg=#fc6d24,bg=#303030 + ble-face -s vim_airline_c_inactive fg=254,bg=236 # fg=#e0e0e0,bg=#303030 +} diff --git a/.local/share/blesh/contrib/airline/base16_brogrammer.bash b/.local/share/blesh/contrib/airline/base16_brogrammer.bash new file mode 100644 index 0000000..fbf83de --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_brogrammer.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_brogrammer.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Brogrammer vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Vik Ramanujam (http://github.com/piggyslasher) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_brogrammer/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=196,bg=32 # fg=#f81118,bg=#2a84d2 + ble-face -s vim_airline_a_inactive fg=196,bg=196 # fg=#f81118,bg=#f81118 + ble-face -s vim_airline_a_insert fg=196,bg=214 # fg=#f81118,bg=#f3bd09 + ble-face -s vim_airline_a_replace fg=196,bg=32 # fg=#f81118,bg=#0f7ddb + ble-face -s vim_airline_a_visual fg=196,bg=166 # fg=#f81118,bg=#de352e + ble-face -s vim_airline_b fg=32,bg=41 # fg=#2a84d2,bg=#2dc55e + ble-face -s vim_airline_b_inactive fg=32,bg=196 # fg=#2a84d2,bg=#f81118 + ble-face -s vim_airline_c fg=32,bg=196 # fg=#2a84d2,bg=#f81118 + ble-face -s vim_airline_c_inactive fg=61,bg=196 # fg=#4e5ab7,bg=#f81118 + ble-face -s vim_airline_c_insert_modified fg=253,bg=196 # fg=#d6dbe5,bg=#f81118 + ble-face -s vim_airline_c_normal_modified fg=253,bg=196 # fg=#d6dbe5,bg=#f81118 + ble-face -s vim_airline_c_replace_modified fg=253,bg=196 # fg=#d6dbe5,bg=#f81118 + ble-face -s vim_airline_c_visual_modified fg=253,bg=196 # fg=#d6dbe5,bg=#f81118 +} diff --git a/.local/share/blesh/contrib/airline/base16_brushtrees.bash b/.local/share/blesh/contrib/airline/base16_brushtrees.bash new file mode 100644 index 0000000..66b2f18 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_brushtrees.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_brushtrees.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Brush Trees vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Abraham White <abelincoln.white@gmail.com> + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_brushtrees/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=189,bg=103 # fg=#c9dbdc,bg=#8299a1 + ble-face -s vim_airline_a_inactive fg=189,bg=189 # fg=#c9dbdc,bg=#c9dbdc + ble-face -s vim_airline_a_insert fg=189,bg=108 # fg=#c9dbdc,bg=#87b386 + ble-face -s vim_airline_a_replace fg=189,bg=139 # fg=#c9dbdc,bg=#b386b2 + ble-face -s vim_airline_a_visual fg=189,bg=181 # fg=#c9dbdc,bg=#d8bba2 + ble-face -s vim_airline_b fg=103,bg=152 # fg=#8299a1,bg=#b0c5c8 + ble-face -s vim_airline_b_inactive fg=103,bg=189 # fg=#8299a1,bg=#c9dbdc + ble-face -s vim_airline_c fg=103,bg=189 # fg=#8299a1,bg=#c9dbdc + ble-face -s vim_airline_c_inactive fg=66,bg=189 # fg=#6d828e,bg=#c9dbdc + ble-face -s vim_airline_c_insert_modified fg=240,bg=189 # fg=#485867,bg=#c9dbdc + ble-face -s vim_airline_c_normal_modified fg=240,bg=189 # fg=#485867,bg=#c9dbdc + ble-face -s vim_airline_c_replace_modified fg=240,bg=189 # fg=#485867,bg=#c9dbdc + ble-face -s vim_airline_c_visual_modified fg=240,bg=189 # fg=#485867,bg=#c9dbdc +} diff --git a/.local/share/blesh/contrib/airline/base16_brushtrees_dark.bash b/.local/share/blesh/contrib/airline/base16_brushtrees_dark.bash new file mode 100644 index 0000000..072b361 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_brushtrees_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_brushtrees_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Brush Trees Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Abraham White <abelincoln.white@gmail.com> + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_brushtrees_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=60,bg=109 # fg=#5a6d7a,bg=#98afb5 + ble-face -s vim_airline_a_inactive fg=60,bg=60 # fg=#5a6d7a,bg=#5a6d7a + ble-face -s vim_airline_a_insert fg=60,bg=108 # fg=#5a6d7a,bg=#87b386 + ble-face -s vim_airline_a_replace fg=60,bg=139 # fg=#5a6d7a,bg=#b386b2 + ble-face -s vim_airline_a_visual fg=60,bg=181 # fg=#5a6d7a,bg=#d8bba2 + ble-face -s vim_airline_b fg=109,bg=66 # fg=#98afb5,bg=#6d828e + ble-face -s vim_airline_b_inactive fg=109,bg=60 # fg=#98afb5,bg=#5a6d7a + ble-face -s vim_airline_c fg=109,bg=60 # fg=#98afb5,bg=#5a6d7a + ble-face -s vim_airline_c_inactive fg=152,bg=60 # fg=#b0c5c8,bg=#5a6d7a + ble-face -s vim_airline_c_insert_modified fg=195,bg=60 # fg=#e3efef,bg=#5a6d7a + ble-face -s vim_airline_c_normal_modified fg=195,bg=60 # fg=#e3efef,bg=#5a6d7a + ble-face -s vim_airline_c_replace_modified fg=195,bg=60 # fg=#e3efef,bg=#5a6d7a + ble-face -s vim_airline_c_visual_modified fg=195,bg=60 # fg=#e3efef,bg=#5a6d7a +} diff --git a/.local/share/blesh/contrib/airline/base16_chalk.bash b/.local/share/blesh/contrib/airline/base16_chalk.bash new file mode 100644 index 0000000..76bedb4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_chalk.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_chalk.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Chalk Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_chalk/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=143 # fg=#202020,bg=#acc267 + ble-face -s vim_airline_a_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=75 # fg=#202020,bg=#6fc2ef + ble-face -s vim_airline_a_replace fg=234,bg=217 # fg=#202020,bg=#fb9fb1 + ble-face -s vim_airline_a_visual fg=234,bg=183 # fg=#202020,bg=#e1a3ee + ble-face -s vim_airline_b fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c fg=216,bg=234 # fg=#eda987,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_circus.bash b/.local/share/blesh/contrib/airline/base16_circus.bash new file mode 100644 index 0000000..e87daa4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_circus.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_circus.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Circus vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Stephan Boyer (https://github.com/stepchowfun) and Esther Wang (https://github.com/ewang12) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_circus/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=239 # fg=#202020,bg=#505050 + ble-face -s vim_airline_a_inactive fg=234,bg=234 # fg=#202020,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=108 # fg=#202020,bg=#84b97c + ble-face -s vim_airline_a_replace fg=234,bg=140 # fg=#202020,bg=#b888e2 + ble-face -s vim_airline_a_visual fg=234,bg=73 # fg=#202020,bg=#4bb1a7 + ble-face -s vim_airline_b fg=239,bg=236 # fg=#505050,bg=#303030 + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#505050,bg=#202020 + ble-face -s vim_airline_c fg=239,bg=234 # fg=#505050,bg=#202020 + ble-face -s vim_airline_c_inactive fg=248,bg=234 # fg=#a7a7a7,bg=#202020 + ble-face -s vim_airline_c_insert_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_normal_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_replace_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_visual_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_classic.bash b/.local/share/blesh/contrib/airline/base16_classic.bash new file mode 100644 index 0000000..2b2a831 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_classic.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_classic.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Classic Scheme by Jason Heeris (http://heeris.id.au) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_classic/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=107 # fg=#202020,bg=#90a959 + ble-face -s vim_airline_a_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=73 # fg=#202020,bg=#6a9fb5 + ble-face -s vim_airline_a_replace fg=234,bg=131 # fg=#202020,bg=#ac4142 + ble-face -s vim_airline_a_visual fg=234,bg=139 # fg=#202020,bg=#aa759f + ble-face -s vim_airline_b fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c fg=173,bg=234 # fg=#d28445,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_classic_dark.bash b/.local/share/blesh/contrib/airline/base16_classic_dark.bash new file mode 100644 index 0000000..2de8e9c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_classic_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_classic_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Classic Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jason Heeris (http://heeris.id.au) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_classic_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=149 # fg=#202020,bg=#b0b0b0 + ble-face -s vim_airline_a_inactive fg=234,bg=234 # fg=#202020,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=107 # fg=#202020,bg=#90a959 + ble-face -s vim_airline_a_replace fg=234,bg=139 # fg=#202020,bg=#aa759f + ble-face -s vim_airline_a_visual fg=234,bg=173 # fg=#202020,bg=#d28445 + ble-face -s vim_airline_b fg=149,bg=236 # fg=#b0b0b0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=149,bg=234 # fg=#b0b0b0,bg=#202020 + ble-face -s vim_airline_c fg=149,bg=234 # fg=#b0b0b0,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c_insert_modified fg=255,bg=234 # fg=#f5f5f5,bg=#202020 + ble-face -s vim_airline_c_normal_modified fg=255,bg=234 # fg=#f5f5f5,bg=#202020 + ble-face -s vim_airline_c_replace_modified fg=255,bg=234 # fg=#f5f5f5,bg=#202020 + ble-face -s vim_airline_c_visual_modified fg=255,bg=234 # fg=#f5f5f5,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_classic_light.bash b/.local/share/blesh/contrib/airline/base16_classic_light.bash new file mode 100644 index 0000000..8cd4fe9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_classic_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_classic_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Classic Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jason Heeris (http://heeris.id.au) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_classic_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=239 # fg=#e0e0e0,bg=#505050 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e0e0e0,bg=#e0e0e0 + ble-face -s vim_airline_a_insert fg=254,bg=107 # fg=#e0e0e0,bg=#90a959 + ble-face -s vim_airline_a_replace fg=254,bg=139 # fg=#e0e0e0,bg=#aa759f + ble-face -s vim_airline_a_visual fg=254,bg=173 # fg=#e0e0e0,bg=#d28445 + ble-face -s vim_airline_b fg=239,bg=252 # fg=#505050,bg=#d0d0d0 + ble-face -s vim_airline_b_inactive fg=239,bg=254 # fg=#505050,bg=#e0e0e0 + ble-face -s vim_airline_c fg=239,bg=254 # fg=#505050,bg=#e0e0e0 + ble-face -s vim_airline_c_inactive fg=236,bg=254 # fg=#303030,bg=#e0e0e0 + ble-face -s vim_airline_c_insert_modified fg=233,bg=254 # fg=#151515,bg=#e0e0e0 + ble-face -s vim_airline_c_normal_modified fg=233,bg=254 # fg=#151515,bg=#e0e0e0 + ble-face -s vim_airline_c_replace_modified fg=233,bg=254 # fg=#151515,bg=#e0e0e0 + ble-face -s vim_airline_c_visual_modified fg=233,bg=254 # fg=#151515,bg=#e0e0e0 +} diff --git a/.local/share/blesh/contrib/airline/base16_codeschool.bash b/.local/share/blesh/contrib/airline/base16_codeschool.bash new file mode 100644 index 0000000..2ec6871 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_codeschool.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_codeschool.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Codeschool Scheme by brettof86 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_codeschool/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=30 # fg=#1c3657,bg=#237986 + ble-face -s vim_airline_a_inactive fg=248,bg=23 # fg=#9ea7a6,bg=#1c3657 + ble-face -s vim_airline_a_insert fg=23,bg=60 # fg=#1c3657,bg=#484d79 + ble-face -s vim_airline_a_replace fg=23,bg=24 # fg=#1c3657,bg=#2a5491 + ble-face -s vim_airline_a_visual fg=23,bg=172 # fg=#1c3657,bg=#c59820 + ble-face -s vim_airline_b fg=151,bg=23 # fg=#a7cfa3,bg=#2a343a + ble-face -s vim_airline_b_inactive fg=248,bg=23 # fg=#9ea7a6,bg=#1c3657 + ble-face -s vim_airline_c fg=64,bg=23 # fg=#43820d,bg=#1c3657 + ble-face -s vim_airline_c_inactive fg=248,bg=23 # fg=#9ea7a6,bg=#1c3657 +} diff --git a/.local/share/blesh/contrib/airline/base16_colors.bash b/.local/share/blesh/contrib/airline/base16_colors.bash new file mode 100644 index 0000000..65f9128 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_colors.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_colors.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Colors Scheme by mrmrs (http://clrs.cc) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_colors/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=41 # fg=#333333,bg=#2ecc40 + ble-face -s vim_airline_a_inactive fg=250,bg=236 # fg=#bbbbbb,bg=#333333 + ble-face -s vim_airline_a_insert fg=236,bg=32 # fg=#333333,bg=#0074d9 + ble-face -s vim_airline_a_replace fg=236,bg=203 # fg=#333333,bg=#ff4136 + ble-face -s vim_airline_a_visual fg=236,bg=128 # fg=#333333,bg=#b10dc9 + ble-face -s vim_airline_b fg=253,bg=240 # fg=#dddddd,bg=#555555 + ble-face -s vim_airline_b_inactive fg=250,bg=236 # fg=#bbbbbb,bg=#333333 + ble-face -s vim_airline_c fg=208,bg=236 # fg=#ff851b,bg=#333333 + ble-face -s vim_airline_c_inactive fg=250,bg=236 # fg=#bbbbbb,bg=#333333 +} diff --git a/.local/share/blesh/contrib/airline/base16_cupcake.bash b/.local/share/blesh/contrib/airline/base16_cupcake.bash new file mode 100644 index 0000000..6a300a6 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_cupcake.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_cupcake.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Cupcake vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_cupcake/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=248 # fg=#f2f1f4,bg=#a59daf + ble-face -s vim_airline_a_inactive fg=255,bg=255 # fg=#f2f1f4,bg=#f2f1f4 + ble-face -s vim_airline_a_insert fg=255,bg=143 # fg=#f2f1f4,bg=#a3b367 + ble-face -s vim_airline_a_replace fg=255,bg=139 # fg=#f2f1f4,bg=#bb99b4 + ble-face -s vim_airline_a_visual fg=255,bg=216 # fg=#f2f1f4,bg=#ebb790 + ble-face -s vim_airline_b fg=248,bg=253 # fg=#a59daf,bg=#d8d5dd + ble-face -s vim_airline_b_inactive fg=248,bg=255 # fg=#a59daf,bg=#f2f1f4 + ble-face -s vim_airline_c fg=248,bg=255 # fg=#a59daf,bg=#f2f1f4 + ble-face -s vim_airline_c_inactive fg=245,bg=255 # fg=#8b8198,bg=#f2f1f4 + ble-face -s vim_airline_c_insert_modified fg=240,bg=255 # fg=#585062,bg=#f2f1f4 + ble-face -s vim_airline_c_normal_modified fg=240,bg=255 # fg=#585062,bg=#f2f1f4 + ble-face -s vim_airline_c_replace_modified fg=240,bg=255 # fg=#585062,bg=#f2f1f4 + ble-face -s vim_airline_c_visual_modified fg=240,bg=255 # fg=#585062,bg=#f2f1f4 +} diff --git a/.local/share/blesh/contrib/airline/base16_cupertino.bash b/.local/share/blesh/contrib/airline/base16_cupertino.bash new file mode 100644 index 0000000..4359575 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_cupertino.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_cupertino.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Cupertino vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Defman21 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_cupertino/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=250,bg=244 # fg=#c0c0c0,bg=#808080 + ble-face -s vim_airline_a_inactive fg=250,bg=250 # fg=#c0c0c0,bg=#c0c0c0 + ble-face -s vim_airline_a_insert fg=250,bg=28 # fg=#c0c0c0,bg=#007400 + ble-face -s vim_airline_a_replace fg=250,bg=126 # fg=#c0c0c0,bg=#a90d91 + ble-face -s vim_airline_a_visual fg=250,bg=208 # fg=#c0c0c0,bg=#eb8500 + ble-face -s vim_airline_b fg=244,bg=250 # fg=#808080,bg=#c0c0c0 + ble-face -s vim_airline_c fg=244,bg=250 # fg=#808080,bg=#c0c0c0 + ble-face -s vim_airline_c_inactive fg=238,bg=250 # fg=#404040,bg=#c0c0c0 + ble-face -s vim_airline_c_insert_modified fg=61,bg=250 # fg=#5e5e5e,bg=#c0c0c0 + ble-face -s vim_airline_c_normal_modified fg=61,bg=250 # fg=#5e5e5e,bg=#c0c0c0 + ble-face -s vim_airline_c_replace_modified fg=61,bg=250 # fg=#5e5e5e,bg=#c0c0c0 + ble-face -s vim_airline_c_visual_modified fg=61,bg=250 # fg=#5e5e5e,bg=#c0c0c0 +} diff --git a/.local/share/blesh/contrib/airline/base16_darktooth.bash b/.local/share/blesh/contrib/airline/base16_darktooth.bash new file mode 100644 index 0000000..34b64bc --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_darktooth.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_darktooth.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Darktooth vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jason Milkins (https://github.com/jasonm23) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_darktooth/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=58,bg=244 # fg=#32302f,bg=#928374 + ble-face -s vim_airline_a_inactive fg=58,bg=58 # fg=#32302f,bg=#32302f + ble-face -s vim_airline_a_insert fg=58,bg=108 # fg=#32302f,bg=#95c085 + ble-face -s vim_airline_a_replace fg=58,bg=96 # fg=#32302f,bg=#8f4673 + ble-face -s vim_airline_a_visual fg=58,bg=208 # fg=#32302f,bg=#fe8625 + ble-face -s vim_airline_b fg=244,bg=239 # fg=#928374,bg=#504945 + ble-face -s vim_airline_b_inactive fg=244,bg=58 # fg=#928374,bg=#32302f + ble-face -s vim_airline_c fg=244,bg=58 # fg=#928374,bg=#32302f + ble-face -s vim_airline_c_inactive fg=138,bg=58 # fg=#a89984,bg=#32302f + ble-face -s vim_airline_c_insert_modified fg=229,bg=58 # fg=#fdf4c1,bg=#32302f + ble-face -s vim_airline_c_normal_modified fg=229,bg=58 # fg=#fdf4c1,bg=#32302f + ble-face -s vim_airline_c_replace_modified fg=229,bg=58 # fg=#fdf4c1,bg=#32302f + ble-face -s vim_airline_c_visual_modified fg=229,bg=58 # fg=#fdf4c1,bg=#32302f +} diff --git a/.local/share/blesh/contrib/airline/base16_decaf.bash b/.local/share/blesh/contrib/airline/base16_decaf.bash new file mode 100644 index 0000000..ab38a7a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_decaf.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_decaf.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Decaf vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alex Mirrington (https://github.com/alexmirrington) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_decaf/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=249 # fg=#393939,bg=#b4b7b4 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#393939,bg=#393939 + ble-face -s vim_airline_a_insert fg=237,bg=150 # fg=#393939,bg=#beda78 + ble-face -s vim_airline_a_replace fg=237,bg=219 # fg=#393939,bg=#efb3f7 + ble-face -s vim_airline_a_visual fg=237,bg=215 # fg=#393939,bg=#ffbf70 + ble-face -s vim_airline_b fg=249,bg=239 # fg=#b4b7b4,bg=#515151 + ble-face -s vim_airline_b_inactive fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c_inactive fg=252,bg=237 # fg=#cccccc,bg=#393939 + ble-face -s vim_airline_c_insert_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_normal_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_replace_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_visual_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 +} diff --git a/.local/share/blesh/contrib/airline/base16_default.bash b/.local/share/blesh/contrib/airline/base16_default.bash new file mode 100644 index 0000000..4f307aa --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_default.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_default.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Default Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_default/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=143 # fg=#282828,bg=#a1b56c + ble-face -s vim_airline_a_inactive fg=192,bg=235 # fg=#d8d8d8,bg=#282828 + ble-face -s vim_airline_a_insert fg=235,bg=109 # fg=#282828,bg=#7cafc2 + ble-face -s vim_airline_a_replace fg=235,bg=131 # fg=#282828,bg=#ab4642 + ble-face -s vim_airline_a_visual fg=235,bg=139 # fg=#282828,bg=#ba8baf + ble-face -s vim_airline_b fg=254,bg=237 # fg=#e8e8e8,bg=#383838 + ble-face -s vim_airline_b_inactive fg=192,bg=235 # fg=#d8d8d8,bg=#282828 + ble-face -s vim_airline_c fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_inactive fg=192,bg=235 # fg=#d8d8d8,bg=#282828 +} diff --git a/.local/share/blesh/contrib/airline/base16_default_dark.bash b/.local/share/blesh/contrib/airline/base16_default_dark.bash new file mode 100644 index 0000000..4844af5 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_default_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_default_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Default Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_default_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=250 # fg=#282828,bg=#b8b8b8 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#282828,bg=#282828 + ble-face -s vim_airline_a_insert fg=235,bg=143 # fg=#282828,bg=#a1b56c + ble-face -s vim_airline_a_replace fg=235,bg=139 # fg=#282828,bg=#ba8baf + ble-face -s vim_airline_a_visual fg=235,bg=173 # fg=#282828,bg=#dc9656 + ble-face -s vim_airline_b fg=250,bg=237 # fg=#b8b8b8,bg=#383838 + ble-face -s vim_airline_b_inactive fg=250,bg=235 # fg=#b8b8b8,bg=#282828 + ble-face -s vim_airline_c fg=250,bg=235 # fg=#b8b8b8,bg=#282828 + ble-face -s vim_airline_c_inactive fg=192,bg=235 # fg=#d8d8d8,bg=#282828 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#f8f8f8,bg=#282828 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#f8f8f8,bg=#282828 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#f8f8f8,bg=#282828 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#f8f8f8,bg=#282828 +} diff --git a/.local/share/blesh/contrib/airline/base16_default_light.bash b/.local/share/blesh/contrib/airline/base16_default_light.bash new file mode 100644 index 0000000..d365deb --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_default_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_default_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Default Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_default_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=240 # fg=#e8e8e8,bg=#585858 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e8e8e8,bg=#e8e8e8 + ble-face -s vim_airline_a_insert fg=254,bg=143 # fg=#e8e8e8,bg=#a1b56c + ble-face -s vim_airline_a_replace fg=254,bg=139 # fg=#e8e8e8,bg=#ba8baf + ble-face -s vim_airline_a_visual fg=254,bg=173 # fg=#e8e8e8,bg=#dc9656 + ble-face -s vim_airline_b fg=240,bg=192 # fg=#585858,bg=#d8d8d8 + ble-face -s vim_airline_b_inactive fg=240,bg=254 # fg=#585858,bg=#e8e8e8 + ble-face -s vim_airline_c fg=240,bg=254 # fg=#585858,bg=#e8e8e8 + ble-face -s vim_airline_c_inactive fg=237,bg=254 # fg=#383838,bg=#e8e8e8 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 +} diff --git a/.local/share/blesh/contrib/airline/base16_dracula.bash b/.local/share/blesh/contrib/airline/base16_dracula.bash new file mode 100644 index 0000000..3e7696e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_dracula.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_dracula.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Dracula vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Mike Barkmin (http://github.com/mikebarkmin) based on Dracula Theme (http://github.com/dracula) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_dracula/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=80 # fg=#3a3c4e,bg=#62d6e8 + ble-face -s vim_airline_a_inactive fg=238,bg=238 # fg=#3a3c4e,bg=#3a3c4e + ble-face -s vim_airline_a_insert fg=238,bg=228 # fg=#3a3c4e,bg=#ebff87 + ble-face -s vim_airline_a_replace fg=238,bg=134 # fg=#3a3c4e,bg=#b45bcf + ble-face -s vim_airline_a_visual fg=238,bg=134 # fg=#3a3c4e,bg=#b45bcf + ble-face -s vim_airline_b fg=80,bg=240 # fg=#62d6e8,bg=#4d4f68 + ble-face -s vim_airline_b_inactive fg=80,bg=238 # fg=#62d6e8,bg=#3a3c4e + ble-face -s vim_airline_c fg=80,bg=238 # fg=#62d6e8,bg=#3a3c4e + ble-face -s vim_airline_c_inactive fg=189,bg=238 # fg=#e9e9f4,bg=#3a3c4e + ble-face -s vim_airline_c_insert_modified fg=231,bg=238 # fg=#f7f7fb,bg=#3a3c4e + ble-face -s vim_airline_c_normal_modified fg=231,bg=238 # fg=#f7f7fb,bg=#3a3c4e + ble-face -s vim_airline_c_replace_modified fg=231,bg=238 # fg=#f7f7fb,bg=#3a3c4e + ble-face -s vim_airline_c_visual_modified fg=231,bg=238 # fg=#f7f7fb,bg=#3a3c4e +} diff --git a/.local/share/blesh/contrib/airline/base16_edge_dark.bash b/.local/share/blesh/contrib/airline/base16_edge_dark.bash new file mode 100644 index 0000000..5f83268 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_edge_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_edge_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Edge Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Sainnhepark (https://github.com/sainnhe) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_edge_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=103,bg=110 # fg=#88909f,bg=#73b3e7 + ble-face -s vim_airline_a_inactive fg=103,bg=103 # fg=#88909f,bg=#88909f + ble-face -s vim_airline_a_insert fg=103,bg=144 # fg=#88909f,bg=#a1bf78 + ble-face -s vim_airline_a_replace fg=103,bg=176 # fg=#88909f,bg=#d390e7 + ble-face -s vim_airline_a_visual fg=103,bg=167 # fg=#88909f,bg=#e77171 + ble-face -s vim_airline_b fg=110,bg=146 # fg=#73b3e7,bg=#b7bec9 + ble-face -s vim_airline_b_inactive fg=110,bg=103 # fg=#73b3e7,bg=#88909f + ble-face -s vim_airline_c fg=110,bg=103 # fg=#73b3e7,bg=#88909f + ble-face -s vim_airline_c_inactive fg=146,bg=103 # fg=#b7bec9,bg=#88909f + ble-face -s vim_airline_c_insert_modified fg=238,bg=103 # fg=#3e4249,bg=#88909f + ble-face -s vim_airline_c_normal_modified fg=238,bg=103 # fg=#3e4249,bg=#88909f + ble-face -s vim_airline_c_replace_modified fg=238,bg=103 # fg=#3e4249,bg=#88909f + ble-face -s vim_airline_c_visual_modified fg=238,bg=103 # fg=#3e4249,bg=#88909f +} diff --git a/.local/share/blesh/contrib/airline/base16_edge_light.bash b/.local/share/blesh/contrib/airline/base16_edge_light.bash new file mode 100644 index 0000000..692a84f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_edge_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_edge_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Edge Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Sainnhepark (https://github.com/sainnhe) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_edge_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=107,bg=67 # fg=#7c9f4b,bg=#6587bf + ble-face -s vim_airline_a_inactive fg=107,bg=107 # fg=#7c9f4b,bg=#7c9f4b + ble-face -s vim_airline_a_insert fg=107,bg=107 # fg=#7c9f4b,bg=#7c9f4b + ble-face -s vim_airline_a_replace fg=107,bg=134 # fg=#7c9f4b,bg=#b870ce + ble-face -s vim_airline_a_visual fg=107,bg=167 # fg=#7c9f4b,bg=#db7070 + ble-face -s vim_airline_b fg=67,bg=172 # fg=#6587bf,bg=#d69822 + ble-face -s vim_airline_b_inactive fg=67,bg=107 # fg=#6587bf,bg=#7c9f4b + ble-face -s vim_airline_c fg=67,bg=107 # fg=#6587bf,bg=#7c9f4b + ble-face -s vim_airline_c_inactive fg=241,bg=107 # fg=#5e646f,bg=#7c9f4b + ble-face -s vim_airline_c_insert_modified fg=241,bg=107 # fg=#5e646f,bg=#7c9f4b + ble-face -s vim_airline_c_normal_modified fg=241,bg=107 # fg=#5e646f,bg=#7c9f4b + ble-face -s vim_airline_c_replace_modified fg=241,bg=107 # fg=#5e646f,bg=#7c9f4b + ble-face -s vim_airline_c_visual_modified fg=241,bg=107 # fg=#5e646f,bg=#7c9f4b +} diff --git a/.local/share/blesh/contrib/airline/base16_eighties.bash b/.local/share/blesh/contrib/airline/base16_eighties.bash new file mode 100644 index 0000000..c1b244c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_eighties.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_eighties.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Eighties Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_eighties/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=114 # fg=#393939,bg=#99cc99 + ble-face -s vim_airline_a_inactive fg=252,bg=237 # fg=#d3d0c8,bg=#393939 + ble-face -s vim_airline_a_insert fg=237,bg=68 # fg=#393939,bg=#6699cc + ble-face -s vim_airline_a_replace fg=237,bg=210 # fg=#393939,bg=#f2777a + ble-face -s vim_airline_a_visual fg=237,bg=176 # fg=#393939,bg=#cc99cc + ble-face -s vim_airline_b fg=254,bg=239 # fg=#e8e6df,bg=#515151 + ble-face -s vim_airline_b_inactive fg=252,bg=237 # fg=#d3d0c8,bg=#393939 + ble-face -s vim_airline_c fg=209,bg=237 # fg=#f99157,bg=#393939 + ble-face -s vim_airline_c_inactive fg=252,bg=237 # fg=#d3d0c8,bg=#393939 +} diff --git a/.local/share/blesh/contrib/airline/base16_embers.bash b/.local/share/blesh/contrib/airline/base16_embers.bash new file mode 100644 index 0000000..804ff5e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_embers.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_embers.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Embers Scheme by Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_embers/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=65 # fg=#2c2620,bg=#57826d + ble-face -s vim_airline_a_inactive fg=138,bg=235 # fg=#a39a90,bg=#2c2620 + ble-face -s vim_airline_a_insert fg=235,bg=60 # fg=#2c2620,bg=#6d5782 + ble-face -s vim_airline_a_replace fg=235,bg=95 # fg=#2c2620,bg=#826d57 + ble-face -s vim_airline_a_visual fg=235,bg=95 # fg=#2c2620,bg=#82576d + ble-face -s vim_airline_b fg=249,bg=237 # fg=#beb6ae,bg=#433b32 + ble-face -s vim_airline_b_inactive fg=138,bg=235 # fg=#a39a90,bg=#2c2620 + ble-face -s vim_airline_c fg=101,bg=235 # fg=#828257,bg=#2c2620 + ble-face -s vim_airline_c_inactive fg=138,bg=235 # fg=#a39a90,bg=#2c2620 +} diff --git a/.local/share/blesh/contrib/airline/base16_espresso.bash b/.local/share/blesh/contrib/airline/base16_espresso.bash new file mode 100644 index 0000000..900dc19 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_espresso.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_espresso.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Espresso vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alex Mirrington (https://github.com/alexmirrington) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_espresso/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=249 # fg=#393939,bg=#b4b7b4 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#393939,bg=#393939 + ble-face -s vim_airline_a_insert fg=237,bg=143 # fg=#393939,bg=#a5c261 + ble-face -s vim_airline_a_replace fg=237,bg=176 # fg=#393939,bg=#d197d9 + ble-face -s vim_airline_a_visual fg=237,bg=215 # fg=#393939,bg=#f9a959 + ble-face -s vim_airline_b fg=249,bg=239 # fg=#b4b7b4,bg=#515151 + ble-face -s vim_airline_b_inactive fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c_inactive fg=252,bg=237 # fg=#cccccc,bg=#393939 + ble-face -s vim_airline_c_insert_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_normal_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_replace_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_visual_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 +} diff --git a/.local/share/blesh/contrib/airline/base16_flat.bash b/.local/share/blesh/contrib/airline/base16_flat.bash new file mode 100644 index 0000000..4466c5b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_flat.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_flat.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Flat Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_flat/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=239,bg=41 # fg=#34495e,bg=#2ecc71 + ble-face -s vim_airline_a_inactive fg=254,bg=239 # fg=#e0e0e0,bg=#34495e + ble-face -s vim_airline_a_insert fg=239,bg=68 # fg=#34495e,bg=#3498db + ble-face -s vim_airline_a_replace fg=239,bg=167 # fg=#34495e,bg=#e74c3c + ble-face -s vim_airline_a_visual fg=239,bg=133 # fg=#34495e,bg=#9b59b6 + ble-face -s vim_airline_b fg=255,bg=106 # fg=#f5f5f5,bg=#7f8c8d + ble-face -s vim_airline_b_inactive fg=254,bg=239 # fg=#e0e0e0,bg=#34495e + ble-face -s vim_airline_c fg=172,bg=239 # fg=#e67e22,bg=#34495e + ble-face -s vim_airline_c_inactive fg=254,bg=239 # fg=#e0e0e0,bg=#34495e +} diff --git a/.local/share/blesh/contrib/airline/base16_framer.bash b/.local/share/blesh/contrib/airline/base16_framer.bash new file mode 100644 index 0000000..5999c88 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_framer.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_framer.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Framer vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Framer (Maintained by Jesse Hoyos) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_framer/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=250 # fg=#151515,bg=#b9b9b9 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#151515,bg=#151515 + ble-face -s vim_airline_a_insert fg=233,bg=80 # fg=#151515,bg=#32ccdc + ble-face -s vim_airline_a_replace fg=233,bg=141 # fg=#151515,bg=#ba8cfc + ble-face -s vim_airline_a_visual fg=233,bg=203 # fg=#151515,bg=#fc4769 + ble-face -s vim_airline_b fg=250,bg=238 # fg=#b9b9b9,bg=#464646 + ble-face -s vim_airline_b_inactive fg=250,bg=233 # fg=#b9b9b9,bg=#151515 + ble-face -s vim_airline_c fg=250,bg=233 # fg=#b9b9b9,bg=#151515 + ble-face -s vim_airline_c_inactive fg=252,bg=233 # fg=#d0d0d0,bg=#151515 + ble-face -s vim_airline_c_insert_modified fg=255,bg=233 # fg=#eeeeee,bg=#151515 + ble-face -s vim_airline_c_normal_modified fg=255,bg=233 # fg=#eeeeee,bg=#151515 + ble-face -s vim_airline_c_replace_modified fg=255,bg=233 # fg=#eeeeee,bg=#151515 + ble-face -s vim_airline_c_visual_modified fg=255,bg=233 # fg=#eeeeee,bg=#151515 +} diff --git a/.local/share/blesh/contrib/airline/base16_fruit_soda.bash b/.local/share/blesh/contrib/airline/base16_fruit_soda.bash new file mode 100644 index 0000000..2f83d50 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_fruit_soda.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_fruit_soda.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Fruit Soda vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By jozip + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_fruit_soda/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=246 # fg=#e0dee0,bg=#979598 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e0dee0,bg=#e0dee0 + ble-face -s vim_airline_a_insert fg=254,bg=83 # fg=#e0dee0,bg=#47f74c + ble-face -s vim_airline_a_replace fg=254,bg=56 # fg=#e0dee0,bg=#611fce + ble-face -s vim_airline_a_visual fg=254,bg=202 # fg=#e0dee0,bg=#fe6d08 + ble-face -s vim_airline_b fg=246,bg=190 # fg=#979598,bg=#d8d5d5 + ble-face -s vim_airline_b_inactive fg=246,bg=254 # fg=#979598,bg=#e0dee0 + ble-face -s vim_airline_c fg=246,bg=254 # fg=#979598,bg=#e0dee0 + ble-face -s vim_airline_c_inactive fg=239,bg=254 # fg=#515151,bg=#e0dee0 + ble-face -s vim_airline_c_insert_modified fg=236,bg=254 # fg=#2d2c2c,bg=#e0dee0 + ble-face -s vim_airline_c_normal_modified fg=236,bg=254 # fg=#2d2c2c,bg=#e0dee0 + ble-face -s vim_airline_c_replace_modified fg=236,bg=254 # fg=#2d2c2c,bg=#e0dee0 + ble-face -s vim_airline_c_visual_modified fg=236,bg=254 # fg=#2d2c2c,bg=#e0dee0 +} diff --git a/.local/share/blesh/contrib/airline/base16_gigavolt.bash b/.local/share/blesh/contrib/airline/base16_gigavolt.bash new file mode 100644 index 0000000..6452de9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gigavolt.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gigavolt.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gigavolt vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Aidan Swope (http://github.com/Whillikers) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gigavolt/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=189 # fg=#2d303d,bg=#cad3ff + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#2d303d,bg=#2d303d + ble-face -s vim_airline_a_insert fg=23,bg=223 # fg=#2d303d,bg=#f2e6a9 + ble-face -s vim_airline_a_replace fg=23,bg=141 # fg=#2d303d,bg=#ae94f9 + ble-face -s vim_airline_a_visual fg=23,bg=48 # fg=#2d303d,bg=#19f988 + ble-face -s vim_airline_b fg=189,bg=63 # fg=#cad3ff,bg=#5a576e + ble-face -s vim_airline_b_inactive fg=189,bg=23 # fg=#cad3ff,bg=#2d303d + ble-face -s vim_airline_c fg=189,bg=23 # fg=#cad3ff,bg=#2d303d + ble-face -s vim_airline_c_inactive fg=254,bg=23 # fg=#e9e7e1,bg=#2d303d + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#f2fbff,bg=#2d303d + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#f2fbff,bg=#2d303d + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#f2fbff,bg=#2d303d + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#f2fbff,bg=#2d303d +} diff --git a/.local/share/blesh/contrib/airline/base16_github.bash b/.local/share/blesh/contrib/airline/base16_github.bash new file mode 100644 index 0000000..faf3c95 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_github.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_github.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Github vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Defman21 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_github/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=254 # fg=#f5f5f5,bg=#e8e8e8 + ble-face -s vim_airline_a_inactive fg=255,bg=255 # fg=#f5f5f5,bg=#f5f5f5 + ble-face -s vim_airline_a_insert fg=255,bg=24 # fg=#f5f5f5,bg=#183691 + ble-face -s vim_airline_a_replace fg=255,bg=125 # fg=#f5f5f5,bg=#a71d5d + ble-face -s vim_airline_a_visual fg=255,bg=31 # fg=#f5f5f5,bg=#0086b3 + ble-face -s vim_airline_b fg=254,bg=189 # fg=#e8e8e8,bg=#c8c8fa + ble-face -s vim_airline_b_inactive fg=254,bg=255 # fg=#e8e8e8,bg=#f5f5f5 + ble-face -s vim_airline_c fg=254,bg=255 # fg=#e8e8e8,bg=#f5f5f5 + ble-face -s vim_airline_c_inactive fg=236,bg=255 # fg=#333333,bg=#f5f5f5 + ble-face -s vim_airline_c_insert_modified fg=231,bg=255 # fg=#ffffff,bg=#f5f5f5 + ble-face -s vim_airline_c_normal_modified fg=231,bg=255 # fg=#ffffff,bg=#f5f5f5 + ble-face -s vim_airline_c_replace_modified fg=231,bg=255 # fg=#ffffff,bg=#f5f5f5 + ble-face -s vim_airline_c_visual_modified fg=231,bg=255 # fg=#ffffff,bg=#f5f5f5 +} diff --git a/.local/share/blesh/contrib/airline/base16_google.bash b/.local/share/blesh/contrib/airline/base16_google.bash new file mode 100644 index 0000000..b004098 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_google.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_google.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Google Scheme by Seth Wright (http://sethawright.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_google/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=29 # fg=#282a2e,bg=#198844 + ble-face -s vim_airline_a_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_a_insert fg=236,bg=63 # fg=#282a2e,bg=#3971ed + ble-face -s vim_airline_a_replace fg=236,bg=166 # fg=#282a2e,bg=#cc342b + ble-face -s vim_airline_a_visual fg=236,bg=134 # fg=#282a2e,bg=#a36ac7 + ble-face -s vim_airline_b fg=254,bg=237 # fg=#e0e0e0,bg=#373b41 + ble-face -s vim_airline_b_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_c fg=203,bg=236 # fg=#f96a38,bg=#282a2e + ble-face -s vim_airline_c_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e +} diff --git a/.local/share/blesh/contrib/airline/base16_google_dark.bash b/.local/share/blesh/contrib/airline/base16_google_dark.bash new file mode 100644 index 0000000..009d4d4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_google_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_google_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Google Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Seth Wright (http://sethawright.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_google_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=249 # fg=#282a2e,bg=#b4b7b4 + ble-face -s vim_airline_a_inactive fg=236,bg=236 # fg=#282a2e,bg=#282a2e + ble-face -s vim_airline_a_insert fg=236,bg=29 # fg=#282a2e,bg=#198844 + ble-face -s vim_airline_a_replace fg=236,bg=134 # fg=#282a2e,bg=#a36ac7 + ble-face -s vim_airline_a_visual fg=236,bg=203 # fg=#282a2e,bg=#f96a38 + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b4b7b4,bg=#373b41 + ble-face -s vim_airline_b_inactive fg=249,bg=236 # fg=#b4b7b4,bg=#282a2e + ble-face -s vim_airline_c fg=249,bg=236 # fg=#b4b7b4,bg=#282a2e + ble-face -s vim_airline_c_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_c_insert_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_normal_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_replace_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_visual_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e +} diff --git a/.local/share/blesh/contrib/airline/base16_google_light.bash b/.local/share/blesh/contrib/airline/base16_google_light.bash new file mode 100644 index 0000000..6ef4a87 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_google_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_google_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Google Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Seth Wright (http://sethawright.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_google_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=246 # fg=#e0e0e0,bg=#969896 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e0e0e0,bg=#e0e0e0 + ble-face -s vim_airline_a_insert fg=254,bg=29 # fg=#e0e0e0,bg=#198844 + ble-face -s vim_airline_a_replace fg=254,bg=134 # fg=#e0e0e0,bg=#a36ac7 + ble-face -s vim_airline_a_visual fg=254,bg=203 # fg=#e0e0e0,bg=#f96a38 + ble-face -s vim_airline_b fg=246,bg=251 # fg=#969896,bg=#c5c8c6 + ble-face -s vim_airline_b_inactive fg=246,bg=254 # fg=#969896,bg=#e0e0e0 + ble-face -s vim_airline_c fg=246,bg=254 # fg=#969896,bg=#e0e0e0 + ble-face -s vim_airline_c_inactive fg=237,bg=254 # fg=#373b41,bg=#e0e0e0 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#1d1f21,bg=#e0e0e0 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#1d1f21,bg=#e0e0e0 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#1d1f21,bg=#e0e0e0 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#1d1f21,bg=#e0e0e0 +} diff --git a/.local/share/blesh/contrib/airline/base16_grayscale.bash b/.local/share/blesh/contrib/airline/base16_grayscale.bash new file mode 100644 index 0000000..4612620 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_grayscale.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_grayscale.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Grayscale Scheme by Alexandre Gavioli (https://github.com/Alexx2/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_grayscale/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=245 # fg=#252525,bg=#8e8e8e + ble-face -s vim_airline_a_inactive fg=250,bg=235 # fg=#b9b9b9,bg=#252525 + ble-face -s vim_airline_a_insert fg=235,bg=242 # fg=#252525,bg=#686868 + ble-face -s vim_airline_a_replace fg=235,bg=244 # fg=#252525,bg=#7c7c7c + ble-face -s vim_airline_a_visual fg=235,bg=243 # fg=#252525,bg=#747474 + ble-face -s vim_airline_b fg=254,bg=238 # fg=#e3e3e3,bg=#464646 + ble-face -s vim_airline_b_inactive fg=250,bg=235 # fg=#b9b9b9,bg=#252525 + ble-face -s vim_airline_c fg=247,bg=235 # fg=#999999,bg=#252525 + ble-face -s vim_airline_c_inactive fg=250,bg=235 # fg=#b9b9b9,bg=#252525 +} diff --git a/.local/share/blesh/contrib/airline/base16_grayscale_dark.bash b/.local/share/blesh/contrib/airline/base16_grayscale_dark.bash new file mode 100644 index 0000000..fcac9f7 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_grayscale_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_grayscale_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Grayscale Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alexandre Gavioli (https://github.com/Alexx2/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_grayscale_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=248 # fg=#252525,bg=#ababab + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#252525,bg=#252525 + ble-face -s vim_airline_a_insert fg=235,bg=245 # fg=#252525,bg=#8e8e8e + ble-face -s vim_airline_a_replace fg=235,bg=243 # fg=#252525,bg=#747474 + ble-face -s vim_airline_a_visual fg=235,bg=247 # fg=#252525,bg=#999999 + ble-face -s vim_airline_b fg=248,bg=238 # fg=#ababab,bg=#464646 + ble-face -s vim_airline_b_inactive fg=248,bg=235 # fg=#ababab,bg=#252525 + ble-face -s vim_airline_c fg=248,bg=235 # fg=#ababab,bg=#252525 + ble-face -s vim_airline_c_inactive fg=250,bg=235 # fg=#b9b9b9,bg=#252525 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#f7f7f7,bg=#252525 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#f7f7f7,bg=#252525 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#f7f7f7,bg=#252525 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#f7f7f7,bg=#252525 +} diff --git a/.local/share/blesh/contrib/airline/base16_grayscale_light.bash b/.local/share/blesh/contrib/airline/base16_grayscale_light.bash new file mode 100644 index 0000000..1d9f4b5 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_grayscale_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_grayscale_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Grayscale Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alexandre Gavioli (https://github.com/Alexx2/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_grayscale_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=239 # fg=#e3e3e3,bg=#525252 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e3e3e3,bg=#e3e3e3 + ble-face -s vim_airline_a_insert fg=254,bg=245 # fg=#e3e3e3,bg=#8e8e8e + ble-face -s vim_airline_a_replace fg=254,bg=243 # fg=#e3e3e3,bg=#747474 + ble-face -s vim_airline_a_visual fg=254,bg=247 # fg=#e3e3e3,bg=#999999 + ble-face -s vim_airline_b fg=239,bg=250 # fg=#525252,bg=#b9b9b9 + ble-face -s vim_airline_b_inactive fg=239,bg=254 # fg=#525252,bg=#e3e3e3 + ble-face -s vim_airline_c fg=239,bg=254 # fg=#525252,bg=#e3e3e3 + ble-face -s vim_airline_c_inactive fg=238,bg=254 # fg=#464646,bg=#e3e3e3 + ble-face -s vim_airline_c_insert_modified fg=233,bg=254 # fg=#101010,bg=#e3e3e3 + ble-face -s vim_airline_c_normal_modified fg=233,bg=254 # fg=#101010,bg=#e3e3e3 + ble-face -s vim_airline_c_replace_modified fg=233,bg=254 # fg=#101010,bg=#e3e3e3 + ble-face -s vim_airline_c_visual_modified fg=233,bg=254 # fg=#101010,bg=#e3e3e3 +} diff --git a/.local/share/blesh/contrib/airline/base16_greenscreen.bash b/.local/share/blesh/contrib/airline/base16_greenscreen.bash new file mode 100644 index 0000000..43ef4ca --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_greenscreen.bash @@ -0,0 +1,20 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_greenscreen.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Green Screen Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_greenscreen/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=34 # fg=#003300,bg=#00bb00 + ble-face -s vim_airline_a_inactive fg=34,bg=22 # fg=#00bb00,bg=#003300 + ble-face -s vim_airline_a_insert fg=22,bg=28 # fg=#003300,bg=#009900 + ble-face -s vim_airline_a_replace fg=22,bg=28 # fg=#003300,bg=#007700 + ble-face -s vim_airline_b fg=40,bg=22 # fg=#00dd00,bg=#005500 + ble-face -s vim_airline_b_inactive fg=34,bg=22 # fg=#00bb00,bg=#003300 + ble-face -s vim_airline_c fg=28,bg=22 # fg=#009900,bg=#003300 + ble-face -s vim_airline_c_inactive fg=34,bg=22 # fg=#00bb00,bg=#003300 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_dark_hard.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_hard.bash new file mode 100644 index 0000000..32d648d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_hard.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_dark_hard.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by ronald2wing (https://github.com/ronald2wing) +# Base 16 Gruvbox Dark Hard Scheme by Dawid Kurek (https://github.com/dawikur) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_dark_hard/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=142 # fg=#3c3836,bg=#b8bb26 + ble-face -s vim_airline_a_inactive fg=187,bg=237 # fg=#d5c4a1,bg=#3c3836 + ble-face -s vim_airline_a_insert fg=237,bg=108 # fg=#3c3836,bg=#83a598 + ble-face -s vim_airline_a_replace fg=237,bg=203 # fg=#3c3836,bg=#fb4934 + ble-face -s vim_airline_a_visual fg=237,bg=175 # fg=#3c3836,bg=#d3869b + ble-face -s vim_airline_b fg=223,bg=239 # fg=#ebdbb2,bg=#504945 + ble-face -s vim_airline_b_inactive fg=187,bg=237 # fg=#d5c4a1,bg=#3c3836 + ble-face -s vim_airline_c fg=208,bg=237 # fg=#fe8019,bg=#3c3836 + ble-face -s vim_airline_c_inactive fg=187,bg=237 # fg=#d5c4a1,bg=#3c3836 + ble-face -s vim_airline_term fg=208,bg=237 # fg=#fe8019,bg=#3c3836 + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_insert fg=158,bg=234 # fg=#9cffd3,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_dark_medium.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_medium.bash new file mode 100644 index 0000000..c22f521 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_medium.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_dark_medium.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox dark, medium vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_dark_medium/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=144 # fg=#3c3836,bg=#bdae93 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#3c3836,bg=#3c3836 + ble-face -s vim_airline_a_insert fg=237,bg=142 # fg=#3c3836,bg=#b8bb26 + ble-face -s vim_airline_a_replace fg=237,bg=175 # fg=#3c3836,bg=#d3869b + ble-face -s vim_airline_a_visual fg=237,bg=208 # fg=#3c3836,bg=#fe8019 + ble-face -s vim_airline_b fg=144,bg=239 # fg=#bdae93,bg=#504945 + ble-face -s vim_airline_b_inactive fg=144,bg=237 # fg=#bdae93,bg=#3c3836 + ble-face -s vim_airline_c fg=144,bg=237 # fg=#bdae93,bg=#3c3836 + ble-face -s vim_airline_c_inactive fg=187,bg=237 # fg=#d5c4a1,bg=#3c3836 + ble-face -s vim_airline_c_insert_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_normal_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_replace_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_visual_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_dark_pale.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_pale.bash new file mode 100644 index 0000000..d51e929 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_pale.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_dark_pale.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox dark, pale vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_dark_pale/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=246 # fg=#3a3a3a,bg=#949494 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#3a3a3a,bg=#3a3a3a + ble-face -s vim_airline_a_insert fg=237,bg=142 # fg=#3a3a3a,bg=#afaf00 + ble-face -s vim_airline_a_replace fg=237,bg=175 # fg=#3a3a3a,bg=#d485ad + ble-face -s vim_airline_a_visual fg=237,bg=208 # fg=#3a3a3a,bg=#ff8700 + ble-face -s vim_airline_b fg=246,bg=239 # fg=#949494,bg=#4e4e4e + ble-face -s vim_airline_b_inactive fg=246,bg=237 # fg=#949494,bg=#3a3a3a + ble-face -s vim_airline_c fg=246,bg=237 # fg=#949494,bg=#3a3a3a + ble-face -s vim_airline_c_inactive fg=180,bg=237 # fg=#dab997,bg=#3a3a3a + ble-face -s vim_airline_c_insert_modified fg=223,bg=237 # fg=#ebdbb2,bg=#3a3a3a + ble-face -s vim_airline_c_normal_modified fg=223,bg=237 # fg=#ebdbb2,bg=#3a3a3a + ble-face -s vim_airline_c_replace_modified fg=223,bg=237 # fg=#ebdbb2,bg=#3a3a3a + ble-face -s vim_airline_c_visual_modified fg=223,bg=237 # fg=#ebdbb2,bg=#3a3a3a +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_dark_soft.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_soft.bash new file mode 100644 index 0000000..dcb618d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_dark_soft.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_dark_soft.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox dark, soft vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_dark_soft/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=144 # fg=#3c3836,bg=#bdae93 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#3c3836,bg=#3c3836 + ble-face -s vim_airline_a_insert fg=237,bg=142 # fg=#3c3836,bg=#b8bb26 + ble-face -s vim_airline_a_replace fg=237,bg=175 # fg=#3c3836,bg=#d3869b + ble-face -s vim_airline_a_visual fg=237,bg=208 # fg=#3c3836,bg=#fe8019 + ble-face -s vim_airline_b fg=144,bg=239 # fg=#bdae93,bg=#504945 + ble-face -s vim_airline_b_inactive fg=144,bg=237 # fg=#bdae93,bg=#3c3836 + ble-face -s vim_airline_c fg=144,bg=237 # fg=#bdae93,bg=#3c3836 + ble-face -s vim_airline_c_inactive fg=187,bg=237 # fg=#d5c4a1,bg=#3c3836 + ble-face -s vim_airline_c_insert_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_normal_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_replace_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 + ble-face -s vim_airline_c_visual_modified fg=230,bg=237 # fg=#fbf1c7,bg=#3c3836 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_light_hard.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_light_hard.bash new file mode 100644 index 0000000..5dac3d3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_light_hard.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_light_hard.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox light, hard vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_light_hard/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=223,bg=60 # fg=#ebdbb2,bg=#665c54 + ble-face -s vim_airline_a_inactive fg=223,bg=223 # fg=#ebdbb2,bg=#ebdbb2 + ble-face -s vim_airline_a_insert fg=223,bg=100 # fg=#ebdbb2,bg=#79740e + ble-face -s vim_airline_a_replace fg=223,bg=95 # fg=#ebdbb2,bg=#8f3f71 + ble-face -s vim_airline_a_visual fg=223,bg=130 # fg=#ebdbb2,bg=#af3a03 + ble-face -s vim_airline_b fg=60,bg=187 # fg=#665c54,bg=#d5c4a1 + ble-face -s vim_airline_b_inactive fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c_inactive fg=239,bg=223 # fg=#504945,bg=#ebdbb2 + ble-face -s vim_airline_c_insert_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_normal_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_replace_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_visual_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_light_medium.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_light_medium.bash new file mode 100644 index 0000000..202c594 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_light_medium.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_light_medium.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox light, medium vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_light_medium/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=223,bg=60 # fg=#ebdbb2,bg=#665c54 + ble-face -s vim_airline_a_inactive fg=223,bg=223 # fg=#ebdbb2,bg=#ebdbb2 + ble-face -s vim_airline_a_insert fg=223,bg=100 # fg=#ebdbb2,bg=#79740e + ble-face -s vim_airline_a_replace fg=223,bg=95 # fg=#ebdbb2,bg=#8f3f71 + ble-face -s vim_airline_a_visual fg=223,bg=130 # fg=#ebdbb2,bg=#af3a03 + ble-face -s vim_airline_b fg=60,bg=187 # fg=#665c54,bg=#d5c4a1 + ble-face -s vim_airline_b_inactive fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c_inactive fg=239,bg=223 # fg=#504945,bg=#ebdbb2 + ble-face -s vim_airline_c_insert_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_normal_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_replace_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_visual_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 +} diff --git a/.local/share/blesh/contrib/airline/base16_gruvbox_light_soft.bash b/.local/share/blesh/contrib/airline/base16_gruvbox_light_soft.bash new file mode 100644 index 0000000..e9b4470 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_gruvbox_light_soft.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_gruvbox_light_soft.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Gruvbox light, soft vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_gruvbox_light_soft/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=223,bg=60 # fg=#ebdbb2,bg=#665c54 + ble-face -s vim_airline_a_inactive fg=223,bg=223 # fg=#ebdbb2,bg=#ebdbb2 + ble-face -s vim_airline_a_insert fg=223,bg=100 # fg=#ebdbb2,bg=#79740e + ble-face -s vim_airline_a_replace fg=223,bg=95 # fg=#ebdbb2,bg=#8f3f71 + ble-face -s vim_airline_a_visual fg=223,bg=130 # fg=#ebdbb2,bg=#af3a03 + ble-face -s vim_airline_b fg=60,bg=187 # fg=#665c54,bg=#d5c4a1 + ble-face -s vim_airline_b_inactive fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c fg=60,bg=223 # fg=#665c54,bg=#ebdbb2 + ble-face -s vim_airline_c_inactive fg=239,bg=223 # fg=#504945,bg=#ebdbb2 + ble-face -s vim_airline_c_insert_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_normal_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_replace_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 + ble-face -s vim_airline_c_visual_modified fg=235,bg=223 # fg=#282828,bg=#ebdbb2 +} diff --git a/.local/share/blesh/contrib/airline/base16_harmonic16.bash b/.local/share/blesh/contrib/airline/base16_harmonic16.bash new file mode 100644 index 0000000..b3acef7 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_harmonic16.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_harmonic16.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 harmonic16 Scheme by Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_harmonic16/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=72 # fg=#223b54,bg=#56bf8b + ble-face -s vim_airline_a_inactive fg=190,bg=23 # fg=#cbd6e2,bg=#223b54 + ble-face -s vim_airline_a_insert fg=23,bg=97 # fg=#223b54,bg=#8b56bf + ble-face -s vim_airline_a_replace fg=23,bg=137 # fg=#223b54,bg=#bf8b56 + ble-face -s vim_airline_a_visual fg=23,bg=132 # fg=#223b54,bg=#bf568b + ble-face -s vim_airline_b fg=195,bg=60 # fg=#e5ebf1,bg=#405c79 + ble-face -s vim_airline_b_inactive fg=190,bg=23 # fg=#cbd6e2,bg=#223b54 + ble-face -s vim_airline_c fg=143,bg=23 # fg=#bfbf56,bg=#223b54 + ble-face -s vim_airline_c_inactive fg=190,bg=23 # fg=#cbd6e2,bg=#223b54 +} diff --git a/.local/share/blesh/contrib/airline/base16_harmonic_dark.bash b/.local/share/blesh/contrib/airline/base16_harmonic_dark.bash new file mode 100644 index 0000000..95a131a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_harmonic_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_harmonic_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Harmonic16 Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_harmonic_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=146 # fg=#223b54,bg=#aabcce + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#223b54,bg=#223b54 + ble-face -s vim_airline_a_insert fg=23,bg=72 # fg=#223b54,bg=#56bf8b + ble-face -s vim_airline_a_replace fg=23,bg=132 # fg=#223b54,bg=#bf568b + ble-face -s vim_airline_a_visual fg=23,bg=143 # fg=#223b54,bg=#bfbf56 + ble-face -s vim_airline_b fg=146,bg=60 # fg=#aabcce,bg=#405c79 + ble-face -s vim_airline_b_inactive fg=146,bg=23 # fg=#aabcce,bg=#223b54 + ble-face -s vim_airline_c fg=146,bg=23 # fg=#aabcce,bg=#223b54 + ble-face -s vim_airline_c_inactive fg=190,bg=23 # fg=#cbd6e2,bg=#223b54 + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#f7f9fb,bg=#223b54 + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#f7f9fb,bg=#223b54 + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#f7f9fb,bg=#223b54 + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#f7f9fb,bg=#223b54 +} diff --git a/.local/share/blesh/contrib/airline/base16_harmonic_light.bash b/.local/share/blesh/contrib/airline/base16_harmonic_light.bash new file mode 100644 index 0000000..ca0ea50 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_harmonic_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_harmonic_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Harmonic16 Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jannik Siebert (https://github.com/janniks) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_harmonic_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=195,bg=66 # fg=#e5ebf1,bg=#627e99 + ble-face -s vim_airline_a_inactive fg=195,bg=195 # fg=#e5ebf1,bg=#e5ebf1 + ble-face -s vim_airline_a_insert fg=195,bg=72 # fg=#e5ebf1,bg=#56bf8b + ble-face -s vim_airline_a_replace fg=195,bg=132 # fg=#e5ebf1,bg=#bf568b + ble-face -s vim_airline_a_visual fg=195,bg=143 # fg=#e5ebf1,bg=#bfbf56 + ble-face -s vim_airline_b fg=66,bg=190 # fg=#627e99,bg=#cbd6e2 + ble-face -s vim_airline_b_inactive fg=66,bg=195 # fg=#627e99,bg=#e5ebf1 + ble-face -s vim_airline_c fg=66,bg=195 # fg=#627e99,bg=#e5ebf1 + ble-face -s vim_airline_c_inactive fg=60,bg=195 # fg=#405c79,bg=#e5ebf1 + ble-face -s vim_airline_c_insert_modified fg=234,bg=195 # fg=#0b1c2c,bg=#e5ebf1 + ble-face -s vim_airline_c_normal_modified fg=234,bg=195 # fg=#0b1c2c,bg=#e5ebf1 + ble-face -s vim_airline_c_replace_modified fg=234,bg=195 # fg=#0b1c2c,bg=#e5ebf1 + ble-face -s vim_airline_c_visual_modified fg=234,bg=195 # fg=#0b1c2c,bg=#e5ebf1 +} diff --git a/.local/share/blesh/contrib/airline/base16_heetch.bash b/.local/share/blesh/contrib/airline/base16_heetch.bash new file mode 100644 index 0000000..4f34bda --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_heetch.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_heetch.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Heetch Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Geoffrey Teale (tealeg@gmail.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_heetch/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=53,bg=139 # fg=#392551,bg=#9c92a8 + ble-face -s vim_airline_a_inactive fg=53,bg=53 # fg=#392551,bg=#392551 + ble-face -s vim_airline_a_insert fg=53,bg=168 # fg=#392551,bg=#c33678 + ble-face -s vim_airline_a_replace fg=53,bg=89 # fg=#392551,bg=#82034c + ble-face -s vim_airline_a_visual fg=53,bg=73 # fg=#392551,bg=#5ba2b6 + ble-face -s vim_airline_b fg=139,bg=240 # fg=#9c92a8,bg=#5a496e + ble-face -s vim_airline_b_inactive fg=139,bg=53 # fg=#9c92a8,bg=#392551 + ble-face -s vim_airline_c fg=139,bg=53 # fg=#9c92a8,bg=#392551 + ble-face -s vim_airline_c_inactive fg=146,bg=53 # fg=#bdb6c5,bg=#392551 + ble-face -s vim_airline_c_insert_modified fg=231,bg=53 # fg=#feffff,bg=#392551 + ble-face -s vim_airline_c_normal_modified fg=231,bg=53 # fg=#feffff,bg=#392551 + ble-face -s vim_airline_c_replace_modified fg=231,bg=53 # fg=#feffff,bg=#392551 + ble-face -s vim_airline_c_visual_modified fg=231,bg=53 # fg=#feffff,bg=#392551 +} diff --git a/.local/share/blesh/contrib/airline/base16_heetch_light.bash b/.local/share/blesh/contrib/airline/base16_heetch_light.bash new file mode 100644 index 0000000..1f523db --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_heetch_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_heetch_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Heetch Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Geoffrey Teale (tealeg@gmail.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_heetch_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=53,bg=253 # fg=#392551,bg=#ddd6e5 + ble-face -s vim_airline_a_inactive fg=53,bg=53 # fg=#392551,bg=#392551 + ble-face -s vim_airline_a_insert fg=53,bg=197 # fg=#392551,bg=#f80059 + ble-face -s vim_airline_a_replace fg=53,bg=125 # fg=#392551,bg=#bd0152 + ble-face -s vim_airline_a_visual fg=53,bg=146 # fg=#392551,bg=#bdb6c5 + ble-face -s vim_airline_b fg=253,bg=96 # fg=#ddd6e5,bg=#7b6d8b + ble-face -s vim_airline_b_inactive fg=253,bg=53 # fg=#ddd6e5,bg=#392551 + ble-face -s vim_airline_c fg=253,bg=53 # fg=#ddd6e5,bg=#392551 + ble-face -s vim_airline_c_inactive fg=240,bg=53 # fg=#5a496e,bg=#392551 + ble-face -s vim_airline_c_insert_modified fg=17,bg=53 # fg=#190134,bg=#392551 + ble-face -s vim_airline_c_normal_modified fg=17,bg=53 # fg=#190134,bg=#392551 + ble-face -s vim_airline_c_replace_modified fg=17,bg=53 # fg=#190134,bg=#392551 + ble-face -s vim_airline_c_visual_modified fg=17,bg=53 # fg=#190134,bg=#392551 +} diff --git a/.local/share/blesh/contrib/airline/base16_helios.bash b/.local/share/blesh/contrib/airline/base16_helios.bash new file mode 100644 index 0000000..f590d87 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_helios.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_helios.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Helios vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Alex Meyer (https://github.com/reyemxela) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_helios/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=252 # fg=#383c3e,bg=#cdcdcd + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#383c3e,bg=#383c3e + ble-face -s vim_airline_a_insert fg=237,bg=106 # fg=#383c3e,bg=#88b92d + ble-face -s vim_airline_a_replace fg=237,bg=131 # fg=#383c3e,bg=#be4264 + ble-face -s vim_airline_a_visual fg=237,bg=208 # fg=#383c3e,bg=#eb8413 + ble-face -s vim_airline_b fg=252,bg=240 # fg=#cdcdcd,bg=#53585b + ble-face -s vim_airline_b_inactive fg=252,bg=237 # fg=#cdcdcd,bg=#383c3e + ble-face -s vim_airline_c fg=252,bg=237 # fg=#cdcdcd,bg=#383c3e + ble-face -s vim_airline_c_inactive fg=189,bg=237 # fg=#d5d5d5,bg=#383c3e + ble-face -s vim_airline_c_insert_modified fg=254,bg=237 # fg=#e5e5e5,bg=#383c3e + ble-face -s vim_airline_c_normal_modified fg=254,bg=237 # fg=#e5e5e5,bg=#383c3e + ble-face -s vim_airline_c_replace_modified fg=254,bg=237 # fg=#e5e5e5,bg=#383c3e + ble-face -s vim_airline_c_visual_modified fg=254,bg=237 # fg=#e5e5e5,bg=#383c3e +} diff --git a/.local/share/blesh/contrib/airline/base16_hopscotch.bash b/.local/share/blesh/contrib/airline/base16_hopscotch.bash new file mode 100644 index 0000000..0c16025 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_hopscotch.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_hopscotch.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Hopscotch Scheme by Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_hopscotch/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=107 # fg=#433b42,bg=#8fc13e + ble-face -s vim_airline_a_inactive fg=250,bg=238 # fg=#b9b5b8,bg=#433b42 + ble-face -s vim_airline_a_insert fg=238,bg=31 # fg=#433b42,bg=#1290bf + ble-face -s vim_airline_a_replace fg=238,bg=167 # fg=#433b42,bg=#dd464c + ble-face -s vim_airline_a_visual fg=238,bg=168 # fg=#433b42,bg=#c85e7c + ble-face -s vim_airline_b fg=188,bg=240 # fg=#d5d3d5,bg=#5c545b + ble-face -s vim_airline_b_inactive fg=250,bg=238 # fg=#b9b5b8,bg=#433b42 + ble-face -s vim_airline_c fg=208,bg=238 # fg=#fd8b19,bg=#433b42 + ble-face -s vim_airline_c_inactive fg=250,bg=238 # fg=#b9b5b8,bg=#433b42 +} diff --git a/.local/share/blesh/contrib/airline/base16_horizon_dark.bash b/.local/share/blesh/contrib/airline/base16_horizon_dark.bash new file mode 100644 index 0000000..dfa365f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_horizon_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_horizon_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Horizon Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Michaël Ball (http://github.com/michael-ball/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_horizon_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=247 # fg=#232530,bg=#9da0a2 + ble-face -s vim_airline_a_inactive fg=17,bg=17 # fg=#232530,bg=#232530 + ble-face -s vim_airline_a_insert fg=17,bg=216 # fg=#232530,bg=#efaf8e + ble-face -s vim_airline_a_replace fg=17,bg=134 # fg=#232530,bg=#b072d1 + ble-face -s vim_airline_a_visual fg=17,bg=174 # fg=#232530,bg=#e58d7d + ble-face -s vim_airline_b fg=247,bg=23 # fg=#9da0a2,bg=#2e303e + ble-face -s vim_airline_b_inactive fg=247,bg=17 # fg=#9da0a2,bg=#232530 + ble-face -s vim_airline_c fg=247,bg=17 # fg=#9da0a2,bg=#232530 + ble-face -s vim_airline_c_inactive fg=252,bg=17 # fg=#cbced0,bg=#232530 + ble-face -s vim_airline_c_insert_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_normal_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_replace_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_visual_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 +} diff --git a/.local/share/blesh/contrib/airline/base16_horizon_light.bash b/.local/share/blesh/contrib/airline/base16_horizon_light.bash new file mode 100644 index 0000000..6449933 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_horizon_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_horizon_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Horizon Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Michaël Ball (http://github.com/michael-ball/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_horizon_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=224,bg=245 # fg=#fadad1,bg=#948c8a + ble-face -s vim_airline_a_inactive fg=224,bg=224 # fg=#fadad1,bg=#fadad1 + ble-face -s vim_airline_a_insert fg=224,bg=115 # fg=#fadad1,bg=#94e1b0 + ble-face -s vim_airline_a_replace fg=224,bg=30 # fg=#fadad1,bg=#1d8991 + ble-face -s vim_airline_a_visual fg=224,bg=202 # fg=#fadad1,bg=#f6661e + ble-face -s vim_airline_b fg=245,bg=223 # fg=#948c8a,bg=#f9cbbe + ble-face -s vim_airline_b_inactive fg=245,bg=224 # fg=#948c8a,bg=#fadad1 + ble-face -s vim_airline_c fg=245,bg=224 # fg=#948c8a,bg=#fadad1 + ble-face -s vim_airline_c_inactive fg=237,bg=224 # fg=#403c3d,bg=#fadad1 + ble-face -s vim_airline_c_insert_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_normal_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_replace_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_visual_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 +} diff --git a/.local/share/blesh/contrib/airline/base16_horizon_terminal_dark.bash b/.local/share/blesh/contrib/airline/base16_horizon_terminal_dark.bash new file mode 100644 index 0000000..3e605ef --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_horizon_terminal_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_horizon_terminal_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Horizon Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Michaël Ball (http://github.com/michael-ball/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_horizon_terminal_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=247 # fg=#232530,bg=#9da0a2 + ble-face -s vim_airline_a_inactive fg=17,bg=17 # fg=#232530,bg=#232530 + ble-face -s vim_airline_a_insert fg=17,bg=42 # fg=#232530,bg=#29d398 + ble-face -s vim_airline_a_replace fg=17,bg=205 # fg=#232530,bg=#ee64ac + ble-face -s vim_airline_a_visual fg=17,bg=216 # fg=#232530,bg=#fab795 + ble-face -s vim_airline_b fg=247,bg=23 # fg=#9da0a2,bg=#2e303e + ble-face -s vim_airline_b_inactive fg=247,bg=17 # fg=#9da0a2,bg=#232530 + ble-face -s vim_airline_c fg=247,bg=17 # fg=#9da0a2,bg=#232530 + ble-face -s vim_airline_c_inactive fg=252,bg=17 # fg=#cbced0,bg=#232530 + ble-face -s vim_airline_c_insert_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_normal_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_replace_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 + ble-face -s vim_airline_c_visual_modified fg=189,bg=17 # fg=#e3e6ee,bg=#232530 +} diff --git a/.local/share/blesh/contrib/airline/base16_horizon_terminal_light.bash b/.local/share/blesh/contrib/airline/base16_horizon_terminal_light.bash new file mode 100644 index 0000000..c0201c6 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_horizon_terminal_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_horizon_terminal_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Horizon Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Michaël Ball (http://github.com/michael-ball/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_horizon_terminal_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=224,bg=245 # fg=#fadad1,bg=#948c8a + ble-face -s vim_airline_a_inactive fg=224,bg=224 # fg=#fadad1,bg=#fadad1 + ble-face -s vim_airline_a_insert fg=224,bg=42 # fg=#fadad1,bg=#29d398 + ble-face -s vim_airline_a_replace fg=224,bg=205 # fg=#fadad1,bg=#ee64ac + ble-face -s vim_airline_a_visual fg=224,bg=224 # fg=#fadad1,bg=#f9cec3 + ble-face -s vim_airline_b fg=245,bg=223 # fg=#948c8a,bg=#f9cbbe + ble-face -s vim_airline_b_inactive fg=245,bg=224 # fg=#948c8a,bg=#fadad1 + ble-face -s vim_airline_c fg=245,bg=224 # fg=#948c8a,bg=#fadad1 + ble-face -s vim_airline_c_inactive fg=237,bg=224 # fg=#403c3d,bg=#fadad1 + ble-face -s vim_airline_c_insert_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_normal_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_replace_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 + ble-face -s vim_airline_c_visual_modified fg=234,bg=224 # fg=#201c1d,bg=#fadad1 +} diff --git a/.local/share/blesh/contrib/airline/base16_ia_dark.bash b/.local/share/blesh/contrib/airline/base16_ia_dark.bash new file mode 100644 index 0000000..a2e4dfe --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_ia_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_ia_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 iA Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By iA Inc. (modified by aramisgithub) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_ia_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=250 # fg=#222222,bg=#b8b8b8 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#222222,bg=#222222 + ble-face -s vim_airline_a_insert fg=235,bg=107 # fg=#222222,bg=#83a471 + ble-face -s vim_airline_a_replace fg=235,bg=139 # fg=#222222,bg=#b98eb2 + ble-face -s vim_airline_a_visual fg=235,bg=167 # fg=#222222,bg=#d86868 + ble-face -s vim_airline_b fg=250,bg=23 # fg=#b8b8b8,bg=#1d414d + ble-face -s vim_airline_b_inactive fg=250,bg=235 # fg=#b8b8b8,bg=#222222 + ble-face -s vim_airline_c fg=250,bg=235 # fg=#b8b8b8,bg=#222222 + ble-face -s vim_airline_c_inactive fg=252,bg=235 # fg=#cccccc,bg=#222222 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#f8f8f8,bg=#222222 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#f8f8f8,bg=#222222 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#f8f8f8,bg=#222222 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#f8f8f8,bg=#222222 +} diff --git a/.local/share/blesh/contrib/airline/base16_ia_light.bash b/.local/share/blesh/contrib/airline/base16_ia_light.bash new file mode 100644 index 0000000..6a516c4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_ia_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_ia_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 iA Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By iA Inc. (modified by aramisgithub) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_ia_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=253,bg=243 # fg=#dedede,bg=#767676 + ble-face -s vim_airline_a_inactive fg=253,bg=253 # fg=#dedede,bg=#dedede + ble-face -s vim_airline_a_insert fg=253,bg=64 # fg=#dedede,bg=#38781c + ble-face -s vim_airline_a_replace fg=253,bg=132 # fg=#dedede,bg=#a94598 + ble-face -s vim_airline_a_visual fg=253,bg=166 # fg=#dedede,bg=#c43e18 + ble-face -s vim_airline_b fg=243,bg=153 # fg=#767676,bg=#bde5f2 + ble-face -s vim_airline_b_inactive fg=243,bg=253 # fg=#767676,bg=#dedede + ble-face -s vim_airline_c fg=243,bg=253 # fg=#767676,bg=#dedede + ble-face -s vim_airline_c_inactive fg=234,bg=253 # fg=#181818,bg=#dedede + ble-face -s vim_airline_c_insert_modified fg=231,bg=253 # fg=#f8f8f8,bg=#dedede + ble-face -s vim_airline_c_normal_modified fg=231,bg=253 # fg=#f8f8f8,bg=#dedede + ble-face -s vim_airline_c_replace_modified fg=231,bg=253 # fg=#f8f8f8,bg=#dedede + ble-face -s vim_airline_c_visual_modified fg=231,bg=253 # fg=#f8f8f8,bg=#dedede +} diff --git a/.local/share/blesh/contrib/airline/base16_icy.bash b/.local/share/blesh/contrib/airline/base16_icy.bash new file mode 100644 index 0000000..96b528c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_icy.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_icy.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Icy Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By icyphox (https://icyphox.ga) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_icy/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=23 # fg=#031619,bg=#064048 + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#031619,bg=#031619 + ble-face -s vim_airline_a_insert fg=233,bg=80 # fg=#031619,bg=#4dd0e1 + ble-face -s vim_airline_a_replace fg=233,bg=37 # fg=#031619,bg=#00acc1 + ble-face -s vim_airline_a_visual fg=233,bg=159 # fg=#031619,bg=#b3ebf2 + ble-face -s vim_airline_b fg=23,bg=234 # fg=#064048,bg=#041f23 + ble-face -s vim_airline_b_inactive fg=23,bg=233 # fg=#064048,bg=#031619 + ble-face -s vim_airline_c fg=23,bg=233 # fg=#064048,bg=#031619 + ble-face -s vim_airline_c_inactive fg=23,bg=233 # fg=#095b67,bg=#031619 + ble-face -s vim_airline_c_insert_modified fg=37,bg=233 # fg=#109cb0,bg=#031619 + ble-face -s vim_airline_c_normal_modified fg=37,bg=233 # fg=#109cb0,bg=#031619 + ble-face -s vim_airline_c_replace_modified fg=37,bg=233 # fg=#109cb0,bg=#031619 + ble-face -s vim_airline_c_visual_modified fg=37,bg=233 # fg=#109cb0,bg=#031619 +} diff --git a/.local/share/blesh/contrib/airline/base16_irblack.bash b/.local/share/blesh/contrib/airline/base16_irblack.bash new file mode 100644 index 0000000..71a6002 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_irblack.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_irblack.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 IR Black vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Timothée Poisot (http://timotheepoisot.fr) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_irblack/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=245 # fg=#242422,bg=#918f88 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#242422,bg=#242422 + ble-face -s vim_airline_a_insert fg=235,bg=155 # fg=#242422,bg=#a8ff60 + ble-face -s vim_airline_a_replace fg=235,bg=213 # fg=#242422,bg=#ff73fd + ble-face -s vim_airline_a_visual fg=235,bg=179 # fg=#242422,bg=#e9c062 + ble-face -s vim_airline_b fg=245,bg=238 # fg=#918f88,bg=#484844 + ble-face -s vim_airline_b_inactive fg=245,bg=235 # fg=#918f88,bg=#242422 + ble-face -s vim_airline_c fg=245,bg=235 # fg=#918f88,bg=#242422 + ble-face -s vim_airline_c_inactive fg=249,bg=235 # fg=#b5b3aa,bg=#242422 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#fdfbee,bg=#242422 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#fdfbee,bg=#242422 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#fdfbee,bg=#242422 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#fdfbee,bg=#242422 +} diff --git a/.local/share/blesh/contrib/airline/base16_isotope.bash b/.local/share/blesh/contrib/airline/base16_isotope.bash new file mode 100644 index 0000000..23693db --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_isotope.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_isotope.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Isotope Scheme by Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_isotope/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=82 # fg=#404040,bg=#33ff00 + ble-face -s vim_airline_a_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#404040 + ble-face -s vim_airline_a_insert fg=238,bg=27 # fg=#404040,bg=#0066ff + ble-face -s vim_airline_a_replace fg=238,bg=196 # fg=#404040,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=238,bg=165 # fg=#404040,bg=#cc00ff + ble-face -s vim_airline_b fg=254,bg=63 # fg=#e0e0e0,bg=#606060 + ble-face -s vim_airline_b_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#404040 + ble-face -s vim_airline_c fg=208,bg=238 # fg=#ff9900,bg=#404040 + ble-face -s vim_airline_c_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#404040 +} diff --git a/.local/share/blesh/contrib/airline/base16_londontube.bash b/.local/share/blesh/contrib/airline/base16_londontube.bash new file mode 100644 index 0000000..a1df9bb --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_londontube.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_londontube.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 London Tube Scheme by Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_londontube/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=24,bg=29 # fg=#1c3f95,bg=#00853e + ble-face -s vim_airline_a_inactive fg=192,bg=24 # fg=#d9d8d8,bg=#1c3f95 + ble-face -s vim_airline_a_insert fg=24,bg=38 # fg=#1c3f95,bg=#009ddc + ble-face -s vim_airline_a_replace fg=24,bg=196 # fg=#1c3f95,bg=#ee2e24 + ble-face -s vim_airline_a_visual fg=24,bg=89 # fg=#1c3f95,bg=#98005d + ble-face -s vim_airline_b fg=254,bg=240 # fg=#e7e7e8,bg=#5a5758 + ble-face -s vim_airline_b_inactive fg=192,bg=24 # fg=#d9d8d8,bg=#1c3f95 + ble-face -s vim_airline_c fg=211,bg=24 # fg=#f386a1,bg=#1c3f95 + ble-face -s vim_airline_c_inactive fg=192,bg=24 # fg=#d9d8d8,bg=#1c3f95 +} diff --git a/.local/share/blesh/contrib/airline/base16_macintosh.bash b/.local/share/blesh/contrib/airline/base16_macintosh.bash new file mode 100644 index 0000000..543cf45 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_macintosh.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_macintosh.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Macintosh vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Rebecca Bettencourt (http://www.kreativekorp.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_macintosh/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=244 # fg=#404040,bg=#808080 + ble-face -s vim_airline_a_inactive fg=238,bg=238 # fg=#404040,bg=#404040 + ble-face -s vim_airline_a_insert fg=238,bg=34 # fg=#404040,bg=#1fb714 + ble-face -s vim_airline_a_replace fg=238,bg=55 # fg=#404040,bg=#4700a5 + ble-face -s vim_airline_a_visual fg=238,bg=202 # fg=#404040,bg=#ff6403 + ble-face -s vim_airline_b fg=244,bg=238 # fg=#808080,bg=#404040 + ble-face -s vim_airline_c fg=244,bg=238 # fg=#808080,bg=#404040 + ble-face -s vim_airline_c_inactive fg=250,bg=238 # fg=#c0c0c0,bg=#404040 + ble-face -s vim_airline_c_insert_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_normal_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_replace_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_visual_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 +} diff --git a/.local/share/blesh/contrib/airline/base16_marrakesh.bash b/.local/share/blesh/contrib/airline/base16_marrakesh.bash new file mode 100644 index 0000000..cd0805f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_marrakesh.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_marrakesh.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Marrakesh Scheme by Alexandre Gavioli (http://github.com/Alexx2/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_marrakesh/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=52,bg=29 # fg=#302e00,bg=#18974e + ble-face -s vim_airline_a_inactive fg=101,bg=52 # fg=#948e48,bg=#302e00 + ble-face -s vim_airline_a_insert fg=52,bg=67 # fg=#302e00,bg=#477ca1 + ble-face -s vim_airline_a_replace fg=52,bg=167 # fg=#302e00,bg=#c35359 + ble-face -s vim_airline_a_visual fg=52,bg=97 # fg=#302e00,bg=#8868b3 + ble-face -s vim_airline_b fg=186,bg=58 # fg=#ccc37a,bg=#5f5b17 + ble-face -s vim_airline_b_inactive fg=101,bg=52 # fg=#948e48,bg=#302e00 + ble-face -s vim_airline_c fg=131,bg=52 # fg=#b36144,bg=#302e00 + ble-face -s vim_airline_c_inactive fg=101,bg=52 # fg=#948e48,bg=#302e00 +} diff --git a/.local/share/blesh/contrib/airline/base16_materia.bash b/.local/share/blesh/contrib/airline/base16_materia.bash new file mode 100644 index 0000000..e356988 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_materia.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_materia.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Materia vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Defman21 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_materia/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=252 # fg=#2c393f,bg=#c9ccd3 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#2c393f,bg=#2c393f + ble-face -s vim_airline_a_insert fg=23,bg=113 # fg=#2c393f,bg=#8bd649 + ble-face -s vim_airline_a_replace fg=23,bg=111 # fg=#2c393f,bg=#82aaff + ble-face -s vim_airline_a_visual fg=23,bg=173 # fg=#2c393f,bg=#ea9560 + ble-face -s vim_airline_b fg=252,bg=238 # fg=#c9ccd3,bg=#37474f + ble-face -s vim_airline_b_inactive fg=252,bg=23 # fg=#c9ccd3,bg=#2c393f + ble-face -s vim_airline_c fg=252,bg=23 # fg=#c9ccd3,bg=#2c393f + ble-face -s vim_airline_c_inactive fg=189,bg=23 # fg=#cdd3de,bg=#2c393f + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#ffffff,bg=#2c393f + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#ffffff,bg=#2c393f + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#ffffff,bg=#2c393f + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#ffffff,bg=#2c393f +} diff --git a/.local/share/blesh/contrib/airline/base16_material.bash b/.local/share/blesh/contrib/airline/base16_material.bash new file mode 100644 index 0000000..975fd3a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_material.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_material.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Material vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Nate Peterson + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_material/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=152 # fg=#2e3c43,bg=#b2ccd6 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#2e3c43,bg=#2e3c43 + ble-face -s vim_airline_a_insert fg=23,bg=186 # fg=#2e3c43,bg=#c3e88d + ble-face -s vim_airline_a_replace fg=23,bg=176 # fg=#2e3c43,bg=#c792ea + ble-face -s vim_airline_a_visual fg=23,bg=209 # fg=#2e3c43,bg=#f78c6c + ble-face -s vim_airline_b fg=152,bg=238 # fg=#b2ccd6,bg=#314549 + ble-face -s vim_airline_b_inactive fg=152,bg=23 # fg=#b2ccd6,bg=#2e3c43 + ble-face -s vim_airline_c fg=152,bg=23 # fg=#b2ccd6,bg=#2e3c43 + ble-face -s vim_airline_c_inactive fg=231,bg=23 # fg=#eeffff,bg=#2e3c43 + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#ffffff,bg=#2e3c43 + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#ffffff,bg=#2e3c43 + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#ffffff,bg=#2e3c43 + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#ffffff,bg=#2e3c43 +} diff --git a/.local/share/blesh/contrib/airline/base16_material_darker.bash b/.local/share/blesh/contrib/airline/base16_material_darker.bash new file mode 100644 index 0000000..49163f4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_material_darker.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_material_darker.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Material Darker vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Nate Peterson + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_material_darker/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=152 # fg=#303030,bg=#b2ccd6 + ble-face -s vim_airline_a_inactive fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_a_insert fg=236,bg=186 # fg=#303030,bg=#c3e88d + ble-face -s vim_airline_a_replace fg=236,bg=176 # fg=#303030,bg=#c792ea + ble-face -s vim_airline_a_visual fg=236,bg=209 # fg=#303030,bg=#f78c6c + ble-face -s vim_airline_b fg=152,bg=237 # fg=#b2ccd6,bg=#353535 + ble-face -s vim_airline_b_inactive fg=152,bg=236 # fg=#b2ccd6,bg=#303030 + ble-face -s vim_airline_c fg=152,bg=236 # fg=#b2ccd6,bg=#303030 + ble-face -s vim_airline_c_inactive fg=231,bg=236 # fg=#eeffff,bg=#303030 + ble-face -s vim_airline_c_insert_modified fg=231,bg=236 # fg=#ffffff,bg=#303030 + ble-face -s vim_airline_c_normal_modified fg=231,bg=236 # fg=#ffffff,bg=#303030 + ble-face -s vim_airline_c_replace_modified fg=231,bg=236 # fg=#ffffff,bg=#303030 + ble-face -s vim_airline_c_visual_modified fg=231,bg=236 # fg=#ffffff,bg=#303030 +} diff --git a/.local/share/blesh/contrib/airline/base16_material_lighter.bash b/.local/share/blesh/contrib/airline/base16_material_lighter.bash new file mode 100644 index 0000000..bc6c5ff --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_material_lighter.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_material_lighter.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Material Lighter vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Nate Peterson + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_material_lighter/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=189,bg=103 # fg=#e7eaec,bg=#8796b0 + ble-face -s vim_airline_a_inactive fg=189,bg=189 # fg=#e7eaec,bg=#e7eaec + ble-face -s vim_airline_a_insert fg=189,bg=107 # fg=#e7eaec,bg=#91b859 + ble-face -s vim_airline_a_replace fg=189,bg=99 # fg=#e7eaec,bg=#7c4dff + ble-face -s vim_airline_a_visual fg=189,bg=203 # fg=#e7eaec,bg=#f76d47 + ble-face -s vim_airline_b fg=103,bg=254 # fg=#8796b0,bg=#cceae7 + ble-face -s vim_airline_b_inactive fg=103,bg=189 # fg=#8796b0,bg=#e7eaec + ble-face -s vim_airline_c fg=103,bg=189 # fg=#8796b0,bg=#e7eaec + ble-face -s vim_airline_c_inactive fg=116,bg=189 # fg=#80cbc4,bg=#e7eaec + ble-face -s vim_airline_c_insert_modified fg=231,bg=189 # fg=#ffffff,bg=#e7eaec + ble-face -s vim_airline_c_normal_modified fg=231,bg=189 # fg=#ffffff,bg=#e7eaec + ble-face -s vim_airline_c_replace_modified fg=231,bg=189 # fg=#ffffff,bg=#e7eaec + ble-face -s vim_airline_c_visual_modified fg=231,bg=189 # fg=#ffffff,bg=#e7eaec +} diff --git a/.local/share/blesh/contrib/airline/base16_material_palenight.bash b/.local/share/blesh/contrib/airline/base16_material_palenight.bash new file mode 100644 index 0000000..8c3b973 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_material_palenight.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_material_palenight.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Material Palenight vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Nate Peterson + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_material_palenight/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=239,bg=103 # fg=#444267,bg=#8796b0 + ble-face -s vim_airline_a_inactive fg=239,bg=239 # fg=#444267,bg=#444267 + ble-face -s vim_airline_a_insert fg=239,bg=186 # fg=#444267,bg=#c3e88d + ble-face -s vim_airline_a_replace fg=239,bg=176 # fg=#444267,bg=#c792ea + ble-face -s vim_airline_a_visual fg=239,bg=209 # fg=#444267,bg=#f78c6c + ble-face -s vim_airline_b fg=103,bg=237 # fg=#8796b0,bg=#32374d + ble-face -s vim_airline_b_inactive fg=103,bg=239 # fg=#8796b0,bg=#444267 + ble-face -s vim_airline_c fg=103,bg=239 # fg=#8796b0,bg=#444267 + ble-face -s vim_airline_c_inactive fg=110,bg=239 # fg=#959dcb,bg=#444267 + ble-face -s vim_airline_c_insert_modified fg=231,bg=239 # fg=#ffffff,bg=#444267 + ble-face -s vim_airline_c_normal_modified fg=231,bg=239 # fg=#ffffff,bg=#444267 + ble-face -s vim_airline_c_replace_modified fg=231,bg=239 # fg=#ffffff,bg=#444267 + ble-face -s vim_airline_c_visual_modified fg=231,bg=239 # fg=#ffffff,bg=#444267 +} diff --git a/.local/share/blesh/contrib/airline/base16_material_vivid.bash b/.local/share/blesh/contrib/airline/base16_material_vivid.bash new file mode 100644 index 0000000..7498f79 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_material_vivid.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_material_vivid.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Material Vivid vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By joshyrobot + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_material_vivid/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=242 # fg=#27292c,bg=#676c71 + ble-face -s vim_airline_a_inactive fg=235,bg=235 # fg=#27292c,bg=#27292c + ble-face -s vim_airline_a_insert fg=235,bg=42 # fg=#27292c,bg=#00e676 + ble-face -s vim_airline_a_replace fg=235,bg=61 # fg=#27292c,bg=#673ab7 + ble-face -s vim_airline_a_visual fg=235,bg=208 # fg=#27292c,bg=#ff9800 + ble-face -s vim_airline_b fg=242,bg=237 # fg=#676c71,bg=#323639 + ble-face -s vim_airline_b_inactive fg=242,bg=235 # fg=#676c71,bg=#27292c + ble-face -s vim_airline_c fg=242,bg=235 # fg=#676c71,bg=#27292c + ble-face -s vim_airline_c_inactive fg=104,bg=235 # fg=#80868b,bg=#27292c + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#ffffff,bg=#27292c + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#ffffff,bg=#27292c + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#ffffff,bg=#27292c + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#ffffff,bg=#27292c +} diff --git a/.local/share/blesh/contrib/airline/base16_mellow_purple.bash b/.local/share/blesh/contrib/airline/base16_mellow_purple.bash new file mode 100644 index 0000000..a5a757f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_mellow_purple.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_mellow_purple.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Mellow Purple vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By gidsi + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_mellow_purple/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=96 # fg=#1a092d,bg=#873582 + ble-face -s vim_airline_a_inactive fg=234,bg=234 # fg=#1a092d,bg=#1a092d + ble-face -s vim_airline_a_insert fg=234,bg=40 # fg=#1a092d,bg=#05cb0d + ble-face -s vim_airline_a_replace fg=234,bg=103 # fg=#1a092d,bg=#8991bb + ble-face -s vim_airline_a_visual fg=234,bg=127 # fg=#1a092d,bg=#aa00a3 + ble-face -s vim_airline_b fg=96,bg=53 # fg=#873582,bg=#331354 + ble-face -s vim_airline_b_inactive fg=96,bg=234 # fg=#873582,bg=#1a092d + ble-face -s vim_airline_c fg=96,bg=234 # fg=#873582,bg=#1a092d + ble-face -s vim_airline_c_inactive fg=231,bg=234 # fg=#ffeeff,bg=#1a092d + ble-face -s vim_airline_c_insert_modified fg=219,bg=234 # fg=#f8c0ff,bg=#1a092d + ble-face -s vim_airline_c_normal_modified fg=219,bg=234 # fg=#f8c0ff,bg=#1a092d + ble-face -s vim_airline_c_replace_modified fg=219,bg=234 # fg=#f8c0ff,bg=#1a092d + ble-face -s vim_airline_c_visual_modified fg=219,bg=234 # fg=#f8c0ff,bg=#1a092d +} diff --git a/.local/share/blesh/contrib/airline/base16_mexico_light.bash b/.local/share/blesh/contrib/airline/base16_mexico_light.bash new file mode 100644 index 0000000..d93ffe2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_mexico_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_mexico_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Mexico Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Sheldon Johnson + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_mexico_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=240 # fg=#e8e8e8,bg=#585858 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e8e8e8,bg=#e8e8e8 + ble-face -s vim_airline_a_insert fg=254,bg=65 # fg=#e8e8e8,bg=#538947 + ble-face -s vim_airline_a_replace fg=254,bg=97 # fg=#e8e8e8,bg=#96609e + ble-face -s vim_airline_a_visual fg=254,bg=173 # fg=#e8e8e8,bg=#dc9656 + ble-face -s vim_airline_b fg=240,bg=192 # fg=#585858,bg=#d8d8d8 + ble-face -s vim_airline_b_inactive fg=240,bg=254 # fg=#585858,bg=#e8e8e8 + ble-face -s vim_airline_c fg=240,bg=254 # fg=#585858,bg=#e8e8e8 + ble-face -s vim_airline_c_inactive fg=237,bg=254 # fg=#383838,bg=#e8e8e8 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#181818,bg=#e8e8e8 +} diff --git a/.local/share/blesh/contrib/airline/base16_mocha.bash b/.local/share/blesh/contrib/airline/base16_mocha.bash new file mode 100644 index 0000000..f76f629 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_mocha.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_mocha.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Mocha Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_mocha/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=143 # fg=#534636,bg=#beb55b + ble-face -s vim_airline_a_inactive fg=251,bg=238 # fg=#d0c8c6,bg=#534636 + ble-face -s vim_airline_a_insert fg=238,bg=109 # fg=#534636,bg=#8ab3b5 + ble-face -s vim_airline_a_replace fg=238,bg=168 # fg=#534636,bg=#cb6077 + ble-face -s vim_airline_a_visual fg=238,bg=248 # fg=#534636,bg=#a89bb9 + ble-face -s vim_airline_b fg=254,bg=239 # fg=#e9e1dd,bg=#645240 + ble-face -s vim_airline_b_inactive fg=251,bg=238 # fg=#d0c8c6,bg=#534636 + ble-face -s vim_airline_c fg=173,bg=238 # fg=#d28b71,bg=#534636 + ble-face -s vim_airline_c_inactive fg=251,bg=238 # fg=#d0c8c6,bg=#534636 +} diff --git a/.local/share/blesh/contrib/airline/base16_monokai.bash b/.local/share/blesh/contrib/airline/base16_monokai.bash new file mode 100644 index 0000000..69ac089 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_monokai.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_monokai.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Monokai Scheme by Wimer Hazenberg (http://www.monokai.nl) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_monokai/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=148 # fg=#383830,bg=#a6e22e + ble-face -s vim_airline_a_inactive fg=255,bg=237 # fg=#f8f8f2,bg=#383830 + ble-face -s vim_airline_a_insert fg=237,bg=81 # fg=#383830,bg=#66d9ef + ble-face -s vim_airline_a_replace fg=237,bg=197 # fg=#383830,bg=#f92672 + ble-face -s vim_airline_a_visual fg=237,bg=141 # fg=#383830,bg=#ae81ff + ble-face -s vim_airline_b fg=255,bg=238 # fg=#f5f4f1,bg=#49483e + ble-face -s vim_airline_b_inactive fg=255,bg=237 # fg=#f8f8f2,bg=#383830 + ble-face -s vim_airline_c fg=208,bg=237 # fg=#fd971f,bg=#383830 + ble-face -s vim_airline_c_inactive fg=255,bg=237 # fg=#f8f8f2,bg=#383830 +} diff --git a/.local/share/blesh/contrib/airline/base16_nord.bash b/.local/share/blesh/contrib/airline/base16_nord.bash new file mode 100644 index 0000000..8320af4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_nord.bash @@ -0,0 +1,23 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_nord.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline theme by gretzky (https://github.com/gretzky) +# nord scheme by arcticstudio +# (https://github.com/arcticicestudio/nord) +# base 16 from (https://github.com/ada-lovecraft/base16-nord-scheme/blob/master/nord.yaml) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_nord/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=131 # fg=#3b4252,bg=#bf616a + ble-face -s vim_airline_a_inactive fg=189,bg=238 # fg=#e5e9f0,bg=#3b4252 + ble-face -s vim_airline_a_insert fg=238,bg=222 # fg=#3b4252,bg=#ebcb8b + ble-face -s vim_airline_a_replace fg=238,bg=110 # fg=#3b4252,bg=#88c0d0 + ble-face -s vim_airline_a_visual fg=238,bg=144 # fg=#3b4252,bg=#a3be8c + ble-face -s vim_airline_b fg=255,bg=239 # fg=#eceff4,bg=#434c5e + ble-face -s vim_airline_b_inactive fg=189,bg=238 # fg=#e5e9f0,bg=#3b4252 + ble-face -s vim_airline_c fg=109,bg=238 # fg=#81a1c1,bg=#3b4252 + ble-face -s vim_airline_c_inactive fg=189,bg=238 # fg=#e5e9f0,bg=#3b4252 +} diff --git a/.local/share/blesh/contrib/airline/base16_nova.bash b/.local/share/blesh/contrib/airline/base16_nova.bash new file mode 100644 index 0000000..3c759d4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_nova.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_nova.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Nova vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By George Essig (https://github.com/gessig), Trevor D. Miller (https://trevordmiller.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_nova/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=60,bg=109 # fg=#556873,bg=#899ba6 + ble-face -s vim_airline_a_inactive fg=60,bg=60 # fg=#556873,bg=#556873 + ble-face -s vim_airline_a_insert fg=60,bg=110 # fg=#556873,bg=#7fc1ca + ble-face -s vim_airline_a_replace fg=60,bg=104 # fg=#556873,bg=#9a93e1 + ble-face -s vim_airline_a_visual fg=60,bg=110 # fg=#556873,bg=#7fc1ca + ble-face -s vim_airline_b fg=109,bg=66 # fg=#899ba6,bg=#6a7d89 + ble-face -s vim_airline_b_inactive fg=109,bg=60 # fg=#899ba6,bg=#556873 + ble-face -s vim_airline_c fg=109,bg=60 # fg=#899ba6,bg=#556873 + ble-face -s vim_airline_c_inactive fg=252,bg=60 # fg=#c5d4dd,bg=#556873 + ble-face -s vim_airline_c_insert_modified fg=60,bg=60 # fg=#556873,bg=#556873 + ble-face -s vim_airline_c_normal_modified fg=60,bg=60 # fg=#556873,bg=#556873 + ble-face -s vim_airline_c_replace_modified fg=60,bg=60 # fg=#556873,bg=#556873 + ble-face -s vim_airline_c_visual_modified fg=60,bg=60 # fg=#556873,bg=#556873 +} diff --git a/.local/share/blesh/contrib/airline/base16_ocean.bash b/.local/share/blesh/contrib/airline/base16_ocean.bash new file mode 100644 index 0000000..89a561c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_ocean.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_ocean.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Ocean Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_ocean/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=144 # fg=#343d46,bg=#a3be8c + ble-face -s vim_airline_a_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 + ble-face -s vim_airline_a_insert fg=237,bg=109 # fg=#343d46,bg=#8fa1b3 + ble-face -s vim_airline_a_replace fg=237,bg=131 # fg=#343d46,bg=#bf616a + ble-face -s vim_airline_a_visual fg=237,bg=139 # fg=#343d46,bg=#b48ead + ble-face -s vim_airline_b fg=254,bg=240 # fg=#dfe1e8,bg=#4f5b66 + ble-face -s vim_airline_b_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 + ble-face -s vim_airline_c fg=173,bg=237 # fg=#d08770,bg=#343d46 + ble-face -s vim_airline_c_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 +} diff --git a/.local/share/blesh/contrib/airline/base16_oceanicnext.bash b/.local/share/blesh/contrib/airline/base16_oceanicnext.bash new file mode 100644 index 0000000..dc12df9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_oceanicnext.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_oceanicnext.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Oceanic Next Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_oceanicnext/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=114 # fg=#343d46,bg=#99c794 + ble-face -s vim_airline_a_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 + ble-face -s vim_airline_a_insert fg=237,bg=68 # fg=#343d46,bg=#6699cc + ble-face -s vim_airline_a_replace fg=237,bg=203 # fg=#343d46,bg=#ec5f67 + ble-face -s vim_airline_a_visual fg=237,bg=176 # fg=#343d46,bg=#c594c5 + ble-face -s vim_airline_b fg=189,bg=240 # fg=#cdd3de,bg=#4f5b66 + ble-face -s vim_airline_b_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 + ble-face -s vim_airline_c fg=209,bg=237 # fg=#f99157,bg=#343d46 + ble-face -s vim_airline_c_inactive fg=152,bg=237 # fg=#c0c5ce,bg=#343d46 +} diff --git a/.local/share/blesh/contrib/airline/base16_one_light.bash b/.local/share/blesh/contrib/airline/base16_one_light.bash new file mode 100644 index 0000000..64f5360 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_one_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_one_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 One Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Daniel Pfeifer (http://github.com/purpleKarrot) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_one_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=60 # fg=#f0f0f1,bg=#696c77 + ble-face -s vim_airline_a_inactive fg=255,bg=255 # fg=#f0f0f1,bg=#f0f0f1 + ble-face -s vim_airline_a_insert fg=255,bg=71 # fg=#f0f0f1,bg=#50a14f + ble-face -s vim_airline_a_replace fg=255,bg=127 # fg=#f0f0f1,bg=#a626a4 + ble-face -s vim_airline_a_visual fg=255,bg=166 # fg=#f0f0f1,bg=#d75f00 + ble-face -s vim_airline_b fg=60,bg=254 # fg=#696c77,bg=#e5e5e6 + ble-face -s vim_airline_b_inactive fg=60,bg=255 # fg=#696c77,bg=#f0f0f1 + ble-face -s vim_airline_c fg=60,bg=255 # fg=#696c77,bg=#f0f0f1 + ble-face -s vim_airline_c_inactive fg=237,bg=255 # fg=#383a42,bg=#f0f0f1 + ble-face -s vim_airline_c_insert_modified fg=232,bg=255 # fg=#090a0b,bg=#f0f0f1 + ble-face -s vim_airline_c_normal_modified fg=232,bg=255 # fg=#090a0b,bg=#f0f0f1 + ble-face -s vim_airline_c_replace_modified fg=232,bg=255 # fg=#090a0b,bg=#f0f0f1 + ble-face -s vim_airline_c_visual_modified fg=232,bg=255 # fg=#090a0b,bg=#f0f0f1 +} diff --git a/.local/share/blesh/contrib/airline/base16_onedark.bash b/.local/share/blesh/contrib/airline/base16_onedark.bash new file mode 100644 index 0000000..043885c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_onedark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_onedark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 OneDark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Lalit Magant (http://github.com/tilal6991) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_onedark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=60 # fg=#353b45,bg=#565c64 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#353b45,bg=#353b45 + ble-face -s vim_airline_a_insert fg=237,bg=114 # fg=#353b45,bg=#98c379 + ble-face -s vim_airline_a_replace fg=237,bg=176 # fg=#353b45,bg=#c678dd + ble-face -s vim_airline_a_visual fg=237,bg=173 # fg=#353b45,bg=#d19a66 + ble-face -s vim_airline_b fg=60,bg=238 # fg=#565c64,bg=#3e4451 + ble-face -s vim_airline_b_inactive fg=60,bg=237 # fg=#565c64,bg=#353b45 + ble-face -s vim_airline_c fg=60,bg=237 # fg=#565c64,bg=#353b45 + ble-face -s vim_airline_c_inactive fg=249,bg=237 # fg=#abb2bf,bg=#353b45 + ble-face -s vim_airline_c_insert_modified fg=252,bg=237 # fg=#c8ccd4,bg=#353b45 + ble-face -s vim_airline_c_normal_modified fg=252,bg=237 # fg=#c8ccd4,bg=#353b45 + ble-face -s vim_airline_c_replace_modified fg=252,bg=237 # fg=#c8ccd4,bg=#353b45 + ble-face -s vim_airline_c_visual_modified fg=252,bg=237 # fg=#c8ccd4,bg=#353b45 +} diff --git a/.local/share/blesh/contrib/airline/base16_outrun_dark.bash b/.local/share/blesh/contrib/airline/base16_outrun_dark.bash new file mode 100644 index 0000000..98d828d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_outrun_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_outrun_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Outrun Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Hugo Delahousse (http://github.com/hugodelahousse/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_outrun_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=146 # fg=#20204a,bg=#b0b0da + ble-face -s vim_airline_a_inactive fg=17,bg=17 # fg=#20204a,bg=#20204a + ble-face -s vim_airline_a_insert fg=17,bg=84 # fg=#20204a,bg=#59f176 + ble-face -s vim_airline_a_replace fg=17,bg=198 # fg=#20204a,bg=#f10596 + ble-face -s vim_airline_a_visual fg=17,bg=208 # fg=#20204a,bg=#fc8d28 + ble-face -s vim_airline_b fg=146,bg=237 # fg=#b0b0da,bg=#30305a + ble-face -s vim_airline_b_inactive fg=146,bg=17 # fg=#b0b0da,bg=#20204a + ble-face -s vim_airline_c fg=146,bg=17 # fg=#b0b0da,bg=#20204a + ble-face -s vim_airline_c_inactive fg=189,bg=17 # fg=#d0d0fa,bg=#20204a + ble-face -s vim_airline_c_insert_modified fg=231,bg=17 # fg=#f5f5ff,bg=#20204a + ble-face -s vim_airline_c_normal_modified fg=231,bg=17 # fg=#f5f5ff,bg=#20204a + ble-face -s vim_airline_c_replace_modified fg=231,bg=17 # fg=#f5f5ff,bg=#20204a + ble-face -s vim_airline_c_visual_modified fg=231,bg=17 # fg=#f5f5ff,bg=#20204a +} diff --git a/.local/share/blesh/contrib/airline/base16_papercolor_dark.bash b/.local/share/blesh/contrib/airline/base16_papercolor_dark.bash new file mode 100644 index 0000000..94056c3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_papercolor_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_papercolor_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 PaperColor Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_papercolor_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=125,bg=74 # fg=#af005f,bg=#5fafd7 + ble-face -s vim_airline_a_inactive fg=125,bg=125 # fg=#af005f,bg=#af005f + ble-face -s vim_airline_a_insert fg=125,bg=140 # fg=#af005f,bg=#af87d7 + ble-face -s vim_airline_a_replace fg=125,bg=37 # fg=#af005f,bg=#00afaf + ble-face -s vim_airline_a_visual fg=125,bg=71 # fg=#af005f,bg=#5faf5f + ble-face -s vim_airline_b fg=74,bg=70 # fg=#5fafd7,bg=#5faf00 + ble-face -s vim_airline_b_inactive fg=74,bg=125 # fg=#5fafd7,bg=#af005f + ble-face -s vim_airline_c fg=74,bg=125 # fg=#5fafd7,bg=#af005f + ble-face -s vim_airline_c_inactive fg=244,bg=125 # fg=#808080,bg=#af005f + ble-face -s vim_airline_c_insert_modified fg=252,bg=125 # fg=#d0d0d0,bg=#af005f + ble-face -s vim_airline_c_normal_modified fg=252,bg=125 # fg=#d0d0d0,bg=#af005f + ble-face -s vim_airline_c_replace_modified fg=252,bg=125 # fg=#d0d0d0,bg=#af005f + ble-face -s vim_airline_c_visual_modified fg=252,bg=125 # fg=#d0d0d0,bg=#af005f +} diff --git a/.local/share/blesh/contrib/airline/base16_papercolor_light.bash b/.local/share/blesh/contrib/airline/base16_papercolor_light.bash new file mode 100644 index 0000000..802cc3b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_papercolor_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_papercolor_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 PaperColor Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_papercolor_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=124,bg=31 # fg=#af0000,bg=#0087af + ble-face -s vim_airline_a_inactive fg=124,bg=124 # fg=#af0000,bg=#af0000 + ble-face -s vim_airline_a_insert fg=124,bg=91 # fg=#af0000,bg=#8700af + ble-face -s vim_airline_a_replace fg=124,bg=25 # fg=#af0000,bg=#005faf + ble-face -s vim_airline_a_visual fg=124,bg=160 # fg=#af0000,bg=#d70000 + ble-face -s vim_airline_b fg=31,bg=28 # fg=#0087af,bg=#008700 + ble-face -s vim_airline_b_inactive fg=31,bg=124 # fg=#0087af,bg=#af0000 + ble-face -s vim_airline_c fg=31,bg=124 # fg=#0087af,bg=#af0000 + ble-face -s vim_airline_c_inactive fg=105,bg=124 # fg=#878787,bg=#af0000 + ble-face -s vim_airline_c_insert_modified fg=238,bg=124 # fg=#444444,bg=#af0000 + ble-face -s vim_airline_c_normal_modified fg=238,bg=124 # fg=#444444,bg=#af0000 + ble-face -s vim_airline_c_replace_modified fg=238,bg=124 # fg=#444444,bg=#af0000 + ble-face -s vim_airline_c_visual_modified fg=238,bg=124 # fg=#444444,bg=#af0000 +} diff --git a/.local/share/blesh/contrib/airline/base16_paraiso.bash b/.local/share/blesh/contrib/airline/base16_paraiso.bash new file mode 100644 index 0000000..41e6dc9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_paraiso.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_paraiso.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Paraiso Scheme by Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_paraiso/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=72 # fg=#41323f,bg=#48b685 + ble-face -s vim_airline_a_inactive fg=247,bg=237 # fg=#a39e9b,bg=#41323f + ble-face -s vim_airline_a_insert fg=237,bg=39 # fg=#41323f,bg=#06b6ef + ble-face -s vim_airline_a_replace fg=237,bg=203 # fg=#41323f,bg=#ef6155 + ble-face -s vim_airline_a_visual fg=237,bg=97 # fg=#41323f,bg=#815ba4 + ble-face -s vim_airline_b fg=249,bg=239 # fg=#b9b6b0,bg=#4f424c + ble-face -s vim_airline_b_inactive fg=247,bg=237 # fg=#a39e9b,bg=#41323f + ble-face -s vim_airline_c fg=214,bg=237 # fg=#f99b15,bg=#41323f + ble-face -s vim_airline_c_inactive fg=247,bg=237 # fg=#a39e9b,bg=#41323f +} diff --git a/.local/share/blesh/contrib/airline/base16_phd.bash b/.local/share/blesh/contrib/airline/base16_phd.bash new file mode 100644 index 0000000..d3c0733 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_phd.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_phd.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 PhD vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Hennig Hasemann (http://leetless.de/vim.html) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_phd/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=103 # fg=#2a3448,bg=#9a99a3 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#2a3448,bg=#2a3448 + ble-face -s vim_airline_a_insert fg=23,bg=107 # fg=#2a3448,bg=#99bf52 + ble-face -s vim_airline_a_replace fg=23,bg=104 # fg=#2a3448,bg=#9989cc + ble-face -s vim_airline_a_visual fg=23,bg=214 # fg=#2a3448,bg=#f0a000 + ble-face -s vim_airline_b fg=103,bg=240 # fg=#9a99a3,bg=#4d5666 + ble-face -s vim_airline_b_inactive fg=103,bg=23 # fg=#9a99a3,bg=#2a3448 + ble-face -s vim_airline_c fg=103,bg=23 # fg=#9a99a3,bg=#2a3448 + ble-face -s vim_airline_c_inactive fg=250,bg=23 # fg=#b8bbc2,bg=#2a3448 + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#ffffff,bg=#2a3448 + ble-face -s vim_airline_c_normal_modified fg=231,bg=23 # fg=#ffffff,bg=#2a3448 + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#ffffff,bg=#2a3448 + ble-face -s vim_airline_c_visual_modified fg=231,bg=23 # fg=#ffffff,bg=#2a3448 +} diff --git a/.local/share/blesh/contrib/airline/base16_pico.bash b/.local/share/blesh/contrib/airline/base16_pico.bash new file mode 100644 index 0000000..a61910e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_pico.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_pico.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Pico vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By PICO-8 (http://www.lexaloffle.com/pico-8.php) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_pico/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=131 # fg=#1d2b53,bg=#ab5236 + ble-face -s vim_airline_a_inactive fg=17,bg=17 # fg=#1d2b53,bg=#1d2b53 + ble-face -s vim_airline_a_insert fg=17,bg=41 # fg=#1d2b53,bg=#00e756 + ble-face -s vim_airline_a_replace fg=17,bg=211 # fg=#1d2b53,bg=#ff77a8 + ble-face -s vim_airline_a_visual fg=17,bg=214 # fg=#1d2b53,bg=#ffa300 + ble-face -s vim_airline_b fg=131,bg=89 # fg=#ab5236,bg=#7e2553 + ble-face -s vim_airline_b_inactive fg=131,bg=17 # fg=#ab5236,bg=#1d2b53 + ble-face -s vim_airline_c fg=131,bg=17 # fg=#ab5236,bg=#1d2b53 + ble-face -s vim_airline_c_inactive fg=240,bg=17 # fg=#5f574f,bg=#1d2b53 + ble-face -s vim_airline_c_insert_modified fg=230,bg=17 # fg=#fff1e8,bg=#1d2b53 + ble-face -s vim_airline_c_normal_modified fg=230,bg=17 # fg=#fff1e8,bg=#1d2b53 + ble-face -s vim_airline_c_replace_modified fg=230,bg=17 # fg=#fff1e8,bg=#1d2b53 + ble-face -s vim_airline_c_visual_modified fg=230,bg=17 # fg=#fff1e8,bg=#1d2b53 +} diff --git a/.local/share/blesh/contrib/airline/base16_pop.bash b/.local/share/blesh/contrib/airline/base16_pop.bash new file mode 100644 index 0000000..b5b9247 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_pop.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_pop.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Pop Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_pop/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=71 # fg=#202020,bg=#37b349 + ble-face -s vim_airline_a_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=24 # fg=#202020,bg=#0e5a94 + ble-face -s vim_airline_a_replace fg=234,bg=198 # fg=#202020,bg=#eb008a + ble-face -s vim_airline_a_visual fg=234,bg=126 # fg=#202020,bg=#b31e8d + ble-face -s vim_airline_b fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c fg=209,bg=234 # fg=#f29333,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_porple.bash b/.local/share/blesh/contrib/airline/base16_porple.bash new file mode 100644 index 0000000..cdf0927 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_porple.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_porple.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Porple vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Niek den Breeje (https://github.com/AuditeMarlow) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_porple/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=250 # fg=#333344,bg=#b8b8b8 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#333344,bg=#333344 + ble-face -s vim_airline_a_insert fg=237,bg=113 # fg=#333344,bg=#95c76f + ble-face -s vim_airline_a_replace fg=237,bg=132 # fg=#333344,bg=#b74989 + ble-face -s vim_airline_a_visual fg=237,bg=173 # fg=#333344,bg=#d28e5d + ble-face -s vim_airline_b fg=250,bg=239 # fg=#b8b8b8,bg=#474160 + ble-face -s vim_airline_b_inactive fg=250,bg=237 # fg=#b8b8b8,bg=#333344 + ble-face -s vim_airline_c fg=250,bg=237 # fg=#b8b8b8,bg=#333344 + ble-face -s vim_airline_c_inactive fg=192,bg=237 # fg=#d8d8d8,bg=#333344 + ble-face -s vim_airline_c_insert_modified fg=231,bg=237 # fg=#f8f8f8,bg=#333344 + ble-face -s vim_airline_c_normal_modified fg=231,bg=237 # fg=#f8f8f8,bg=#333344 + ble-face -s vim_airline_c_replace_modified fg=231,bg=237 # fg=#f8f8f8,bg=#333344 + ble-face -s vim_airline_c_visual_modified fg=231,bg=237 # fg=#f8f8f8,bg=#333344 +} diff --git a/.local/share/blesh/contrib/airline/base16_railscasts.bash b/.local/share/blesh/contrib/airline/base16_railscasts.bash new file mode 100644 index 0000000..aed3ce2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_railscasts.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_railscasts.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Railscasts Scheme by Ryan Bates (http://railscasts.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_railscasts/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=143 # fg=#272935,bg=#a5c261 + ble-face -s vim_airline_a_inactive fg=254,bg=17 # fg=#e6e1dc,bg=#272935 + ble-face -s vim_airline_a_insert fg=17,bg=73 # fg=#272935,bg=#6d9cbe + ble-face -s vim_airline_a_replace fg=17,bg=167 # fg=#272935,bg=#da4939 + ble-face -s vim_airline_a_visual fg=17,bg=147 # fg=#272935,bg=#b6b3eb + ble-face -s vim_airline_b fg=255,bg=238 # fg=#f4f1ed,bg=#3a4055 + ble-face -s vim_airline_b_inactive fg=254,bg=17 # fg=#e6e1dc,bg=#272935 + ble-face -s vim_airline_c fg=173,bg=17 # fg=#cc7833,bg=#272935 + ble-face -s vim_airline_c_inactive fg=254,bg=17 # fg=#e6e1dc,bg=#272935 +} diff --git a/.local/share/blesh/contrib/airline/base16_rebecca.bash b/.local/share/blesh/contrib/airline/base16_rebecca.bash new file mode 100644 index 0000000..794419f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_rebecca.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_rebecca.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Rebecca vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Victor Borja (http://github.com/vic) based on Rebecca Theme (http://github.com/vic/rebecca-theme) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_rebecca/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=60,bg=146 # fg=#663399,bg=#a0a0c5 + ble-face -s vim_airline_a_inactive fg=60,bg=60 # fg=#663399,bg=#663399 + ble-face -s vim_airline_a_insert fg=60,bg=86 # fg=#663399,bg=#6dfedf + ble-face -s vim_airline_a_replace fg=60,bg=111 # fg=#663399,bg=#7aa5ff + ble-face -s vim_airline_a_visual fg=60,bg=223 # fg=#663399,bg=#efe4a1 + ble-face -s vim_airline_b fg=146,bg=238 # fg=#a0a0c5,bg=#383a62 + ble-face -s vim_airline_b_inactive fg=146,bg=60 # fg=#a0a0c5,bg=#663399 + ble-face -s vim_airline_c fg=146,bg=60 # fg=#a0a0c5,bg=#663399 + ble-face -s vim_airline_c_inactive fg=255,bg=60 # fg=#f1eff8,bg=#663399 + ble-face -s vim_airline_c_insert_modified fg=240,bg=60 # fg=#53495d,bg=#663399 + ble-face -s vim_airline_c_normal_modified fg=240,bg=60 # fg=#53495d,bg=#663399 + ble-face -s vim_airline_c_replace_modified fg=240,bg=60 # fg=#53495d,bg=#663399 + ble-face -s vim_airline_c_visual_modified fg=240,bg=60 # fg=#53495d,bg=#663399 +} diff --git a/.local/share/blesh/contrib/airline/base16_sandcastle.bash b/.local/share/blesh/contrib/airline/base16_sandcastle.bash new file mode 100644 index 0000000..24456af --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_sandcastle.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_sandcastle.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Sandcastle vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By George Essig (https://github.com/gessig) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_sandcastle/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=244 # fg=#2c323b,bg=#928374 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#2c323b,bg=#2c323b + ble-face -s vim_airline_a_insert fg=23,bg=66 # fg=#2c323b,bg=#528b8b + ble-face -s vim_airline_a_replace fg=23,bg=167 # fg=#2c323b,bg=#d75f5f + ble-face -s vim_airline_a_visual fg=23,bg=137 # fg=#2c323b,bg=#a07e3b + ble-face -s vim_airline_b fg=244,bg=238 # fg=#928374,bg=#3e4451 + ble-face -s vim_airline_b_inactive fg=244,bg=23 # fg=#928374,bg=#2c323b + ble-face -s vim_airline_c fg=244,bg=23 # fg=#928374,bg=#2c323b + ble-face -s vim_airline_c_inactive fg=138,bg=23 # fg=#a89984,bg=#2c323b + ble-face -s vim_airline_c_insert_modified fg=229,bg=23 # fg=#fdf4c1,bg=#2c323b + ble-face -s vim_airline_c_normal_modified fg=229,bg=23 # fg=#fdf4c1,bg=#2c323b + ble-face -s vim_airline_c_replace_modified fg=229,bg=23 # fg=#fdf4c1,bg=#2c323b + ble-face -s vim_airline_c_visual_modified fg=229,bg=23 # fg=#fdf4c1,bg=#2c323b +} diff --git a/.local/share/blesh/contrib/airline/base16_seti.bash b/.local/share/blesh/contrib/airline/base16_seti.bash new file mode 100644 index 0000000..3f728a8 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_seti.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_seti.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base16 Seti UI by + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_seti/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=149 # fg=#282a2b,bg=#9fca56 + ble-face -s vim_airline_a_inactive fg=190,bg=235 # fg=#d6d6d6,bg=#282a2b + ble-face -s vim_airline_a_insert fg=235,bg=74 # fg=#282a2b,bg=#55b5db + ble-face -s vim_airline_a_replace fg=235,bg=167 # fg=#282a2b,bg=#cd3f45 + ble-face -s vim_airline_a_visual fg=235,bg=140 # fg=#282a2b,bg=#a074c4 + ble-face -s vim_airline_b fg=255,bg=66 # fg=#eeeeee,bg=#3b758c + ble-face -s vim_airline_b_inactive fg=190,bg=235 # fg=#d6d6d6,bg=#282a2b + ble-face -s vim_airline_c fg=173,bg=235 # fg=#db7b55,bg=#282a2b + ble-face -s vim_airline_c_inactive fg=190,bg=235 # fg=#d6d6d6,bg=#282a2b +} diff --git a/.local/share/blesh/contrib/airline/base16_shapeshifter.bash b/.local/share/blesh/contrib/airline/base16_shapeshifter.bash new file mode 100644 index 0000000..6aeb9c1 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_shapeshifter.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_shapeshifter.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 shapeshifter Scheme by Tyler Benziger (http://tybenz.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_shapeshifter/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=232,bg=41 # fg=#040404,bg=#0ed839 + ble-face -s vim_airline_a_inactive fg=248,bg=232 # fg=#ababab,bg=#040404 + ble-face -s vim_airline_a_insert fg=232,bg=62 # fg=#040404,bg=#3b48e3 + ble-face -s vim_airline_a_replace fg=232,bg=160 # fg=#040404,bg=#e92f2f + ble-face -s vim_airline_a_visual fg=232,bg=212 # fg=#040404,bg=#f996e2 + ble-face -s vim_airline_b fg=254,bg=234 # fg=#e0e0e0,bg=#102015 + ble-face -s vim_airline_b_inactive fg=248,bg=232 # fg=#ababab,bg=#040404 + ble-face -s vim_airline_c fg=173,bg=232 # fg=#e09448,bg=#040404 + ble-face -s vim_airline_c_inactive fg=248,bg=232 # fg=#ababab,bg=#040404 +} diff --git a/.local/share/blesh/contrib/airline/base16_shell.bash b/.local/share/blesh/contrib/airline/base16_shell.bash new file mode 100644 index 0000000..de2db8a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_shell.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_shell.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# This theme has been improved and renamed to base16_vim. The following is +# provided for backward compatibility. + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_shell/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=143 # fg=#181818,bg=#a1b56c + ble-face -s vim_airline_a_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_a_insert fg=235,bg=109 # fg=#282828,bg=#7cafc2 + ble-face -s vim_airline_a_replace fg=235,bg=131 # fg=#282828,bg=#ab4642 + ble-face -s vim_airline_a_visual fg=235,bg=139 # fg=#282828,bg=#ba8baf + ble-face -s vim_airline_b fg=250,bg=237 # fg=#b8b8b8,bg=#383838 + ble-face -s vim_airline_b_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_c fg=143,bg=235 # fg=#a1b56c,bg=#282828 + ble-face -s vim_airline_c_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_c_inactive_modified fg=173,bg=16 # fg=#dc9656,bg=#000000 + ble-face -s vim_airline_c_insert fg=109,bg=235 # fg=#7cafc2,bg=#282828 + ble-face -s vim_airline_c_insert_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_normal_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_replace fg=131,bg=235 # fg=#ab4642,bg=#282828 + ble-face -s vim_airline_c_replace_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_visual fg=139,bg=235 # fg=#ba8baf,bg=#282828 +} diff --git a/.local/share/blesh/contrib/airline/base16_snazzy.bash b/.local/share/blesh/contrib/airline/base16_snazzy.bash new file mode 100644 index 0000000..b6e395b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_snazzy.bash @@ -0,0 +1,36 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_snazzy.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# base16-snazzy +# theme format modified from wombat +# colors from sindresorhus/hyper-snazzy & h404bi/base16-snazzy-scheme/ +# Made by Ayush Shenoy (masala-man) +# +# BASE16-SNAZZY XTERM + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_snazzy/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=81 # fg=#282a36,bg=#57c7ff + ble-face -s vim_airline_a_inactive fg=244,bg=17 # fg=244,bg=#282a36 + ble-face -s vim_airline_a_insert fg=17,bg=84 # fg=#282a36,bg=#5af78e + ble-face -s vim_airline_a_replace fg=17,bg=203 # fg=#282a36,bg=#ff5c57 + ble-face -s vim_airline_a_visual fg=17,bg=229 # fg=#282a36,bg=#f3f99d + ble-face -s vim_airline_b fg=81,bg=17 # fg=#57c7ff,bg=#282a36 + ble-face -s vim_airline_b_inactive fg=244,bg=17 # fg=244,bg=#282a36 + ble-face -s vim_airline_b_insert fg=84,bg=17 # fg=#5af78e,bg=#282a36 + ble-face -s vim_airline_b_replace fg=203,bg=17 # fg=#ff5c57,bg=#282a36 + ble-face -s vim_airline_b_visual fg=229,bg=17 # fg=#f3f99d,bg=#282a36 + ble-face -s vim_airline_c fg=81,bg=17 # fg=#57c7ff,bg=#282a36 + ble-face -s vim_airline_c_inactive fg=244,bg=17 # fg=244,bg=#282a36 + ble-face -s vim_airline_c_inactive_modified fg=81,bg=16 # fg=#57c7ff,bg=#000000 + ble-face -s vim_airline_c_insert fg=84,bg=17 # fg=#5af78e,bg=#282a36 + ble-face -s vim_airline_c_replace fg=203,bg=17 # fg=#ff5c57,bg=#282a36 + ble-face -s vim_airline_c_visual fg=229,bg=17 # fg=#f3f99d,bg=#282a36 + ble-face -s vim_airline_error fg=17,bg=203 # fg=#282a36,bg=#ff5c57 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=17,bg=229 # fg=#282a36,bg=#f3f99d + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/base16_solarflare.bash b/.local/share/blesh/contrib/airline/base16_solarflare.bash new file mode 100644 index 0000000..7d78c5c --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_solarflare.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_solarflare.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Solar Flare vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chuck Harmston (https://chuck.harmston.ch) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_solarflare/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=103 # fg=#222e38,bg=#85939e + ble-face -s vim_airline_a_inactive fg=17,bg=17 # fg=#222e38,bg=#222e38 + ble-face -s vim_airline_a_insert fg=17,bg=113 # fg=#222e38,bg=#7cc844 + ble-face -s vim_airline_a_replace fg=17,bg=134 # fg=#222e38,bg=#a363d5 + ble-face -s vim_airline_a_visual fg=17,bg=166 # fg=#222e38,bg=#e66b2b + ble-face -s vim_airline_b fg=103,bg=60 # fg=#85939e,bg=#586875 + ble-face -s vim_airline_b_inactive fg=103,bg=17 # fg=#85939e,bg=#222e38 + ble-face -s vim_airline_c fg=103,bg=17 # fg=#85939e,bg=#222e38 + ble-face -s vim_airline_c_inactive fg=148,bg=17 # fg=#a6afb8,bg=#222e38 + ble-face -s vim_airline_c_insert_modified fg=231,bg=17 # fg=#f5f7fa,bg=#222e38 + ble-face -s vim_airline_c_normal_modified fg=231,bg=17 # fg=#f5f7fa,bg=#222e38 + ble-face -s vim_airline_c_replace_modified fg=231,bg=17 # fg=#f5f7fa,bg=#222e38 + ble-face -s vim_airline_c_visual_modified fg=231,bg=17 # fg=#f5f7fa,bg=#222e38 +} diff --git a/.local/share/blesh/contrib/airline/base16_solarized.bash b/.local/share/blesh/contrib/airline/base16_solarized.bash new file mode 100644 index 0000000..ec45a61 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_solarized.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_solarized.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Solarized Scheme by Ethan Schoonover (http://ethanschoonover.com/solarized) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_solarized/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=100 # fg=#073642,bg=#859900 + ble-face -s vim_airline_a_inactive fg=109,bg=23 # fg=#93a1a1,bg=#073642 + ble-face -s vim_airline_a_insert fg=23,bg=32 # fg=#073642,bg=#268bd2 + ble-face -s vim_airline_a_replace fg=23,bg=166 # fg=#073642,bg=#dc322f + ble-face -s vim_airline_a_visual fg=23,bg=62 # fg=#073642,bg=#6c71c4 + ble-face -s vim_airline_b fg=224,bg=60 # fg=#eee8d5,bg=#586e75 + ble-face -s vim_airline_b_inactive fg=109,bg=23 # fg=#93a1a1,bg=#073642 + ble-face -s vim_airline_c fg=166,bg=23 # fg=#cb4b16,bg=#073642 + ble-face -s vim_airline_c_inactive fg=109,bg=23 # fg=#93a1a1,bg=#073642 +} diff --git a/.local/share/blesh/contrib/airline/base16_solarized_dark.bash b/.local/share/blesh/contrib/airline/base16_solarized_dark.bash new file mode 100644 index 0000000..0648ec2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_solarized_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_solarized_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Solarized Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Ethan Schoonover (modified by aramisgithub) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_solarized_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=246 # fg=#073642,bg=#839496 + ble-face -s vim_airline_a_inactive fg=23,bg=23 # fg=#073642,bg=#073642 + ble-face -s vim_airline_a_insert fg=23,bg=100 # fg=#073642,bg=#859900 + ble-face -s vim_airline_a_replace fg=23,bg=62 # fg=#073642,bg=#6c71c4 + ble-face -s vim_airline_a_visual fg=23,bg=166 # fg=#073642,bg=#cb4b16 + ble-face -s vim_airline_b fg=246,bg=60 # fg=#839496,bg=#586e75 + ble-face -s vim_airline_b_inactive fg=246,bg=23 # fg=#839496,bg=#073642 + ble-face -s vim_airline_c fg=246,bg=23 # fg=#839496,bg=#073642 + ble-face -s vim_airline_c_inactive fg=109,bg=23 # fg=#93a1a1,bg=#073642 + ble-face -s vim_airline_c_insert_modified fg=230,bg=23 # fg=#fdf6e3,bg=#073642 + ble-face -s vim_airline_c_normal_modified fg=230,bg=23 # fg=#fdf6e3,bg=#073642 + ble-face -s vim_airline_c_replace_modified fg=230,bg=23 # fg=#fdf6e3,bg=#073642 + ble-face -s vim_airline_c_visual_modified fg=230,bg=23 # fg=#fdf6e3,bg=#073642 +} diff --git a/.local/share/blesh/contrib/airline/base16_solarized_light.bash b/.local/share/blesh/contrib/airline/base16_solarized_light.bash new file mode 100644 index 0000000..7a0a677 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_solarized_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_solarized_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Solarized Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Ethan Schoonover (modified by aramisgithub) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_solarized_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=224,bg=66 # fg=#eee8d5,bg=#657b83 + ble-face -s vim_airline_a_inactive fg=224,bg=224 # fg=#eee8d5,bg=#eee8d5 + ble-face -s vim_airline_a_insert fg=224,bg=100 # fg=#eee8d5,bg=#859900 + ble-face -s vim_airline_a_replace fg=224,bg=62 # fg=#eee8d5,bg=#6c71c4 + ble-face -s vim_airline_a_visual fg=224,bg=166 # fg=#eee8d5,bg=#cb4b16 + ble-face -s vim_airline_b fg=66,bg=109 # fg=#657b83,bg=#93a1a1 + ble-face -s vim_airline_b_inactive fg=66,bg=224 # fg=#657b83,bg=#eee8d5 + ble-face -s vim_airline_c fg=66,bg=224 # fg=#657b83,bg=#eee8d5 + ble-face -s vim_airline_c_inactive fg=60,bg=224 # fg=#586e75,bg=#eee8d5 + ble-face -s vim_airline_c_insert_modified fg=17,bg=224 # fg=#002b36,bg=#eee8d5 + ble-face -s vim_airline_c_normal_modified fg=17,bg=224 # fg=#002b36,bg=#eee8d5 + ble-face -s vim_airline_c_replace_modified fg=17,bg=224 # fg=#002b36,bg=#eee8d5 + ble-face -s vim_airline_c_visual_modified fg=17,bg=224 # fg=#002b36,bg=#eee8d5 +} diff --git a/.local/share/blesh/contrib/airline/base16_spacemacs.bash b/.local/share/blesh/contrib/airline/base16_spacemacs.bash new file mode 100644 index 0000000..041850f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_spacemacs.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_spacemacs.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline base16-spacemacs theme by Peter Meehan (http://github.com/22a) +# Base16 Spacemacs by Chris Kempson (http://chriskempson.com) +# Spacemacs scheme by Nasser Alshammari (https://github.com/nashamri/spacemacs-theme) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_spacemacs/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=68 # fg=#f8f8f8,bg=#4f97d7 + ble-face -s vim_airline_a_inactive fg=250,bg=239 # fg=#b8b8b8,bg=#444155 + ble-face -s vim_airline_a_insert fg=231,bg=70 # fg=#f8f8f8,bg=#67b11d + ble-face -s vim_airline_a_replace fg=231,bg=196 # fg=#f8f8f8,bg=#f2241f + ble-face -s vim_airline_a_visual fg=231,bg=214 # fg=#f8f8f8,bg=#ffa500 + ble-face -s vim_airline_b fg=254,bg=239 # fg=#e8e8e8,bg=#444155 + ble-face -s vim_airline_b_inactive fg=250,bg=239 # fg=#b8b8b8,bg=#444155 + ble-face -s vim_airline_c fg=254,bg=234 # fg=#e8e8e8,bg=#1f2022 + ble-face -s vim_airline_c_inactive fg=250,bg=239 # fg=#b8b8b8,bg=#444155 + ble-face -s vim_airline_c_insert fg=70,bg=234 # fg=#67b11d,bg=#1f2022 + ble-face -s vim_airline_c_replace fg=254,bg=234 # fg=#e8e8e8,bg=#1f2022 + ble-face -s vim_airline_c_visual fg=214,bg=234 # fg=#ffa500,bg=#1f2022 + ble-face -s vim_airline_error fg=231,bg=196 # fg=#f8f8f8,bg=#f2241f + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=231,bg=214 # fg=#f8f8f8,bg=#ffa500 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/base16_summerfruit.bash b/.local/share/blesh/contrib/airline/base16_summerfruit.bash new file mode 100644 index 0000000..8a1a723 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_summerfruit.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_summerfruit.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Summerfruit Scheme by Christopher Corley (http://cscorley.github.io/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_summerfruit/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=40 # fg=#202020,bg=#00c918 + ble-face -s vim_airline_a_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=68 # fg=#202020,bg=#3777e6 + ble-face -s vim_airline_a_replace fg=234,bg=198 # fg=#202020,bg=#ff0086 + ble-face -s vim_airline_a_visual fg=234,bg=127 # fg=#202020,bg=#ad00a1 + ble-face -s vim_airline_b fg=254,bg=236 # fg=#e0e0e0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c fg=208,bg=234 # fg=#fd8900,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_summerfruit_dark.bash b/.local/share/blesh/contrib/airline/base16_summerfruit_dark.bash new file mode 100644 index 0000000..9f88f79 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_summerfruit_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_summerfruit_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Summerfruit Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Christopher Corley (http://christop.club/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_summerfruit_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=149 # fg=#202020,bg=#b0b0b0 + ble-face -s vim_airline_a_inactive fg=234,bg=234 # fg=#202020,bg=#202020 + ble-face -s vim_airline_a_insert fg=234,bg=40 # fg=#202020,bg=#00c918 + ble-face -s vim_airline_a_replace fg=234,bg=127 # fg=#202020,bg=#ad00a1 + ble-face -s vim_airline_a_visual fg=234,bg=208 # fg=#202020,bg=#fd8900 + ble-face -s vim_airline_b fg=149,bg=236 # fg=#b0b0b0,bg=#303030 + ble-face -s vim_airline_b_inactive fg=149,bg=234 # fg=#b0b0b0,bg=#202020 + ble-face -s vim_airline_c fg=149,bg=234 # fg=#b0b0b0,bg=#202020 + ble-face -s vim_airline_c_inactive fg=252,bg=234 # fg=#d0d0d0,bg=#202020 + ble-face -s vim_airline_c_insert_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_normal_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_replace_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 + ble-face -s vim_airline_c_visual_modified fg=231,bg=234 # fg=#ffffff,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/base16_summerfruit_light.bash b/.local/share/blesh/contrib/airline/base16_summerfruit_light.bash new file mode 100644 index 0000000..d6c757d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_summerfruit_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_summerfruit_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Summerfruit Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Christopher Corley (http://christop.club/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_summerfruit_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=16 # fg=#e0e0e0,bg=#000000 + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e0e0e0,bg=#e0e0e0 + ble-face -s vim_airline_a_insert fg=254,bg=40 # fg=#e0e0e0,bg=#00c918 + ble-face -s vim_airline_a_replace fg=254,bg=127 # fg=#e0e0e0,bg=#ad00a1 + ble-face -s vim_airline_a_visual fg=254,bg=208 # fg=#e0e0e0,bg=#fd8900 + ble-face -s vim_airline_b fg=16,bg=252 # fg=#000000,bg=#d0d0d0 + ble-face -s vim_airline_b_inactive fg=16,bg=254 # fg=#000000,bg=#e0e0e0 + ble-face -s vim_airline_c fg=16,bg=254 # fg=#000000,bg=#e0e0e0 + ble-face -s vim_airline_c_inactive fg=233,bg=254 # fg=#101010,bg=#e0e0e0 + ble-face -s vim_airline_c_insert_modified fg=234,bg=254 # fg=#202020,bg=#e0e0e0 + ble-face -s vim_airline_c_normal_modified fg=234,bg=254 # fg=#202020,bg=#e0e0e0 + ble-face -s vim_airline_c_replace_modified fg=234,bg=254 # fg=#202020,bg=#e0e0e0 + ble-face -s vim_airline_c_visual_modified fg=234,bg=254 # fg=#202020,bg=#e0e0e0 +} diff --git a/.local/share/blesh/contrib/airline/base16_synth_midnight_dark.bash b/.local/share/blesh/contrib/airline/base16_synth_midnight_dark.bash new file mode 100644 index 0000000..809bc5a --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_synth_midnight_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_synth_midnight_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Synth Midnight Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Michaël Ball (http://github.com/michael-ball/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_synth_midnight_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=250 # fg=#141414,bg=#bfbbbf + ble-face -s vim_airline_a_inactive fg=233,bg=233 # fg=#141414,bg=#141414 + ble-face -s vim_airline_a_insert fg=233,bg=41 # fg=#141414,bg=#06ea61 + ble-face -s vim_airline_a_replace fg=233,bg=170 # fg=#141414,bg=#ea5ce2 + ble-face -s vim_airline_a_visual fg=233,bg=166 # fg=#141414,bg=#e4600e + ble-face -s vim_airline_b fg=250,bg=235 # fg=#bfbbbf,bg=#242424 + ble-face -s vim_airline_b_inactive fg=250,bg=233 # fg=#bfbbbf,bg=#141414 + ble-face -s vim_airline_c fg=250,bg=233 # fg=#bfbbbf,bg=#141414 + ble-face -s vim_airline_c_inactive fg=253,bg=233 # fg=#dfdbdf,bg=#141414 + ble-face -s vim_airline_c_insert_modified fg=231,bg=233 # fg=#fffbff,bg=#141414 + ble-face -s vim_airline_c_normal_modified fg=231,bg=233 # fg=#fffbff,bg=#141414 + ble-face -s vim_airline_c_replace_modified fg=231,bg=233 # fg=#fffbff,bg=#141414 + ble-face -s vim_airline_c_visual_modified fg=231,bg=233 # fg=#fffbff,bg=#141414 +} diff --git a/.local/share/blesh/contrib/airline/base16_tomorrow.bash b/.local/share/blesh/contrib/airline/base16_tomorrow.bash new file mode 100644 index 0000000..a85445b --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_tomorrow.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_tomorrow.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Tomorrow Scheme by Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_tomorrow/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=143 # fg=#282a2e,bg=#b5bd68 + ble-face -s vim_airline_a_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_a_insert fg=236,bg=109 # fg=#282a2e,bg=#81a2be + ble-face -s vim_airline_a_replace fg=236,bg=167 # fg=#282a2e,bg=#cc6666 + ble-face -s vim_airline_a_visual fg=236,bg=139 # fg=#282a2e,bg=#b294bb + ble-face -s vim_airline_b fg=254,bg=237 # fg=#e0e0e0,bg=#373b41 + ble-face -s vim_airline_b_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_c fg=173,bg=236 # fg=#de935f,bg=#282a2e + ble-face -s vim_airline_c_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e +} diff --git a/.local/share/blesh/contrib/airline/base16_tomorrow_night.bash b/.local/share/blesh/contrib/airline/base16_tomorrow_night.bash new file mode 100644 index 0000000..8377536 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_tomorrow_night.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_tomorrow_night.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Tomorrow Night vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_tomorrow_night/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=249 # fg=#282a2e,bg=#b4b7b4 + ble-face -s vim_airline_a_inactive fg=236,bg=236 # fg=#282a2e,bg=#282a2e + ble-face -s vim_airline_a_insert fg=236,bg=143 # fg=#282a2e,bg=#b5bd68 + ble-face -s vim_airline_a_replace fg=236,bg=139 # fg=#282a2e,bg=#b294bb + ble-face -s vim_airline_a_visual fg=236,bg=173 # fg=#282a2e,bg=#de935f + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b4b7b4,bg=#373b41 + ble-face -s vim_airline_b_inactive fg=249,bg=236 # fg=#b4b7b4,bg=#282a2e + ble-face -s vim_airline_c fg=249,bg=236 # fg=#b4b7b4,bg=#282a2e + ble-face -s vim_airline_c_inactive fg=251,bg=236 # fg=#c5c8c6,bg=#282a2e + ble-face -s vim_airline_c_insert_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_normal_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_replace_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_visual_modified fg=231,bg=236 # fg=#ffffff,bg=#282a2e +} diff --git a/.local/share/blesh/contrib/airline/base16_tomorrow_night_eighties.bash b/.local/share/blesh/contrib/airline/base16_tomorrow_night_eighties.bash new file mode 100644 index 0000000..4a4070d --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_tomorrow_night_eighties.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_tomorrow_night_eighties.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Tomorrow Night vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Chris Kempson (http://chriskempson.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_tomorrow_night_eighties/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=249 # fg=#393939,bg=#b4b7b4 + ble-face -s vim_airline_a_inactive fg=237,bg=237 # fg=#393939,bg=#393939 + ble-face -s vim_airline_a_insert fg=237,bg=114 # fg=#393939,bg=#99cc99 + ble-face -s vim_airline_a_replace fg=237,bg=176 # fg=#393939,bg=#cc99cc + ble-face -s vim_airline_a_visual fg=237,bg=209 # fg=#393939,bg=#f99157 + ble-face -s vim_airline_b fg=249,bg=239 # fg=#b4b7b4,bg=#515151 + ble-face -s vim_airline_b_inactive fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c fg=249,bg=237 # fg=#b4b7b4,bg=#393939 + ble-face -s vim_airline_c_inactive fg=252,bg=237 # fg=#cccccc,bg=#393939 + ble-face -s vim_airline_c_insert_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_normal_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_replace_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 + ble-face -s vim_airline_c_visual_modified fg=231,bg=237 # fg=#ffffff,bg=#393939 +} diff --git a/.local/share/blesh/contrib/airline/base16_tube.bash b/.local/share/blesh/contrib/airline/base16_tube.bash new file mode 100644 index 0000000..a43c5f8 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_tube.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_tube.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 London Tube vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jan T. Sott + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_tube/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=24,bg=109 # fg=#1c3f95,bg=#959ca1 + ble-face -s vim_airline_a_inactive fg=24,bg=24 # fg=#1c3f95,bg=#1c3f95 + ble-face -s vim_airline_a_insert fg=24,bg=29 # fg=#1c3f95,bg=#00853e + ble-face -s vim_airline_a_replace fg=24,bg=89 # fg=#1c3f95,bg=#98005d + ble-face -s vim_airline_a_visual fg=24,bg=211 # fg=#1c3f95,bg=#f386a1 + ble-face -s vim_airline_b fg=109,bg=240 # fg=#959ca1,bg=#5a5758 + ble-face -s vim_airline_b_inactive fg=109,bg=24 # fg=#959ca1,bg=#1c3f95 + ble-face -s vim_airline_c fg=109,bg=24 # fg=#959ca1,bg=#1c3f95 + ble-face -s vim_airline_c_inactive fg=192,bg=24 # fg=#d9d8d8,bg=#1c3f95 + ble-face -s vim_airline_c_insert_modified fg=231,bg=24 # fg=#ffffff,bg=#1c3f95 + ble-face -s vim_airline_c_normal_modified fg=231,bg=24 # fg=#ffffff,bg=#1c3f95 + ble-face -s vim_airline_c_replace_modified fg=231,bg=24 # fg=#ffffff,bg=#1c3f95 + ble-face -s vim_airline_c_visual_modified fg=231,bg=24 # fg=#ffffff,bg=#1c3f95 +} diff --git a/.local/share/blesh/contrib/airline/base16_twilight.bash b/.local/share/blesh/contrib/airline/base16_twilight.bash new file mode 100644 index 0000000..76bc4db --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_twilight.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_twilight.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by chartoin (http://github.com/chartoin) +# Base 16 Twilight Scheme by David Hart (http://hart-dev.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_twilight/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=107 # fg=#323537,bg=#8f9d6a + ble-face -s vim_airline_a_inactive fg=248,bg=237 # fg=#a7a7a7,bg=#323537 + ble-face -s vim_airline_a_insert fg=237,bg=103 # fg=#323537,bg=#7587a6 + ble-face -s vim_airline_a_replace fg=237,bg=167 # fg=#323537,bg=#cf6a4c + ble-face -s vim_airline_a_visual fg=237,bg=139 # fg=#323537,bg=#9b859d + ble-face -s vim_airline_b fg=251,bg=239 # fg=#c3c3c3,bg=#464b50 + ble-face -s vim_airline_b_inactive fg=248,bg=237 # fg=#a7a7a7,bg=#323537 + ble-face -s vim_airline_c fg=179,bg=237 # fg=#cda869,bg=#323537 + ble-face -s vim_airline_c_inactive fg=248,bg=237 # fg=#a7a7a7,bg=#323537 +} diff --git a/.local/share/blesh/contrib/airline/base16_unikitty_dark.bash b/.local/share/blesh/contrib/airline/base16_unikitty_dark.bash new file mode 100644 index 0000000..5548546 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_unikitty_dark.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_unikitty_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Unikitty Dark vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Josh W Lewis (@joshwlewis) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_unikitty_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=239,bg=247 # fg=#4a464d,bg=#9f9da2 + ble-face -s vim_airline_a_inactive fg=239,bg=239 # fg=#4a464d,bg=#4a464d + ble-face -s vim_airline_a_insert fg=239,bg=36 # fg=#4a464d,bg=#17ad98 + ble-face -s vim_airline_a_replace fg=239,bg=134 # fg=#4a464d,bg=#bb60ea + ble-face -s vim_airline_a_visual fg=239,bg=166 # fg=#4a464d,bg=#d65407 + ble-face -s vim_airline_b fg=247,bg=241 # fg=#9f9da2,bg=#666369 + ble-face -s vim_airline_b_inactive fg=247,bg=239 # fg=#9f9da2,bg=#4a464d + ble-face -s vim_airline_c fg=247,bg=239 # fg=#9f9da2,bg=#4a464d + ble-face -s vim_airline_c_inactive fg=250,bg=239 # fg=#bcbabe,bg=#4a464d + ble-face -s vim_airline_c_insert_modified fg=255,bg=239 # fg=#f5f4f7,bg=#4a464d + ble-face -s vim_airline_c_normal_modified fg=255,bg=239 # fg=#f5f4f7,bg=#4a464d + ble-face -s vim_airline_c_replace_modified fg=255,bg=239 # fg=#f5f4f7,bg=#4a464d + ble-face -s vim_airline_c_visual_modified fg=255,bg=239 # fg=#f5f4f7,bg=#4a464d +} diff --git a/.local/share/blesh/contrib/airline/base16_unikitty_light.bash b/.local/share/blesh/contrib/airline/base16_unikitty_light.bash new file mode 100644 index 0000000..9fae40e --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_unikitty_light.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_unikitty_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Unikitty Light vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Josh W Lewis (@joshwlewis) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_unikitty_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=245 # fg=#e1e1e2,bg=#89878b + ble-face -s vim_airline_a_inactive fg=254,bg=254 # fg=#e1e1e2,bg=#e1e1e2 + ble-face -s vim_airline_a_insert fg=254,bg=36 # fg=#e1e1e2,bg=#17ad98 + ble-face -s vim_airline_a_replace fg=254,bg=128 # fg=#e1e1e2,bg=#aa17e6 + ble-face -s vim_airline_a_visual fg=254,bg=166 # fg=#e1e1e2,bg=#d65407 + ble-face -s vim_airline_b fg=245,bg=251 # fg=#89878b,bg=#c4c3c5 + ble-face -s vim_airline_b_inactive fg=245,bg=254 # fg=#89878b,bg=#e1e1e2 + ble-face -s vim_airline_c fg=245,bg=254 # fg=#89878b,bg=#e1e1e2 + ble-face -s vim_airline_c_inactive fg=242,bg=254 # fg=#6c696e,bg=#e1e1e2 + ble-face -s vim_airline_c_insert_modified fg=53,bg=254 # fg=#322d34,bg=#e1e1e2 + ble-face -s vim_airline_c_normal_modified fg=53,bg=254 # fg=#322d34,bg=#e1e1e2 + ble-face -s vim_airline_c_replace_modified fg=53,bg=254 # fg=#322d34,bg=#e1e1e2 + ble-face -s vim_airline_c_visual_modified fg=53,bg=254 # fg=#322d34,bg=#e1e1e2 +} diff --git a/.local/share/blesh/contrib/airline/base16_vim.bash b/.local/share/blesh/contrib/airline/base16_vim.bash new file mode 100644 index 0000000..6029c81 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_vim.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_vim.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_vim/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=234,bg=143 # fg=#181818,bg=#a1b56c + ble-face -s vim_airline_a_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_a_insert fg=235,bg=109 # fg=#282828,bg=#7cafc2 + ble-face -s vim_airline_a_replace fg=235,bg=131 # fg=#282828,bg=#ab4642 + ble-face -s vim_airline_a_visual fg=235,bg=139 # fg=#282828,bg=#ba8baf + ble-face -s vim_airline_b fg=250,bg=237 # fg=#b8b8b8,bg=#383838 + ble-face -s vim_airline_b_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_c fg=143,bg=235 # fg=#a1b56c,bg=#282828 + ble-face -s vim_airline_c_inactive fg=240,bg=235 # fg=#585858,bg=#282828 + ble-face -s vim_airline_c_inactive_modified fg=173,bg=16 # fg=#dc9656,bg=#000000 + ble-face -s vim_airline_c_insert fg=109,bg=235 # fg=#7cafc2,bg=#282828 + ble-face -s vim_airline_c_insert_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_normal_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_replace fg=131,bg=235 # fg=#ab4642,bg=#282828 + ble-face -s vim_airline_c_replace_modified fg=173,bg=235 # fg=#dc9656,bg=#282828 + ble-face -s vim_airline_c_visual fg=139,bg=235 # fg=#ba8baf,bg=#282828 +} diff --git a/.local/share/blesh/contrib/airline/base16_woodland.bash b/.local/share/blesh/contrib/airline/base16_woodland.bash new file mode 100644 index 0000000..ff02d5f --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_woodland.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_woodland.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Woodland vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Jay Cornwall (https://jcornwall.com) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_woodland/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=52,bg=144 # fg=#302b25,bg=#b4a490 + ble-face -s vim_airline_a_inactive fg=52,bg=52 # fg=#302b25,bg=#302b25 + ble-face -s vim_airline_a_insert fg=52,bg=143 # fg=#302b25,bg=#b7ba53 + ble-face -s vim_airline_a_replace fg=52,bg=140 # fg=#302b25,bg=#bb90e2 + ble-face -s vim_airline_a_visual fg=52,bg=173 # fg=#302b25,bg=#ca7f32 + ble-face -s vim_airline_b fg=144,bg=238 # fg=#b4a490,bg=#48413a + ble-face -s vim_airline_b_inactive fg=144,bg=52 # fg=#b4a490,bg=#302b25 + ble-face -s vim_airline_c fg=144,bg=52 # fg=#b4a490,bg=#302b25 + ble-face -s vim_airline_c_inactive fg=181,bg=52 # fg=#cabcb1,bg=#302b25 + ble-face -s vim_airline_c_insert_modified fg=189,bg=52 # fg=#e4d4c8,bg=#302b25 + ble-face -s vim_airline_c_normal_modified fg=189,bg=52 # fg=#e4d4c8,bg=#302b25 + ble-face -s vim_airline_c_replace_modified fg=189,bg=52 # fg=#e4d4c8,bg=#302b25 + ble-face -s vim_airline_c_visual_modified fg=189,bg=52 # fg=#e4d4c8,bg=#302b25 +} diff --git a/.local/share/blesh/contrib/airline/base16_xcode_dusk.bash b/.local/share/blesh/contrib/airline/base16_xcode_dusk.bash new file mode 100644 index 0000000..ece8fc7 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_xcode_dusk.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_xcode_dusk.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 XCode Dusk vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By Elsa Gonsiorowski (https://github.com/gonsie) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_xcode_dusk/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=244 # fg=#3d4048,bg=#7e8086 + ble-face -s vim_airline_a_inactive fg=238,bg=238 # fg=#3d4048,bg=#3d4048 + ble-face -s vim_airline_a_insert fg=238,bg=160 # fg=#3d4048,bg=#df0002 + ble-face -s vim_airline_a_replace fg=238,bg=126 # fg=#3d4048,bg=#b21889 + ble-face -s vim_airline_a_visual fg=238,bg=98 # fg=#3d4048,bg=#786dc5 + ble-face -s vim_airline_b fg=244,bg=240 # fg=#7e8086,bg=#53555d + ble-face -s vim_airline_b_inactive fg=244,bg=238 # fg=#7e8086,bg=#3d4048 + ble-face -s vim_airline_c fg=244,bg=238 # fg=#7e8086,bg=#3d4048 + ble-face -s vim_airline_c_inactive fg=246,bg=238 # fg=#939599,bg=#3d4048 + ble-face -s vim_airline_c_insert_modified fg=250,bg=238 # fg=#bebfc2,bg=#3d4048 + ble-face -s vim_airline_c_normal_modified fg=250,bg=238 # fg=#bebfc2,bg=#3d4048 + ble-face -s vim_airline_c_replace_modified fg=250,bg=238 # fg=#bebfc2,bg=#3d4048 + ble-face -s vim_airline_c_visual_modified fg=250,bg=238 # fg=#bebfc2,bg=#3d4048 +} diff --git a/.local/share/blesh/contrib/airline/base16_zenburn.bash b/.local/share/blesh/contrib/airline/base16_zenburn.bash new file mode 100644 index 0000000..a0482d6 --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16_zenburn.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16_zenburn.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Base16 Zenburn vim-airline-theme (https://github.com/dawikur/base16-vim-airline-themes) +# For vim-airline (https://github.com/vim-airline/vim-airline) +# By elnawe + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16_zenburn/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=244 # fg=#404040,bg=#808080 + ble-face -s vim_airline_a_inactive fg=238,bg=238 # fg=#404040,bg=#404040 + ble-face -s vim_airline_a_insert fg=238,bg=65 # fg=#404040,bg=#5f7f5f + ble-face -s vim_airline_a_replace fg=238,bg=176 # fg=#404040,bg=#dc8cc3 + ble-face -s vim_airline_a_visual fg=238,bg=180 # fg=#404040,bg=#dfaf8f + ble-face -s vim_airline_b fg=244,bg=63 # fg=#808080,bg=#606060 + ble-face -s vim_airline_b_inactive fg=244,bg=238 # fg=#808080,bg=#404040 + ble-face -s vim_airline_c fg=244,bg=238 # fg=#808080,bg=#404040 + ble-face -s vim_airline_c_inactive fg=191,bg=238 # fg=#dcdccc,bg=#404040 + ble-face -s vim_airline_c_insert_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_normal_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_replace_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 + ble-face -s vim_airline_c_visual_modified fg=231,bg=238 # fg=#ffffff,bg=#404040 +} diff --git a/.local/share/blesh/contrib/airline/base16color.bash b/.local/share/blesh/contrib/airline/base16color.bash new file mode 100644 index 0000000..b39ecdc --- /dev/null +++ b/.local/share/blesh/contrib/airline/base16color.bash @@ -0,0 +1,40 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/base16color.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Normal mode +# [ guifg, guibg, ctermfg, ctermbg, opts ] + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:base16color/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=186 # fg=#141413,bg=#cae682 + ble-face -s vim_airline_a_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_a_insert fg=233,bg=221 # fg=#141413,bg=#fde76e + ble-face -s vim_airline_a_insert_modified fg=233,bg=221 # fg=#141413,bg=#fade3e + ble-face -s vim_airline_a_normal_modified fg=233,bg=114 # fg=#141413,bg=#86cd74 + ble-face -s vim_airline_a_replace fg=233,bg=173 # fg=#141413,bg=#e5786d + ble-face -s vim_airline_a_replace_modified fg=233,bg=167 # fg=#141413,bg=#e55345 + ble-face -s vim_airline_a_visual fg=233,bg=153 # fg=#141413,bg=#b5d3f3 + ble-face -s vim_airline_a_visual_modified fg=233,bg=110 # fg=#141413,bg=#7cb0e6 + ble-face -s vim_airline_b fg=186,bg=58 # fg=#cae682,bg=#32322f + ble-face -s vim_airline_b_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_b_insert fg=221,bg=58 # fg=#fde76e,bg=#32322f + ble-face -s vim_airline_b_insert_modified fg=221,bg=238 # fg=#fade3e,bg=#40403c + ble-face -s vim_airline_b_normal_modified fg=114,bg=238 # fg=#86cd74,bg=#40403c + ble-face -s vim_airline_b_replace fg=173,bg=58 # fg=#e5786d,bg=#32322f + ble-face -s vim_airline_b_replace_modified fg=167,bg=238 # fg=#e55345,bg=#40403c + ble-face -s vim_airline_b_visual fg=153,bg=58 # fg=#b5d3f3,bg=#32322f + ble-face -s vim_airline_b_visual_modified fg=110,bg=238 # fg=#7cb0e6,bg=#40403c + ble-face -s vim_airline_c fg=186,bg=235 # fg=#cae682,bg=#242424 + ble-face -s vim_airline_c_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_c_inactive_modified fg=114,bg=16 # fg=#86cd74,bg=#000000 + ble-face -s vim_airline_c_insert fg=221,bg=235 # fg=#fde76e,bg=#242424 + ble-face -s vim_airline_c_insert_modified fg=221,bg=235 # fg=#fade3e,bg=#242424 + ble-face -s vim_airline_c_normal_modified fg=114,bg=235 # fg=#86cd74,bg=#242424 + ble-face -s vim_airline_c_replace fg=173,bg=235 # fg=#e5786d,bg=#242424 + ble-face -s vim_airline_c_replace_modified fg=167,bg=235 # fg=#e55345,bg=#242424 + ble-face -s vim_airline_c_visual fg=153,bg=235 # fg=#b5d3f3,bg=#242424 + ble-face -s vim_airline_c_visual_modified fg=110,bg=235 # fg=#7cb0e6,bg=#242424 +} diff --git a/.local/share/blesh/contrib/airline/behelit.bash b/.local/share/blesh/contrib/airline/behelit.bash new file mode 100644 index 0000000..345e39a --- /dev/null +++ b/.local/share/blesh/contrib/airline/behelit.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/behelit.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:behelit/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=69 # fg=#121212,bg=#5f87ff + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=233,bg=48 # fg=#121212,bg=#00ff87 + ble-face -s vim_airline_a_replace fg=233,bg=161 # fg=#121212,bg=#d70057 + ble-face -s vim_airline_a_visual fg=233,bg=83 # fg=#121212,bg=#5fff5f + ble-face -s vim_airline_b fg=69,bg=235 # fg=#5f87ff,bg=#262626 + ble-face -s vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626 + ble-face -s vim_airline_c fg=69,bg=234 # fg=#5f87ff,bg=#1c1c1c + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c_inactive_modified fg=60,bg=234 # fg=#5f5f87,bg=#1c1c1c + ble-face -s vim_airline_c_insert_modified fg=161,bg=234 # fg=#d7005f,bg=#1c1c1c + ble-face -s vim_airline_c_normal_modified fg=161,bg=234 # fg=#d7005f,bg=#1c1c1c + ble-face -s vim_airline_c_replace_modified fg=161,bg=234 # fg=#d7005f,bg=#1c1c1c + ble-face -s vim_airline_c_visual_modified fg=161,bg=234 # fg=#d7005f,bg=#1c1c1c + ble-face -s vim_airline_warning fg=233,bg=161 # fg=#121212,bg=#d7005f + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_z_replace fg=233,bg=48 # fg=#121212,bg=#00ff87 +} diff --git a/.local/share/blesh/contrib/airline/biogoo.bash b/.local/share/blesh/contrib/airline/biogoo.bash new file mode 100644 index 0000000..24d1dba --- /dev/null +++ b/.local/share/blesh/contrib/airline/biogoo.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/biogoo.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Name: biogoo (vim-airline version) +# Author: Benjamin Esham (https://esham.io) +# Last Change: 2017-10-20 +# +# You can find more information on the Biogoo theme at . + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:biogoo/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=24 # fg=#ffffff,bg=#295498 + ble-face -s vim_airline_a_inactive fg=242,bg=231 # fg=#676767,bg=#ffffff + ble-face -s vim_airline_a_insert fg=231,bg=34 # fg=#ffffff,bg=#00a000 + ble-face -s vim_airline_a_replace fg=231,bg=160 # fg=#ffffff,bg=#d11518 + ble-face -s vim_airline_a_visual fg=231,bg=166 # fg=#ffffff,bg=#cc6600 + ble-face -s vim_airline_b fg=24,bg=254 # fg=#295498,bg=#e5e5e5 + ble-face -s vim_airline_b_inactive fg=242,bg=231 # fg=#676767,bg=#ffffff + ble-face -s vim_airline_c fg=24,bg=231 # fg=#295498,bg=#ffffff + ble-face -s vim_airline_c_inactive fg=242,bg=231 # fg=#676767,bg=#ffffff + ble-face -s vim_airline_c_inactive_modified fg=34,bg=231 # fg=#00a000,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=34,bg=231 # fg=#00a000,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=34,bg=231 # fg=#00a000,bg=#ffffff + ble-face -s vim_airline_c_replace_modified fg=34,bg=231 # fg=#00a000,bg=#ffffff + ble-face -s vim_airline_c_visual_modified fg=34,bg=231 # fg=#00a000,bg=#ffffff + ble-face -s vim_airline_term fg=231,bg=242 # fg=#ffffff,bg=#676767 +} diff --git a/.local/share/blesh/contrib/airline/blood_red.bash b/.local/share/blesh/contrib/airline/blood_red.bash new file mode 100644 index 0000000..5d6117d --- /dev/null +++ b/.local/share/blesh/contrib/airline/blood_red.bash @@ -0,0 +1,22 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/blood_red.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:blood_red/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=250,bg=160 # fg=#bcbcbc,bg=#d62929 + ble-face -s vim_airline_a_inactive fg=160,bg=237 # fg=#d62929,bg=#3a3a3a + ble-face -s vim_airline_a_insert fg=231,bg=88 # fg=#fffdfa,bg=#8b0000 + ble-face -s vim_airline_a_replace fg=251,bg=161 # fg=#c6c6c6,bg=#d62962 + ble-face -s vim_airline_a_visual fg=231,bg=161 # fg=#fffdfa,bg=#d62962 + ble-face -s vim_airline_b fg=231,bg=88 # fg=#ffffff,bg=#8b0000 + ble-face -s vim_airline_b_inactive fg=160,bg=237 # fg=#d62929,bg=#3a3a3a + ble-face -s vim_airline_b_insert fg=231,bg=160 # fg=#ffffff,bg=#c50000 + ble-face -s vim_airline_b_replace fg=231,bg=88 # fg=#ffffff,bg=#8b0000 + ble-face -s vim_airline_c fg=251,bg=237 # fg=#c6c6c6,bg=#3a3a3a + ble-face -s vim_airline_c_inactive fg=160,bg=237 # fg=#d62929,bg=#3a3a3a + ble-face -s vim_airline_z_replace fg=250,bg=160 # fg=#bcbcbc,bg=#d62929 +} diff --git a/.local/share/blesh/contrib/airline/bubblegum.bash b/.local/share/blesh/contrib/airline/bubblegum.bash new file mode 100644 index 0000000..dfe18be --- /dev/null +++ b/.local/share/blesh/contrib/airline/bubblegum.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/bubblegum.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Color palette + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:bubblegum/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=150 # fg=#303030,bg=#afd787 + ble-face -s vim_airline_a_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_a_insert fg=238,bg=110 # fg=#444444,bg=#87afd7 + ble-face -s vim_airline_a_replace fg=236,bg=174 # fg=#303030,bg=#d78787 + ble-face -s vim_airline_a_visual fg=236,bg=182 # fg=#303030,bg=#d7afd7 + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b2b2b2,bg=#3a3a3a + ble-face -s vim_airline_b_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c fg=150,bg=238 # fg=#afd787,bg=#444444 + ble-face -s vim_airline_c_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c_inactive_modified fg=179,bg=16 # fg=#d7af5f,bg=#000000 + ble-face -s vim_airline_c_insert fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_insert_modified fg=179,bg=238 # fg=#d7af5f,bg=#444444 + ble-face -s vim_airline_c_normal_modified fg=179,bg=238 # fg=#d7af5f,bg=#444444 + ble-face -s vim_airline_c_replace fg=174,bg=238 # fg=#d78787,bg=#444444 + ble-face -s vim_airline_c_replace_modified fg=179,bg=238 # fg=#d7af5f,bg=#444444 + ble-face -s vim_airline_c_visual fg=182,bg=238 # fg=#d7afd7,bg=#444444 + ble-face -s vim_airline_c_visual_modified fg=179,bg=238 # fg=#d7af5f,bg=#444444 +} diff --git a/.local/share/blesh/contrib/airline/cobalt2.bash b/.local/share/blesh/contrib/airline/cobalt2.bash new file mode 100644 index 0000000..4b84c31 --- /dev/null +++ b/.local/share/blesh/contrib/airline/cobalt2.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/cobalt2.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:cobalt2/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=32 # fg=#ffffff,bg=#1f7ad8 + ble-face -s vim_airline_a_inactive fg=239,bg=23 # fg=#4e4e4e,bg=#204458 + ble-face -s vim_airline_a_insert fg=241,bg=221 # fg=#666d51,bg=#fee533 + ble-face -s vim_airline_a_replace fg=231,bg=174 # fg=#ffffff,bg=#ea9299 + ble-face -s vim_airline_a_visual fg=228,bg=214 # fg=#ffff9a,bg=#ff9d00 + ble-face -s vim_airline_b fg=231,bg=111 # fg=#ffffff,bg=#8cc2fd + ble-face -s vim_airline_b_inactive fg=239,bg=23 # fg=#4e4e4e,bg=#204458 + ble-face -s vim_airline_c fg=231,bg=23 # fg=#ffffff,bg=#204458 + ble-face -s vim_airline_c_inactive fg=239,bg=23 # fg=#4e4e4e,bg=#204458 + ble-face -s vim_airline_c_inactive_modified fg=125,bg=231 # fg=#b42839,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=241,bg=221 # fg=#666d51,bg=#fee533 + ble-face -s vim_airline_c_normal_modified fg=231,bg=32 # fg=#ffffff,bg=#1f7ad8 + ble-face -s vim_airline_c_replace_modified fg=231,bg=174 # fg=#ffffff,bg=#ea9299 + ble-face -s vim_airline_c_visual_modified fg=228,bg=214 # fg=#ffff9a,bg=#ff9d00 + ble-face -s vim_airline_warning fg=23,bg=231 # fg=#204458,bg=#ffffff + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/cool.bash b/.local/share/blesh/contrib/airline/cool.bash new file mode 100644 index 0000000..c5891e9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/cool.bash @@ -0,0 +1,25 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/cool.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:cool/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=240,bg=254 # fg=#585858,bg=#e4e4e4 + ble-face -s vim_airline_b fg=254,bg=31 # fg=#e4e4e4,bg=#0087af + ble-face -s vim_airline_b_inactive fg=254,bg=60 # fg=#e4e4e4,bg=#466d79 + ble-face -s vim_airline_b_insert fg=254,bg=70 # fg=#e4e4e4,bg=#47af00 + ble-face -s vim_airline_b_replace fg=254,bg=130 # fg=#e4e4e4,bg=#af5f00 + ble-face -s vim_airline_b_visual fg=254,bg=124 # fg=#e4e4e4,bg=#af2800 + ble-face -s vim_airline_c fg=255,bg=24 # fg=#eeeeee,bg=#005f87 + ble-face -s vim_airline_c_inactive fg=255,bg=238 # fg=#eeeeee,bg=#324e59 + ble-face -s vim_airline_c_insert fg=255,bg=28 # fg=#eeeeee,bg=#2e8700 + ble-face -s vim_airline_c_replace fg=255,bg=94 # fg=#eeeeee,bg=#875300 + ble-face -s vim_airline_c_visual fg=255,bg=88 # fg=#eeeeee,bg=#872800 + ble-face -s vim_airline_term fg=255,bg=24 # fg=#eeeeee,bg=#005f87 + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_insert fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_visual fg=255,bg=88 # fg=#eeeeee,bg=#872800 +} diff --git a/.local/share/blesh/contrib/airline/cyberpunk.bash b/.local/share/blesh/contrib/airline/cyberpunk.bash new file mode 100644 index 0000000..83f948d --- /dev/null +++ b/.local/share/blesh/contrib/airline/cyberpunk.bash @@ -0,0 +1,43 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/cyberpunk.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by danrneal (http://github.com/danrneal) +# Cyberpunk by Tai Groot + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:cyberpunk/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=32,bg=220 # fg=#0197dd,bg=#ffd302 + ble-face -s vim_airline_a_commandline fg=234,bg=196 # fg=#191919,bg=#ff0000 + ble-face -s vim_airline_a_inactive fg=234,bg=238 # fg=#191919,bg=#414c3b + ble-face -s vim_airline_a_insert fg=220,bg=32 # fg=#ffd302,bg=#0197dd + ble-face -s vim_airline_a_replace fg=234,bg=196 # fg=#191919,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=234,bg=64 # fg=#191919,bg=#408000 + ble-face -s vim_airline_b fg=241,bg=238 # fg=#666666,bg=#414c3b + ble-face -s vim_airline_b_commandline_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_b_inactive_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_b_insert_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_b_normal_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_b_replace_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_b_visual_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_c fg=32,bg=220 # fg=#0197dd,bg=#ffd302 + ble-face -s vim_airline_c_commandline fg=234,bg=196 # fg=#191919,bg=#ff0000 + ble-face -s vim_airline_c_inactive fg=238,bg=234 # fg=#414c3b,bg=#191919 + ble-face -s vim_airline_c_insert fg=220,bg=32 # fg=#ffd302,bg=#0197dd + ble-face -s vim_airline_c_replace fg=234,bg=196 # fg=#191919,bg=#ff0000 + ble-face -s vim_airline_c_visual fg=234,bg=64 # fg=#191919,bg=#408000 + ble-face -s vim_airline_error fg=196,bg=25 # fg=#ff0000,bg=#0c35bf + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_inactive_modified fg=196,bg=25 # fg=#ff0000,bg=#0c35bf + ble-face -s vim_airline_warning fg=118,bg=25 # fg=#87f025,bg=#0c35bf + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_warning_inactive_modified fg=118,bg=25 # fg=#87f025,bg=#0c35bf + ble-face -s vim_airline_y_commandline_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_y_inactive_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_y_insert_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_y_normal_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_y_replace_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 + ble-face -s vim_airline_y_visual_modified fg=45,bg=234 # fg=#0eeafa,bg=#191919 +} diff --git a/.local/share/blesh/contrib/airline/dark.bash b/.local/share/blesh/contrib/airline/dark.bash new file mode 100644 index 0000000..a6de51c --- /dev/null +++ b/.local/share/blesh/contrib/airline/dark.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline/autoload/airline/themes/dark.vim +# The MIT License (MIT) +# Copyright (c) 2013-2021 Bailey Ling et al. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=190 # fg=#00005f,bg=#dfff00 + ble-face -s vim_airline_a_commandline fg=17,bg=40 # fg=#00005f,bg=#00d700 + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=17,bg=45 # fg=#00005f,bg=#00dfff + ble-face -s vim_airline_a_replace fg=231,bg=124 # fg=#ffffff,bg=#af0000 + ble-face -s vim_airline_a_visual fg=16,bg=214 # fg=#000000,bg=#ffaf00 + ble-face -s vim_airline_b fg=231,bg=238 # fg=#ffffff,bg=#444444 + ble-face -s vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626 + ble-face -s vim_airline_b_insert fg=231,bg=27 # fg=#ffffff,bg=#005fff + ble-face -s vim_airline_b_visual fg=16,bg=202 # fg=#000000,bg=#ff5f00 + ble-face -s vim_airline_c fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c_inactive_modified fg=97,bg=231 # fg=#875faf,bg=#ffffff + ble-face -s vim_airline_c_insert fg=231,bg=18 # fg=#ffffff,bg=#000080 + ble-face -s vim_airline_c_insert_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_normal_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_replace_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_visual fg=231,bg=52 # fg=#ffffff,bg=#5f0000 + ble-face -s vim_airline_c_visual_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_z_replace fg=17,bg=45 # fg=#00005f,bg=#00dfff +} diff --git a/.local/share/blesh/contrib/airline/dark_minimal.bash b/.local/share/blesh/contrib/airline/dark_minimal.bash new file mode 100644 index 0000000..2285147 --- /dev/null +++ b/.local/share/blesh/contrib/airline/dark_minimal.bash @@ -0,0 +1,13 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/dark_minimal.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:dark_minimal/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=190 # fg=#00005f,bg=#dfff00 + ble-face -s vim_airline_b fg=231,bg=238 # fg=#ffffff,bg=#444444 + ble-face -s vim_airline_c fg=158,bg=234 # fg=#9cffd3,bg=#202020 +} diff --git a/.local/share/blesh/contrib/airline/desertink.bash b/.local/share/blesh/contrib/airline/desertink.bash new file mode 100644 index 0000000..800132e --- /dev/null +++ b/.local/share/blesh/contrib/airline/desertink.bash @@ -0,0 +1,36 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/desertink.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Based on powerlinish +# +# Theme to mimic the default colorscheme of powerline +# Not 100% the same so it's powerline... ish. +# +# Differences from default powerline: +# * Paste indicator isn't colored different +# * Far right hand section matches the color of the mode indicator +# +# Differences from other airline themes: +# * No color differences when you're in a modified buffer +# * Visual mode only changes the mode section. Otherwise +# it appears the same as normal mode + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:desertink/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=148 # fg=#005f00,bg=#afd700 + ble-face -s vim_airline_a_inactive fg=243,bg=239 # fg=#777777,bg=#4a4a4a + ble-face -s vim_airline_a_insert fg=231,bg=23 # fg=#ffffff,bg=#004866 + ble-face -s vim_airline_a_normal_modified fg=88,bg=208 # fg=#870000,bg=#ff8700 + ble-face -s vim_airline_a_replace fg=231,bg=167 # fg=#ffffff,bg=#d74444 + ble-face -s vim_airline_a_visual fg=232,bg=214 # fg=#080808,bg=#ffaf00 + ble-face -s vim_airline_b fg=250,bg=238 # fg=#bbbbbb,bg=#444444 + ble-face -s vim_airline_b_inactive fg=243,bg=237 # fg=#777777,bg=#3a3a3a + ble-face -s vim_airline_b_insert fg=117,bg=31 # fg=#99ddff,bg=#0087af + ble-face -s vim_airline_b_replace fg=250,bg=238 # fg=#bbbbbb,bg=#444444 + ble-face -s vim_airline_c fg=231,bg=236 # fg=#ffffff,bg=#303030 + ble-face -s vim_airline_c_inactive fg=247,bg=236 # fg=#999999,bg=#303030 + ble-face -s vim_airline_z_normal_modified fg=88,bg=208 # fg=#870000,bg=#ff8700 +} diff --git a/.local/share/blesh/contrib/airline/deus.bash b/.local/share/blesh/contrib/airline/deus.bash new file mode 100644 index 0000000..0119985 --- /dev/null +++ b/.local/share/blesh/contrib/airline/deus.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/deus.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:deus/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=114 # fg=#282c34,bg=#98c379 + ble-face -s vim_airline_a_inactive fg=17,bg=249 # fg=#282c34,bg=#abb2bf + ble-face -s vim_airline_a_insert fg=17,bg=75 # fg=#282c34,bg=#61afef + ble-face -s vim_airline_a_replace fg=17,bg=168 # fg=#282c34,bg=#e06c75 + ble-face -s vim_airline_a_visual fg=17,bg=176 # fg=#282c34,bg=#c678dd + ble-face -s vim_airline_b fg=249,bg=238 # fg=#abb2bf,bg=#3e4452 + ble-face -s vim_airline_c fg=114,bg=17 # fg=#98c379,bg=#282c34 + ble-face -s vim_airline_c_inactive fg=249,bg=238 # fg=#abb2bf,bg=#3e4452 + ble-face -s vim_airline_c_inactive_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_insert fg=75,bg=17 # fg=#61afef,bg=#282c34 + ble-face -s vim_airline_c_insert_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_normal_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_replace fg=168,bg=17 # fg=#e06c75,bg=#282c34 + ble-face -s vim_airline_c_replace_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_visual fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_c_visual_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_error fg=17,bg=168 # fg=#282c34,bg=#e06c75 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=17,bg=180 # fg=#282c34,bg=#e5c07b + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/distinguished.bash b/.local/share/blesh/contrib/airline/distinguished.bash new file mode 100644 index 0000000..792c301 --- /dev/null +++ b/.local/share/blesh/contrib/airline/distinguished.bash @@ -0,0 +1,32 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/distinguished.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of distinguished +# (https://github.com/Lokaltog/vim-distinguished) +# I have nothing to do with the original +# distinguished theme other than being a big fan. +# this theme was shamelessly created by modifying +# the Ubaryd airline theme. + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:distinguished/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=16,bg=245 # fg=#000000,bg=#8a8a8a + ble-face -s vim_airline_a_inactive fg=238,bg=234 # fg=#444444,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=16,bg=143 # fg=#000000,bg=#afaf5f + ble-face -s vim_airline_a_normal_modified fg=231,bg=166 # fg=#ffffff,bg=#d75f00 + ble-face -s vim_airline_a_replace fg=16,bg=67 # fg=#000000,bg=#5f87af + ble-face -s vim_airline_a_visual fg=16,bg=131 # fg=#000000,bg=#af5f5f + ble-face -s vim_airline_b fg=250,bg=238 # fg=#bcbcbc,bg=#444444 + ble-face -s vim_airline_b_inactive fg=238,bg=234 # fg=#444444,bg=#1c1c1c + ble-face -s vim_airline_c fg=245,bg=234 # fg=#8a8a8a,bg=#1c1c1c + ble-face -s vim_airline_c_inactive fg=238,bg=234 # fg=#444444,bg=#1c1c1c + ble-face -s vim_airline_c_insert fg=143,bg=234 # fg=#afaf5f,bg=#1c1c1c + ble-face -s vim_airline_c_normal_modified fg=166,bg=231 # fg=#d75f00,bg=#ffffff + ble-face -s vim_airline_c_replace fg=67,bg=234 # fg=#5f87af,bg=#1c1c1c + ble-face -s vim_airline_c_visual fg=131,bg=234 # fg=#af5f5f,bg=#1c1c1c + ble-face -s vim_airline_x_normal_modified fg=166,bg=231 # fg=#d75f00,bg=#ffffff + ble-face -s vim_airline_z_normal_modified fg=231,bg=166 # fg=#ffffff,bg=#d75f00 +} diff --git a/.local/share/blesh/contrib/airline/durant.bash b/.local/share/blesh/contrib/airline/durant.bash new file mode 100644 index 0000000..56a4eea --- /dev/null +++ b/.local/share/blesh/contrib/airline/durant.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/durant.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:durant/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=148 # fg=#005f00,bg=#afd700 + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=231,bg=29 # fg=#ffffff,bg=#00875f + ble-face -s vim_airline_a_replace fg=247,bg=124 # fg=#9e9e9e,bg=#af0000 + ble-face -s vim_airline_a_visual fg=234,bg=231 # fg=#1a1a18,bg=#ffffff + ble-face -s vim_airline_b fg=109,bg=60 # fg=#93a1a1,bg=#586e75 + ble-face -s vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626 + ble-face -s vim_airline_b_insert fg=247,bg=236 # fg=#9e9e9e,bg=#303030 + ble-face -s vim_airline_b_visual fg=231,bg=238 # fg=#ffffff,bg=#44403a + ble-face -s vim_airline_c fg=109,bg=23 # fg=#93a1a1,bg=#073642 + ble-face -s vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c_inactive_modified fg=97,bg=231 # fg=#875faf,bg=#ffffff + ble-face -s vim_airline_c_insert fg=117,bg=24 # fg=#87d7ff,bg=#005f87 + ble-face -s vim_airline_c_insert_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_replace_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_visual fg=108,bg=236 # fg=#90a680,bg=#2e2d2a + ble-face -s vim_airline_c_visual_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_z_replace fg=231,bg=29 # fg=#ffffff,bg=#00875f +} diff --git a/.local/share/blesh/contrib/airline/fairyfloss.bash b/.local/share/blesh/contrib/airline/fairyfloss.bash new file mode 100644 index 0000000..56b17b6 --- /dev/null +++ b/.local/share/blesh/contrib/airline/fairyfloss.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/fairyfloss.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Color palette + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:fairyfloss/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=141 # fg=#f8f8f0,bg=#ae81ff + ble-face -s vim_airline_a_inactive fg=103,bg=238 # fg=#8076aa,bg=#49483e + ble-face -s vim_airline_a_insert fg=238,bg=121 # fg=#49483e,bg=#80ffbd + ble-face -s vim_airline_a_replace fg=197,bg=238 # fg=#f92672,bg=#49483e + ble-face -s vim_airline_a_visual fg=255,bg=197 # fg=#f8f8f0,bg=#f92672 + ble-face -s vim_airline_b fg=255,bg=238 # fg=#f8f8f0,bg=#49483e + ble-face -s vim_airline_b_inactive fg=103,bg=237 # fg=#8076aa,bg=#3b3a32 + ble-face -s vim_airline_c fg=237,bg=141 # fg=#3b3a32,bg=#ae81ff + ble-face -s vim_airline_c_inactive fg=103,bg=237 # fg=#8076aa,bg=#3b3a32 + ble-face -s vim_airline_c_inactive_modified fg=218,bg=16 # fg=#ffb8d1,bg=#000000 + ble-face -s vim_airline_c_insert fg=255,bg=238 # fg=#f8f8f0,bg=#49483e + ble-face -s vim_airline_c_insert_modified fg=218,bg=16 # fg=#ffb8d1,bg=#000000 + ble-face -s vim_airline_c_normal_modified fg=218,bg=16 # fg=#ffb8d1,bg=#000000 + ble-face -s vim_airline_c_replace_modified fg=218,bg=16 # fg=#ffb8d1,bg=#000000 + ble-face -s vim_airline_c_visual fg=255,bg=238 # fg=#f8f8f0,bg=#49483e + ble-face -s vim_airline_c_visual_modified fg=218,bg=16 # fg=#ffb8d1,bg=#000000 +} diff --git a/.local/share/blesh/contrib/airline/fruit_punch.bash b/.local/share/blesh/contrib/airline/fruit_punch.bash new file mode 100644 index 0000000..c21b518 --- /dev/null +++ b/.local/share/blesh/contrib/airline/fruit_punch.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/fruit_punch.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Fruitpunch - A fruity airline theme! +# vim: tw=80 et sw=2 ts=2 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:fruit_punch/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=217 # fg=#303030,bg=#f29db4 + ble-face -s vim_airline_a_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_a_insert fg=236,bg=222 # fg=#303030,bg=#fce78d + ble-face -s vim_airline_a_replace fg=236,bg=203 # fg=#303030,bg=#f97070 + ble-face -s vim_airline_a_visual fg=236,bg=116 # fg=#303030,bg=#79e5e0 + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b2b2b2,bg=#3a3a3a + ble-face -s vim_airline_b_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c fg=217,bg=238 # fg=#f29db4,bg=#444444 + ble-face -s vim_airline_c_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c_insert fg=222,bg=238 # fg=#fce78d,bg=#444444 + ble-face -s vim_airline_c_normal_modified fg=222,bg=238 # fg=#fce78d,bg=#444444 + ble-face -s vim_airline_c_replace fg=203,bg=238 # fg=#f97070,bg=#444444 + ble-face -s vim_airline_c_replace_modified fg=222,bg=238 # fg=#fce78d,bg=#444444 + ble-face -s vim_airline_c_visual fg=116,bg=238 # fg=#79e5e0,bg=#444444 + ble-face -s vim_airline_c_visual_modified fg=222,bg=238 # fg=#fce78d,bg=#444444 + ble-face -s vim_airline_warning fg=236,bg=179 # fg=#303030,bg=#e8a15a +} diff --git a/.local/share/blesh/contrib/airline/google_dark.bash b/.local/share/blesh/contrib/airline/google_dark.bash new file mode 100644 index 0000000..28f66cd --- /dev/null +++ b/.local/share/blesh/contrib/airline/google_dark.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/google_dark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by danrneal (http://github.com/danrneal) +# Google Scheme by Lisie Michel (https://github.com/google/vim-colorscheme-primary/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:google_dark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=71 # fg=#202124,bg=#34a853 + ble-face -s vim_airline_a_inactive fg=235,bg=241 # fg=#202124,bg=#5f6368 + ble-face -s vim_airline_a_insert fg=235,bg=69 # fg=#202124,bg=#4285f4 + ble-face -s vim_airline_a_replace fg=235,bg=167 # fg=#202124,bg=#ea4335 + ble-face -s vim_airline_a_visual fg=235,bg=214 # fg=#202124,bg=#fbbc04 + ble-face -s vim_airline_b fg=189,bg=241 # fg=#e8eaed,bg=#5f6368 + ble-face -s vim_airline_c fg=71,bg=235 # fg=#34a853,bg=#202124 + ble-face -s vim_airline_c_inactive fg=241,bg=235 # fg=#5f6368,bg=#202124 + ble-face -s vim_airline_c_inactive_modified fg=231,bg=235 # fg=#ffffff,bg=#202124 + ble-face -s vim_airline_c_insert fg=69,bg=235 # fg=#4285f4,bg=#202124 + ble-face -s vim_airline_c_insert_modified fg=231,bg=235 # fg=#ffffff,bg=#202124 + ble-face -s vim_airline_c_normal_modified fg=231,bg=235 # fg=#ffffff,bg=#202124 + ble-face -s vim_airline_c_replace fg=167,bg=235 # fg=#ea4335,bg=#202124 + ble-face -s vim_airline_c_replace_modified fg=231,bg=235 # fg=#ffffff,bg=#202124 + ble-face -s vim_airline_c_visual fg=214,bg=235 # fg=#fbbc04,bg=#202124 + ble-face -s vim_airline_c_visual_modified fg=231,bg=235 # fg=#ffffff,bg=#202124 +} diff --git a/.local/share/blesh/contrib/airline/google_light.bash b/.local/share/blesh/contrib/airline/google_light.bash new file mode 100644 index 0000000..c564902 --- /dev/null +++ b/.local/share/blesh/contrib/airline/google_light.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/google_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline template by danrneal (http://github.com/danrneal) +# Google Scheme by Lisie Michel (https://github.com/google/vim-colorscheme-primary/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:google_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=71 # fg=#ffffff,bg=#34a853 + ble-face -s vim_airline_a_inactive fg=231,bg=189 # fg=#ffffff,bg=#e8eaed + ble-face -s vim_airline_a_insert fg=231,bg=69 # fg=#ffffff,bg=#4285f4 + ble-face -s vim_airline_a_replace fg=231,bg=167 # fg=#ffffff,bg=#ea4335 + ble-face -s vim_airline_a_visual fg=231,bg=214 # fg=#ffffff,bg=#fbbc04 + ble-face -s vim_airline_b fg=241,bg=189 # fg=#5f6368,bg=#e8eaed + ble-face -s vim_airline_c fg=71,bg=231 # fg=#34a853,bg=#ffffff + ble-face -s vim_airline_c_inactive fg=189,bg=231 # fg=#e8eaed,bg=#ffffff + ble-face -s vim_airline_c_inactive_modified fg=235,bg=231 # fg=#202124,bg=#ffffff + ble-face -s vim_airline_c_insert fg=69,bg=231 # fg=#4285f4,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=235,bg=231 # fg=#202124,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=235,bg=231 # fg=#202124,bg=#ffffff + ble-face -s vim_airline_c_replace fg=167,bg=231 # fg=#ea4335,bg=#ffffff + ble-face -s vim_airline_c_replace_modified fg=235,bg=231 # fg=#202124,bg=#ffffff + ble-face -s vim_airline_c_visual fg=214,bg=231 # fg=#fbbc04,bg=#ffffff + ble-face -s vim_airline_c_visual_modified fg=235,bg=231 # fg=#202124,bg=#ffffff +} diff --git a/.local/share/blesh/contrib/airline/hybrid.bash b/.local/share/blesh/contrib/airline/hybrid.bash new file mode 100644 index 0000000..2578f03 --- /dev/null +++ b/.local/share/blesh/contrib/airline/hybrid.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/hybrid.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Hybrid +# (https://github.com/w0ng/vim-hybrid) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:hybrid/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=16,bg=152 # fg=#000000,bg=#add8e6 + ble-face -s vim_airline_a_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_insert fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_a_replace fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_a_visual fg=16,bg=195 # fg=#000000,bg=#e0ffff + ble-face -s vim_airline_b fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_b_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_c_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_warning fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_warning_inactive_modified fg=-1,bg=-1 # fg=-1,bg=-1 +} diff --git a/.local/share/blesh/contrib/airline/hybridline.bash b/.local/share/blesh/contrib/airline/hybridline.bash new file mode 100644 index 0000000..3fd4656 --- /dev/null +++ b/.local/share/blesh/contrib/airline/hybridline.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/hybridline.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline theme based on vim-hybrid and powerline +# (https://github.com/w0ng/vim-hybrid) +# (https://github.com/Lokaltog/powerline) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:hybridline/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=143 # fg=#005f00,bg=#b5bd68 + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=23,bg=109 # fg=#005f5f,bg=#8abeb7 + ble-face -s vim_airline_a_replace fg=16,bg=167 # fg=#000000,bg=#cc6666 + ble-face -s vim_airline_a_visual fg=16,bg=173 # fg=#000000,bg=#de935f + ble-face -s vim_airline_b fg=251,bg=237 # fg=#c5c8c6,bg=#373b41 + ble-face -s vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626 + ble-face -s vim_airline_b_insert fg=251,bg=31 # fg=#c5c8c6,bg=#0087af + ble-face -s vim_airline_b_replace fg=251,bg=237 # fg=#c5c8c6,bg=#373b41 + ble-face -s vim_airline_c fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c_insert fg=231,bg=24 # fg=#ffffff,bg=#005f87 + ble-face -s vim_airline_c_replace fg=231,bg=236 # fg=#ffffff,bg=#282a2e + ble-face -s vim_airline_z_normal fg=236,bg=251 # fg=#282a2e,bg=#c5c8c6 + ble-face -s vim_airline_z_replace fg=236,bg=251 # fg=#282a2e,bg=#c5c8c6 + ble-face -s vim_airline_z_visual fg=236,bg=251 # fg=#282a2e,bg=#c5c8c6 +} diff --git a/.local/share/blesh/contrib/airline/jellybeans.bash b/.local/share/blesh/contrib/airline/jellybeans.bash new file mode 100644 index 0000000..3bd3717 --- /dev/null +++ b/.local/share/blesh/contrib/airline/jellybeans.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/jellybeans.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Color palette + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:jellybeans/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=25 # fg=#d8dee9,bg=#0d61ac + ble-face -s vim_airline_a_inactive fg=241,bg=235 # fg=#666666,bg=#262626 + ble-face -s vim_airline_a_insert fg=231,bg=58 # fg=#ffffff,bg=#437019 + ble-face -s vim_airline_a_replace fg=88,bg=233 # fg=#870000,bg=#151515 + ble-face -s vim_airline_a_visual fg=231,bg=88 # fg=#ffffff,bg=#870000 + ble-face -s vim_airline_b fg=231,bg=235 # fg=#ffffff,bg=#262626 + ble-face -s vim_airline_b_inactive fg=240,bg=233 # fg=#4f5b66,bg=#151515 + ble-face -s vim_airline_c fg=240,bg=233 # fg=#4f5b66,bg=#151515 + ble-face -s vim_airline_c_inactive_modified fg=215,bg=16 # fg=#ffb964,bg=#000000 + ble-face -s vim_airline_c_insert fg=231,bg=233 # fg=#ffffff,bg=#151515 + ble-face -s vim_airline_c_insert_modified fg=215,bg=16 # fg=#ffb964,bg=#000000 + ble-face -s vim_airline_c_normal_modified fg=215,bg=16 # fg=#ffb964,bg=#000000 + ble-face -s vim_airline_c_replace_modified fg=215,bg=16 # fg=#ffb964,bg=#000000 + ble-face -s vim_airline_c_visual fg=231,bg=233 # fg=#ffffff,bg=#151515 + ble-face -s vim_airline_c_visual_modified fg=215,bg=16 # fg=#ffb964,bg=#000000 +} diff --git a/.local/share/blesh/contrib/airline/jet.bash b/.local/share/blesh/contrib/airline/jet.bash new file mode 100644 index 0000000..81c72ec --- /dev/null +++ b/.local/share/blesh/contrib/airline/jet.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/jet.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +#Originally based on Jellybeans theme. +# Modified to resemble the orclord colorscheme. + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:jet/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=25 # fg=#d8dee9,bg=#0d61ac + ble-face -s vim_airline_a_inactive fg=233,bg=235 # fg=#151515,bg=#262626 + ble-face -s vim_airline_a_insert fg=231,bg=58 # fg=#ffffff,bg=#437019 + ble-face -s vim_airline_a_replace fg=88,bg=235 # fg=#870000,bg=#262626 + ble-face -s vim_airline_a_visual fg=231,bg=88 # fg=#ffffff,bg=#870000 + ble-face -s vim_airline_b fg=231,bg=235 # fg=#ffffff,bg=#262626 + ble-face -s vim_airline_b_inactive fg=240,bg=233 # fg=#4f5b66,bg=#151515 + ble-face -s vim_airline_b_insert fg=240,bg=235 # fg=#4f5b66,bg=#262626 + ble-face -s vim_airline_b_visual fg=240,bg=235 # fg=#4f5b66,bg=#262626 + ble-face -s vim_airline_c fg=240,bg=233 # fg=#4f5b66,bg=#151515 + ble-face -s vim_airline_c_insert fg=231,bg=235 # fg=#ffffff,bg=#262626 + ble-face -s vim_airline_c_visual fg=231,bg=235 # fg=#ffffff,bg=#262626 +} diff --git a/.local/share/blesh/contrib/airline/kalisi.bash b/.local/share/blesh/contrib/airline/kalisi.bash new file mode 100644 index 0000000..8711df5 --- /dev/null +++ b/.local/share/blesh/contrib/airline/kalisi.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/kalisi.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# +# Colorscheme: Kalisi for airline. Inspired by powerline. +# Arthur Jaron +# hifreeo@gmail.com +# 24.10.2014 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:kalisi/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=148 # fg=#005f00,bg=#afd700 + ble-face -s vim_airline_a_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_insert fg=231,bg=160 # fg=#ffffff,bg=#e80000 + ble-face -s vim_airline_a_replace fg=171,bg=231 # fg=#d75fff,bg=#ffffff + ble-face -s vim_airline_a_visual fg=33,bg=231 # fg=#0087ff,bg=#ffffff + ble-face -s vim_airline_b fg=148,bg=22 # fg=#afd700,bg=#005f00 + ble-face -s vim_airline_b_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_b_insert fg=196,bg=52 # fg=#ff0000,bg=#5f0000 + ble-face -s vim_airline_b_replace fg=53,bg=171 # fg=#5f005f,bg=#d75fff + ble-face -s vim_airline_b_visual fg=25,bg=75 # fg=#005faf,bg=#5fafff + ble-face -s vim_airline_c fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_inactive_modified fg=190,bg=16 # fg=#d7ff00,bg=#000000 + ble-face -s vim_airline_c_replace fg=213,bg=91 # fg=#ff87ff,bg=#8700af + ble-face -s vim_airline_c_visual fg=117,bg=25 # fg=#87d7ff,bg=#005faf +} diff --git a/.local/share/blesh/contrib/airline/kolor.bash b/.local/share/blesh/contrib/airline/kolor.bash new file mode 100644 index 0000000..5393a1b --- /dev/null +++ b/.local/share/blesh/contrib/airline/kolor.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/kolor.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:kolor/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=60 # fg=#e2e2e2,bg=#4f3598 + ble-face -s vim_airline_a_inactive fg=249,bg=239 # fg=#b2b2b2,bg=#4a4a4a + ble-face -s vim_airline_a_insert fg=235,bg=111 # fg=#242322,bg=#7eaefd + ble-face -s vim_airline_a_replace fg=116,bg=23 # fg=#75d7d8,bg=#005154 + ble-face -s vim_airline_a_visual fg=235,bg=174 # fg=#242322,bg=#e6987a + ble-face -s vim_airline_b fg=206,bg=235 # fg=#ff5fd7,bg=#242322 + ble-face -s vim_airline_b_inactive fg=249,bg=239 # fg=#b2b2b2,bg=#4a4a4a + ble-face -s vim_airline_b_insert fg=116,bg=235 # fg=#75d7d8,bg=#242322 + ble-face -s vim_airline_b_visual fg=185,bg=235 # fg=#dbc570,bg=#242322 + ble-face -s vim_airline_c fg=254,bg=239 # fg=#e2e2e2,bg=#4a4a4a + ble-face -s vim_airline_c_inactive fg=249,bg=239 # fg=#b2b2b2,bg=#4a4a4a + ble-face -s vim_airline_c_inactive_modified fg=97,bg=231 # fg=#875faf,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=235,bg=111 # fg=#242322,bg=#7eaefd + ble-face -s vim_airline_c_normal_modified fg=254,bg=60 # fg=#e2e2e2,bg=#4f3598 + ble-face -s vim_airline_c_replace_modified fg=254,bg=23 # fg=#e2e2e2,bg=#005154 + ble-face -s vim_airline_c_visual_modified fg=235,bg=174 # fg=#242322,bg=#e6987a + ble-face -s vim_airline_z_replace fg=235,bg=111 # fg=#242322,bg=#7eaefd +} diff --git a/.local/share/blesh/contrib/airline/laederon.bash b/.local/share/blesh/contrib/airline/laederon.bash new file mode 100644 index 0000000..4a6d16e --- /dev/null +++ b/.local/share/blesh/contrib/airline/laederon.bash @@ -0,0 +1,43 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/laederon.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Laederon +# (https://github.com/Donearm/Laederon) +# +# Author: Gianluca fiore +# Version: 1.12 +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:laederon/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=18,bg=255 # fg=#081c8c,bg=#f8f6f2 + ble-face -s vim_airline_a_inactive fg=255,bg=236 # fg=#f8f6f2,bg=#2e2d2a + ble-face -s vim_airline_a_insert fg=255,bg=131 # fg=#f8f6f2,bg=#ab3e5b + ble-face -s vim_airline_a_insert_modified fg=255,bg=31 # fg=#f8f6f2,bg=#1693a5 + ble-face -s vim_airline_a_normal_modified fg=18,bg=18 # fg=#081c8c,bg=#081c8c + ble-face -s vim_airline_a_replace fg=108,bg=255 # fg=#90a680,bg=#f8f6f2 + ble-face -s vim_airline_a_replace_modified fg=108,bg=108 # fg=#90a680,bg=#90a680 + ble-face -s vim_airline_a_visual fg=22,bg=255 # fg=#005f00,bg=#f8f6f2 + ble-face -s vim_airline_a_visual_modified fg=22,bg=58 # fg=#005f00,bg=#594512 + ble-face -s vim_airline_b fg=31,bg=255 # fg=#1693a5,bg=#f8f6f2 + ble-face -s vim_airline_b_inactive fg=255,bg=236 # fg=#f8f6f2,bg=#2e2d2a + ble-face -s vim_airline_b_insert fg=235,bg=131 # fg=#242321,bg=#ab3e5b + ble-face -s vim_airline_b_insert_modified fg=31,bg=235 # fg=#1693a5,bg=#242321 + ble-face -s vim_airline_b_normal_modified fg=18,bg=235 # fg=#081c8c,bg=#242321 + ble-face -s vim_airline_b_replace fg=108,bg=235 # fg=#90a680,bg=#242321 + ble-face -s vim_airline_b_visual fg=255,bg=22 # fg=#f8f6f2,bg=#005f00 + ble-face -s vim_airline_b_visual_modified fg=58,bg=235 # fg=#594512,bg=#242321 + ble-face -s vim_airline_c fg=108,bg=236 # fg=#90a680,bg=#2e2d2a + ble-face -s vim_airline_c_inactive fg=255,bg=236 # fg=#f8f6f2,bg=#2e2d2a + ble-face -s vim_airline_c_inactive_modified fg=18,bg=231 # fg=#081c8c,bg=#ffffff + ble-face -s vim_airline_c_insert fg=31,bg=255 # fg=#1693a5,bg=#f8f6f2 + ble-face -s vim_airline_c_insert_modified fg=31,bg=236 # fg=#1693a5,bg=#2e2d2a + ble-face -s vim_airline_c_normal_modified fg=18,bg=236 # fg=#081c8c,bg=#2e2d2a + ble-face -s vim_airline_c_replace fg=255,bg=108 # fg=#f8f6f2,bg=#90a680 + ble-face -s vim_airline_c_replace_modified fg=108,bg=236 # fg=#90a680,bg=#2e2d2a + ble-face -s vim_airline_c_visual fg=58,bg=255 # fg=#594512,bg=#f8f6f2 + ble-face -s vim_airline_c_visual_modified fg=58,bg=236 # fg=#594512,bg=#2e2d2a +} diff --git a/.local/share/blesh/contrib/airline/landscape.bash b/.local/share/blesh/contrib/airline/landscape.bash new file mode 100644 index 0000000..d3154ac --- /dev/null +++ b/.local/share/blesh/contrib/airline/landscape.bash @@ -0,0 +1,34 @@ +# From github:itchyny/landscape.vim/autoload/airline/themes/landscape.vim +# The MIT License (MIT) +# Copyright (c) 2012-2015 itchyny. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:landscape/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=21,bg=231 # fg=#0000ff,bg=#ffffff + ble-face -s vim_airline_a_inactive fg=236,bg=233 # fg=#303030,bg=#121212 + ble-face -s vim_airline_a_insert fg=22,bg=231 # fg=#005f00,bg=#ffffff + ble-face -s vim_airline_a_replace fg=124,bg=231 # fg=#af0000,bg=#ffffff + ble-face -s vim_airline_a_visual fg=57,bg=231 # fg=#5f00ff,bg=#ffffff + ble-face -s vim_airline_b fg=231,bg=21 # fg=#ffffff,bg=#0000ff + ble-face -s vim_airline_b_inactive fg=236,bg=233 # fg=#303030,bg=#121212 + ble-face -s vim_airline_b_insert fg=231,bg=22 # fg=#ffffff,bg=#005f00 + ble-face -s vim_airline_b_replace fg=231,bg=124 # fg=#ffffff,bg=#af0000 + ble-face -s vim_airline_b_visual fg=231,bg=57 # fg=#ffffff,bg=#5f00ff + ble-face -s vim_airline_c fg=231,bg=236 # fg=#ffffff,bg=#303030 + ble-face -s vim_airline_c_inactive fg=236,bg=233 # fg=#303030,bg=#121212 + ble-face -s vim_airline_x_insert fg=250,bg=240 # fg=#bcbcbc,bg=#585858 + ble-face -s vim_airline_x_normal fg=250,bg=240 # fg=#bcbcbc,bg=#585858 + ble-face -s vim_airline_x_replace fg=250,bg=240 # fg=#bcbcbc,bg=#585858 + ble-face -s vim_airline_x_visual fg=250,bg=240 # fg=#bcbcbc,bg=#585858 + ble-face -s vim_airline_y_insert fg=236,bg=245 # fg=#303030,bg=#8a8a8a + ble-face -s vim_airline_y_normal fg=236,bg=245 # fg=#303030,bg=#8a8a8a + ble-face -s vim_airline_y_replace fg=236,bg=245 # fg=#303030,bg=#8a8a8a + ble-face -s vim_airline_y_visual fg=236,bg=245 # fg=#303030,bg=#8a8a8a + ble-face -s vim_airline_z_insert fg=236,bg=252 # fg=#303030,bg=#d0d0d0 + ble-face -s vim_airline_z_normal fg=236,bg=252 # fg=#303030,bg=#d0d0d0 + ble-face -s vim_airline_z_replace fg=236,bg=252 # fg=#303030,bg=#d0d0d0 + ble-face -s vim_airline_z_visual fg=236,bg=252 # fg=#303030,bg=#d0d0d0 +} diff --git a/.local/share/blesh/contrib/airline/lessnoise.bash b/.local/share/blesh/contrib/airline/lessnoise.bash new file mode 100644 index 0000000..64a7864 --- /dev/null +++ b/.local/share/blesh/contrib/airline/lessnoise.bash @@ -0,0 +1,41 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/lessnoise.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim: et:ts=2:sts:sw=2 +# Author: @bekcpear +# https://gist.github.com/bekcpear/41fb86e0817dfb6620b757daf1e2aab0 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:lessnoise/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=159 # fg=#121212,bg=#afffff + ble-face -s vim_airline_a_inactive fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_a_insert fg=233,bg=218 # fg=#121212,bg=#ffafd7 + ble-face -s vim_airline_a_replace fg=233,bg=203 # fg=#121212,bg=#ff5f5f + ble-face -s vim_airline_a_visual fg=233,bg=229 # fg=#121212,bg=#ffffaf + ble-face -s vim_airline_b fg=255,bg=236 # fg=#eeeeee,bg=#303030 + ble-face -s vim_airline_b_commandline fg=159,bg=159 # fg=#afffff,bg=#afffff + ble-face -s vim_airline_b_inactive fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_c fg=247,bg=236 # fg=#9e9e9e,bg=#303030 + ble-face -s vim_airline_c_commandline fg=233,bg=159 # fg=#121212,bg=#afffff + ble-face -s vim_airline_c_inactive fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_c_inactive_modified fg=249,bg=236 # fg=#b2b2b2,bg=#303030 + ble-face -s vim_airline_c_insert_modified fg=249,bg=236 # fg=#b2b2b2,bg=#303030 + ble-face -s vim_airline_c_normal_modified fg=249,bg=236 # fg=#b2b2b2,bg=#303030 + ble-face -s vim_airline_c_replace_modified fg=249,bg=236 # fg=#b2b2b2,bg=#303030 + ble-face -s vim_airline_c_visual_modified fg=249,bg=236 # fg=#b2b2b2,bg=#303030 + ble-face -s vim_airline_x_insert fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_x_normal fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_x_replace fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_x_visual fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_y_inactive fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_y_insert fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_y_normal fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_y_replace fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_y_visual fg=236,bg=236 # fg=#303030,bg=#303030 + ble-face -s vim_airline_z_insert fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_z_normal fg=242,bg=236 # fg=#6c6c6c,bg=#303030 + ble-face -s vim_airline_z_replace fg=242,bg=236 # fg=#6c6c6c,bg=#303030 +} diff --git a/.local/share/blesh/contrib/airline/light.bash b/.local/share/blesh/contrib/airline/light.bash new file mode 100644 index 0000000..f944c1e --- /dev/null +++ b/.local/share/blesh/contrib/airline/light.bash @@ -0,0 +1,34 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=27 # fg=#ffffff,bg=#005fff + ble-face -s vim_airline_a_inactive fg=241,bg=249 # fg=#666666,bg=#b2b2b2 + ble-face -s vim_airline_a_insert fg=231,bg=29 # fg=#ffffff,bg=#00875f + ble-face -s vim_airline_a_replace fg=22,bg=196 # fg=#005f00,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=231,bg=202 # fg=#ffffff,bg=#ff5f00 + ble-face -s vim_airline_b fg=18,bg=45 # fg=#000087,bg=#00dfff + ble-face -s vim_airline_b_inactive fg=245,bg=252 # fg=#8a8a8a,bg=#d0d0d0 + ble-face -s vim_airline_b_insert fg=22,bg=42 # fg=#005f00,bg=#00df87 + ble-face -s vim_airline_b_visual fg=52,bg=214 # fg=#5f0000,bg=#ffaf00 + ble-face -s vim_airline_c fg=27,bg=159 # fg=#005fff,bg=#afffff + ble-face -s vim_airline_c_inactive fg=248,bg=231 # fg=#a8a8a8,bg=#ffffff + ble-face -s vim_airline_c_inactive_modified fg=160,bg=231 # fg=#df0000,bg=#ffffff + ble-face -s vim_airline_c_insert fg=23,bg=156 # fg=#005f5f,bg=#afff87 + ble-face -s vim_airline_c_insert_modified fg=160,bg=224 # fg=#df0000,bg=#ffdfdf + ble-face -s vim_airline_c_normal_modified fg=160,bg=224 # fg=#df0000,bg=#ffdfdf + ble-face -s vim_airline_c_replace_modified fg=160,bg=224 # fg=#df0000,bg=#ffdfdf + ble-face -s vim_airline_c_visual fg=166,bg=228 # fg=#df5f00,bg=#ffff87 + ble-face -s vim_airline_c_visual_modified fg=160,bg=224 # fg=#df0000,bg=#ffdfdf + ble-face -s vim_airline_term fg=27,bg=159 # fg=#005fff,bg=#afffff + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_insert fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_normal_modified fg=160,bg=224 # fg=#df0000,bg=#ffdfdf + ble-face -s vim_airline_term_visual fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_z_replace fg=231,bg=29 # fg=#ffffff,bg=#00875f +} diff --git a/.local/share/blesh/contrib/airline/lighthaus.bash b/.local/share/blesh/contrib/airline/lighthaus.bash new file mode 100644 index 0000000..66c38ea --- /dev/null +++ b/.local/share/blesh/contrib/airline/lighthaus.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/lighthaus.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Lighthaus Color theme for Vim Airline +# GIT: https://github.com/lighthaus-theme/vim +# Author: Adhiraj Sirohi (https://github.com/brutuski) +# Vasundhara Sharma (https://github.com/vasundhasauras) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:lighthaus/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=37 # fg=#21252d,bg=#00bfa4 + ble-face -s vim_airline_a_inactive fg=252,bg=235 # fg=#cccccc,bg=#21252d + ble-face -s vim_airline_a_insert fg=235,bg=71 # fg=#21252d,bg=#50c16e + ble-face -s vim_airline_a_replace fg=235,bg=203 # fg=#21252d,bg=#ff5050 + ble-face -s vim_airline_a_visual fg=235,bg=202 # fg=#21252d,bg=#ed722e + ble-face -s vim_airline_b fg=230,bg=233 # fg=#fffade,bg=#090b26 + ble-face -s vim_airline_b_inactive fg=252,bg=235 # fg=#cccccc,bg=#21252d + ble-face -s vim_airline_c fg=37,bg=235 # fg=#00bfa4,bg=#21252d + ble-face -s vim_airline_c_inactive fg=252,bg=235 # fg=#cccccc,bg=#21252d + ble-face -s vim_airline_c_insert fg=71,bg=235 # fg=#50c16e,bg=#21252d + ble-face -s vim_airline_c_insert_modified fg=166,bg=235 # fg=#e25600,bg=#21252d + ble-face -s vim_airline_c_normal_modified fg=175,bg=235 # fg=#d68eb2,bg=#21252d + ble-face -s vim_airline_c_replace fg=203,bg=235 # fg=#ff5050,bg=#21252d + ble-face -s vim_airline_c_replace_modified fg=226,bg=235 # fg=#ffff00,bg=#21252d + ble-face -s vim_airline_c_visual fg=202,bg=235 # fg=#ed722e,bg=#21252d + ble-face -s vim_airline_c_visual_modified fg=202,bg=235 # fg=#ff4d00,bg=#21252d +} diff --git a/.local/share/blesh/contrib/airline/lucius.bash b/.local/share/blesh/contrib/airline/lucius.bash new file mode 100644 index 0000000..11fb4dc --- /dev/null +++ b/.local/share/blesh/contrib/airline/lucius.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/lucius.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:lucius/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_insert fg=16,bg=152 # fg=#000000,bg=#add8e6 + ble-face -s vim_airline_a_replace fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_b fg=18,bg=252 # fg=#00008b,bg=#d3d3d3 + ble-face -s vim_airline_b_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_c_inactive fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_inactive_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_replace_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_c_visual_modified fg=124,bg=231 # fg=#a52a2a,bg=#ffffff + ble-face -s vim_airline_error fg=21,bg=195 # fg=#0000ff,bg=#e0ffff + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/luna.bash b/.local/share/blesh/contrib/airline/luna.bash new file mode 100644 index 0000000..2364557 --- /dev/null +++ b/.local/share/blesh/contrib/airline/luna.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/luna.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Luna +# (https://github.com/Pychimp/vim-luna) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:luna/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=23 # fg=#ffffff,bg=#005252 + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#002b2b + ble-face -s vim_airline_a_insert fg=231,bg=106 # fg=#ffffff,bg=#789f00 + ble-face -s vim_airline_a_replace fg=231,bg=88 # fg=#ffffff,bg=#920000 + ble-face -s vim_airline_a_visual fg=228,bg=209 # fg=#ffff9a,bg=#ff8036 + ble-face -s vim_airline_b fg=231,bg=23 # fg=#ffffff,bg=#003f3f + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#002b2b + ble-face -s vim_airline_c fg=231,bg=234 # fg=#ffffff,bg=#002b2b + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#002b2b + ble-face -s vim_airline_c_inactive_modified fg=160,bg=231 # fg=#e20000,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=231,bg=23 # fg=#ffffff,bg=#005e5e + ble-face -s vim_airline_c_normal_modified fg=231,bg=52 # fg=#ffffff,bg=#450000 + ble-face -s vim_airline_c_replace_modified fg=231,bg=23 # fg=#ffffff,bg=#005e5e + ble-face -s vim_airline_c_visual_modified fg=231,bg=52 # fg=#ffffff,bg=#450000 + ble-face -s vim_airline_warning fg=231,bg=52 # fg=#ffffff,bg=#5f0000 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_z_replace fg=231,bg=106 # fg=#ffffff,bg=#789f00 +} diff --git a/.local/share/blesh/contrib/airline/minimalist.bash b/.local/share/blesh/contrib/airline/minimalist.bash new file mode 100644 index 0000000..22d6bf3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/minimalist.bash @@ -0,0 +1,28 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/minimalist.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Minimalist Airline - A Material Color Scheme +# +# Author: Diki Ananta +# Repository: https://github.com/dikiaap/minimalist +# Version: 2.0 +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:minimalist/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=239,bg=249 # fg=#4d4d4d,bg=#b3b3b3 + ble-face -s vim_airline_a_inactive fg=235,bg=252 # fg=#262626,bg=#cccccc + ble-face -s vim_airline_b fg=236,bg=247 # fg=#333333,bg=#999999 + ble-face -s vim_airline_b_inactive fg=235,bg=252 # fg=#262626,bg=#cccccc + ble-face -s vim_airline_c fg=236,bg=252 # fg=#333333,bg=#cccccc + ble-face -s vim_airline_c_inactive fg=235,bg=252 # fg=#262626,bg=#cccccc + ble-face -s vim_airline_error fg=234,bg=167 # fg=#1c1c1c,bg=#d75f5f + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_term fg=234,bg=249 # fg=#1c1c1c,bg=#b3b3b3 + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_warning fg=234,bg=215 # fg=#1c1c1c,bg=#ffaf5f + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/molokai.bash b/.local/share/blesh/contrib/airline/molokai.bash new file mode 100644 index 0000000..115c229 --- /dev/null +++ b/.local/share/blesh/contrib/airline/molokai.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/molokai.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:molokai/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=232,bg=186 # fg=#080808,bg=#e6db74 + ble-face -s vim_airline_a_inactive fg=234,bg=239 # fg=#1b1d1e,bg=#465457 + ble-face -s vim_airline_a_insert fg=232,bg=81 # fg=#080808,bg=#66d9ef + ble-face -s vim_airline_a_replace fg=232,bg=197 # fg=#080808,bg=#f92672 + ble-face -s vim_airline_a_visual fg=232,bg=148 # fg=#080808,bg=#a6e22e + ble-face -s vim_airline_b fg=255,bg=235 # fg=#f8f8f0,bg=#232526 + ble-face -s vim_airline_b_inactive fg=234,bg=239 # fg=#1b1d1e,bg=#465457 + ble-face -s vim_airline_c fg=255,bg=239 # fg=#f8f8f0,bg=#465457 + ble-face -s vim_airline_c_inactive fg=234,bg=239 # fg=#1b1d1e,bg=#465457 + ble-face -s vim_airline_c_inactive_modified fg=255,bg=16 # fg=#f8f8f0,bg=#000000 + ble-face -s vim_airline_c_insert_modified fg=232,bg=81 # fg=#080808,bg=#66d9ef + ble-face -s vim_airline_c_normal_modified fg=232,bg=186 # fg=#080808,bg=#e6db74 + ble-face -s vim_airline_c_replace_modified fg=232,bg=197 # fg=#080808,bg=#f92672 + ble-face -s vim_airline_c_visual_modified fg=232,bg=148 # fg=#080808,bg=#a6e22e +} diff --git a/.local/share/blesh/contrib/airline/monochrome.bash b/.local/share/blesh/contrib/airline/monochrome.bash new file mode 100644 index 0000000..4fe3b99 --- /dev/null +++ b/.local/share/blesh/contrib/airline/monochrome.bash @@ -0,0 +1,19 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/monochrome.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:monochrome/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_b fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_error fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_term fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_warning fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/murmur.bash b/.local/share/blesh/contrib/airline/murmur.bash new file mode 100644 index 0000000..27ab9e2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/murmur.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/murmur.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:murmur/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=69 # fg=#ffffff,bg=#5f87ff + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=231,bg=107 # fg=#ffffff,bg=#87af5f + ble-face -s vim_airline_a_replace fg=231,bg=88 # fg=#ffffff,bg=#870000 + ble-face -s vim_airline_a_visual fg=231,bg=208 # fg=#ffffff,bg=#ff8c00 + ble-face -s vim_airline_b fg=144,bg=62 # fg=#afaf87,bg=#5f5f5f + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c fg=255,bg=234 # fg=#f5f5f5,bg=#1c1c1c + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c_insert fg=107,bg=234 # fg=#87af5f,bg=#1c1c1c + ble-face -s vim_airline_c_insert_modified fg=88,bg=234 # fg=#870000,bg=#1c1c1c + ble-face -s vim_airline_c_normal_modified fg=88,bg=234 # fg=#870000,bg=#1c1c1c + ble-face -s vim_airline_c_replace fg=144,bg=234 # fg=#afaf87,bg=#1c1c1c + ble-face -s vim_airline_c_replace_modified fg=88,bg=234 # fg=#870000,bg=#1c1c1c + ble-face -s vim_airline_c_visual fg=208,bg=234 # fg=#ff8c00,bg=#1c1c1c + ble-face -s vim_airline_c_visual_modified fg=88,bg=234 # fg=#870000,bg=#1c1c1c +} diff --git a/.local/share/blesh/contrib/airline/night_owl.bash b/.local/share/blesh/contrib/airline/night_owl.bash new file mode 100644 index 0000000..4121593 --- /dev/null +++ b/.local/share/blesh/contrib/airline/night_owl.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/night_owl.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Port/inspired from https://github.com/sdras/night-owl-vscode-theme +# Jared Ramirez + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:night_owl/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=116 # fg=#282c34,bg=#83dcc8 + ble-face -s vim_airline_a_inactive fg=17,bg=176 # fg=#282c34,bg=#c792ea + ble-face -s vim_airline_a_insert fg=17,bg=149 # fg=#282c34,bg=#afd75f + ble-face -s vim_airline_a_replace fg=17,bg=222 # fg=#282c34,bg=#ffd787 + ble-face -s vim_airline_a_visual fg=17,bg=111 # fg=#282c34,bg=#81aaff + ble-face -s vim_airline_b fg=17,bg=73 # fg=#282c34,bg=#68b0a0 + ble-face -s vim_airline_b_inactive fg=176,bg=17 # fg=#c792ea,bg=#282c34 + ble-face -s vim_airline_b_insert fg=17,bg=107 # fg=#282c34,bg=#8cac4c + ble-face -s vim_airline_b_replace fg=17,bg=179 # fg=#282c34,bg=#ccac6c + ble-face -s vim_airline_b_visual fg=17,bg=68 # fg=#282c34,bg=#6788cc + ble-face -s vim_airline_c fg=116,bg=17 # fg=#83dcc8,bg=#282c34 + ble-face -s vim_airline_c_inactive fg=176,bg=17 # fg=#c792ea,bg=#282c34 + ble-face -s vim_airline_c_insert fg=149,bg=17 # fg=#afd75f,bg=#282c34 + ble-face -s vim_airline_c_replace fg=222,bg=17 # fg=#ffd787,bg=#282c34 + ble-face -s vim_airline_c_visual fg=111,bg=17 # fg=#81aaff,bg=#282c34 +} diff --git a/.local/share/blesh/contrib/airline/nord_minimal.bash b/.local/share/blesh/contrib/airline/nord_minimal.bash new file mode 100644 index 0000000..25144cc --- /dev/null +++ b/.local/share/blesh/contrib/airline/nord_minimal.bash @@ -0,0 +1,13 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/nord_minimal.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:nord_minimal/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=109,bg=239 # fg=#81a1c1,bg=#434c5e + ble-face -s vim_airline_b fg=109,bg=239 # fg=#81a1c1,bg=#434c5e + ble-face -s vim_airline_c fg=109,bg=239 # fg=#81a1c1,bg=#434c5e +} diff --git a/.local/share/blesh/contrib/airline/onedark.bash b/.local/share/blesh/contrib/airline/onedark.bash new file mode 100644 index 0000000..4d555a3 --- /dev/null +++ b/.local/share/blesh/contrib/airline/onedark.bash @@ -0,0 +1,38 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/onedark.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# [onedark.vim](https://github.com/joshdick/onedark.vim/) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:onedark/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=114 # fg=#282c34,bg=#98c379 + ble-face -s vim_airline_a_inactive fg=17,bg=249 # fg=#282c34,bg=#abb2bf + ble-face -s vim_airline_a_insert fg=17,bg=75 # fg=#282c34,bg=#61afef + ble-face -s vim_airline_a_replace fg=17,bg=168 # fg=#282c34,bg=#e06c75 + ble-face -s vim_airline_a_visual fg=17,bg=176 # fg=#282c34,bg=#c678dd + ble-face -s vim_airline_b fg=249,bg=238 # fg=#abb2bf,bg=#3e4452 + ble-face -s vim_airline_c fg=114,bg=17 # fg=#98c379,bg=#282c34 + ble-face -s vim_airline_c_inactive fg=249,bg=238 # fg=#abb2bf,bg=#3e4452 + ble-face -s vim_airline_c_inactive_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_insert fg=75,bg=17 # fg=#61afef,bg=#282c34 + ble-face -s vim_airline_c_insert_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_normal_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_replace fg=168,bg=17 # fg=#e06c75,bg=#282c34 + ble-face -s vim_airline_c_replace_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_visual fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_c_visual_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_error fg=17,bg=168 # fg=#282c34,bg=#e06c75 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_term fg=114,bg=17 # fg=#98c379,bg=#282c34 + ble-face -s vim_airline_term_inactive fg=249,bg=238 # fg=#abb2bf,bg=#3e4452 + ble-face -s vim_airline_term_insert fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_term_insert_modified fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_term_normal_modified fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_term_replace_modified fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_term_visual fg=176,bg=17 # fg=#c678dd,bg=#282c34 + ble-face -s vim_airline_warning fg=17,bg=180 # fg=#282c34,bg=#e5c07b + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/ouo.bash b/.local/share/blesh/contrib/airline/ouo.bash new file mode 100644 index 0000000..94ab30c --- /dev/null +++ b/.local/share/blesh/contrib/airline/ouo.bash @@ -0,0 +1,37 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ouo.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Author: Huang Po-Hsuan +# Filename: ouo.vim +# Last Modified: 2018-10-21 19:59:41 +# Vim: enc=utf-8 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ouo/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=27 # fg=#ffffff,bg=#005fff + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=231,bg=70 # fg=#ffffff,bg=#5faf00 + ble-face -s vim_airline_a_replace fg=231,bg=160 # fg=#ffffff,bg=#d70000 + ble-face -s vim_airline_a_visual fg=231,bg=166 # fg=#ffffff,bg=#d75f00 + ble-face -s vim_airline_b fg=144,bg=237 # fg=#afaf87,bg=#3a3a3a + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c fg=39,bg=234 # fg=#00afff,bg=#1c1c1c + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c_inactive_modified fg=124,bg=234 # fg=#af0000,bg=#1c1c1c + ble-face -s vim_airline_c_insert fg=70,bg=234 # fg=#5faf00,bg=#1c1c1c + ble-face -s vim_airline_c_insert_modified fg=124,bg=234 # fg=#af0000,bg=#1c1c1c + ble-face -s vim_airline_c_normal_modified fg=124,bg=234 # fg=#af0000,bg=#1c1c1c + ble-face -s vim_airline_c_replace fg=144,bg=234 # fg=#afaf87,bg=#1c1c1c + ble-face -s vim_airline_c_replace_modified fg=124,bg=234 # fg=#af0000,bg=#1c1c1c + ble-face -s vim_airline_c_visual fg=166,bg=234 # fg=#d75f00,bg=#1c1c1c + ble-face -s vim_airline_c_visual_modified fg=124,bg=234 # fg=#af0000,bg=#1c1c1c + ble-face -s vim_airline_error fg=231,bg=160 # fg=#ffffff,bg=#d70000 + ble-face -s vim_airline_error_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_error_inactive_modified fg=231,bg=160 # fg=#ffffff,bg=#d70000 + ble-face -s vim_airline_warning fg=231,bg=166 # fg=#ffffff,bg=#d75f00 + ble-face -s vim_airline_warning_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_warning_inactive_modified fg=231,bg=166 # fg=#ffffff,bg=#d75f00 +} diff --git a/.local/share/blesh/contrib/airline/owo.bash b/.local/share/blesh/contrib/airline/owo.bash new file mode 100644 index 0000000..c14e85d --- /dev/null +++ b/.local/share/blesh/contrib/airline/owo.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/owo.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:owo/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=117 # fg=#303030,bg=#87d7ff + ble-face -s vim_airline_a_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_a_insert fg=238,bg=110 # fg=#444444,bg=#87afd7 + ble-face -s vim_airline_a_replace fg=236,bg=105 # fg=#303030,bg=#8787ff + ble-face -s vim_airline_a_visual fg=236,bg=114 # fg=#303030,bg=#87d787 + ble-face -s vim_airline_b fg=249,bg=237 # fg=#b2b2b2,bg=#3a3a3a + ble-face -s vim_airline_b_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c fg=117,bg=238 # fg=#87d7ff,bg=#444444 + ble-face -s vim_airline_c_inactive fg=249,bg=238 # fg=#b2b2b2,bg=#444444 + ble-face -s vim_airline_c_inactive_modified fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_insert fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_normal_modified fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_replace fg=105,bg=238 # fg=#8787ff,bg=#444444 + ble-face -s vim_airline_c_replace_modified fg=110,bg=238 # fg=#87afd7,bg=#444444 + ble-face -s vim_airline_c_visual fg=114,bg=238 # fg=#87d787,bg=#444444 + ble-face -s vim_airline_c_visual_modified fg=110,bg=238 # fg=#87afd7,bg=#444444 +} diff --git a/.local/share/blesh/contrib/airline/papercolor.bash b/.local/share/blesh/contrib/airline/papercolor.bash new file mode 100644 index 0000000..b6bf5bc --- /dev/null +++ b/.local/share/blesh/contrib/airline/papercolor.bash @@ -0,0 +1,22 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/papercolor.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:papercolor/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=240,bg=254 # fg=#585858,bg=#e4e4e4 + ble-face -s vim_airline_a_replace fg=161,bg=254 # fg=#d7005f,bg=#e4e4e4 + ble-face -s vim_airline_a_visual fg=24,bg=254 # fg=#005f87,bg=#e4e4e4 + ble-face -s vim_airline_b fg=254,bg=31 # fg=#e4e4e4,bg=#0087af + ble-face -s vim_airline_b_inactive fg=240,bg=254 # fg=#585858,bg=#e4e4e4 + ble-face -s vim_airline_b_visual fg=231,bg=31 # fg=#ffffff,bg=#0087af + ble-face -s vim_airline_c fg=255,bg=24 # fg=#eeeeee,bg=#005f87 + ble-face -s vim_airline_c_inactive fg=254,bg=31 # fg=#e4e4e4,bg=#0087af + ble-face -s vim_airline_c_inactive_modified fg=240,bg=254 # fg=#585858,bg=#e4e4e4 + ble-face -s vim_airline_c_visual fg=254,bg=24 # fg=#e4e4e4,bg=#005f87 + ble-face -s vim_airline_x_inactive fg=240,bg=254 # fg=#585858,bg=#e4e4e4 + ble-face -s vim_airline_z_replace fg=240,bg=254 # fg=#585858,bg=#e4e4e4 +} diff --git a/.local/share/blesh/contrib/airline/peaksea.bash b/.local/share/blesh/contrib/airline/peaksea.bash new file mode 100644 index 0000000..ea29a05 --- /dev/null +++ b/.local/share/blesh/contrib/airline/peaksea.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/peaksea.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# peaksea Airline theme +# +# Author: Jonathan Dion +# Version: 1.0 +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:peaksea/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=237,bg=153 # fg=#3a3a3a,bg=#c0d8f8 + ble-face -s vim_airline_a_inactive fg=241,bg=235 # fg=#666666,bg=#262626 + ble-face -s vim_airline_a_insert fg=237,bg=84 # fg=#3a3a3a,bg=#60f080 + ble-face -s vim_airline_a_replace fg=237,bg=186 # fg=#3a3a3a,bg=#d0d090 + ble-face -s vim_airline_a_visual fg=237,bg=219 # fg=#3a3a3a,bg=#f0c0f0 + ble-face -s vim_airline_b fg=254,bg=239 # fg=#e4e4e4,bg=#4e4e4e + ble-face -s vim_airline_b_inactive fg=241,bg=235 # fg=#666666,bg=#262626 + ble-face -s vim_airline_c fg=255,bg=235 # fg=#eeeeee,bg=#262626 + ble-face -s vim_airline_c_inactive fg=241,bg=235 # fg=#666666,bg=#262626 + ble-face -s vim_airline_error fg=234,bg=167 # fg=#1c1c1c,bg=167 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_term fg=234,bg=237 # fg=#1c1c1c,bg=#3a3a3a + ble-face -s vim_airline_term_inactive fg=158,bg=234 # fg=#9cffd3,bg=#202020 + ble-face -s vim_airline_warning fg=234,bg=179 # fg=#1c1c1c,bg=#e0c060 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/powerlineish.bash b/.local/share/blesh/contrib/airline/powerlineish.bash new file mode 100644 index 0000000..da65ab9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/powerlineish.bash @@ -0,0 +1,34 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/powerlineish.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Theme to mimic the default colorscheme of powerline +# Not 100% the same so it's powerline... ish. +# +# Differences from default powerline: +# * Paste indicator isn't colored different +# * Far right hand section matches the color of the mode indicator +# +# Differences from other airline themes: +# * No color differences when you're in a modified buffer +# * Visual mode only changes the mode section. Otherwise +# it appears the same as normal mode + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:powerlineish/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=148 # fg=#005f00,bg=#afd700 + ble-face -s vim_airline_a_inactive fg=247,bg=233 # fg=#9e9e9e,bg=#121212 + ble-face -s vim_airline_a_insert fg=23,bg=231 # fg=#005f5f,bg=#ffffff + ble-face -s vim_airline_a_replace fg=231,bg=160 # fg=#ffffff,bg=#d70000 + ble-face -s vim_airline_a_visual fg=232,bg=214 # fg=#080808,bg=#ffaf00 + ble-face -s vim_airline_b fg=247,bg=236 # fg=#9e9e9e,bg=#303030 + ble-face -s vim_airline_b_inactive fg=247,bg=233 # fg=#9e9e9e,bg=#121212 + ble-face -s vim_airline_b_insert fg=74,bg=31 # fg=#5fafd7,bg=#0087af + ble-face -s vim_airline_b_replace fg=247,bg=236 # fg=#9e9e9e,bg=#303030 + ble-face -s vim_airline_c fg=231,bg=233 # fg=#ffffff,bg=#121212 + ble-face -s vim_airline_c_inactive fg=247,bg=233 # fg=#9e9e9e,bg=#121212 + ble-face -s vim_airline_c_insert fg=117,bg=24 # fg=#87d7ff,bg=#005f87 + ble-face -s vim_airline_c_replace fg=231,bg=233 # fg=#ffffff,bg=#121212 +} diff --git a/.local/share/blesh/contrib/airline/qwq.bash b/.local/share/blesh/contrib/airline/qwq.bash new file mode 100644 index 0000000..b981d47 --- /dev/null +++ b/.local/share/blesh/contrib/airline/qwq.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/qwq.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# github: https://github.com/LuciusChen + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:qwq/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=23,bg=230 # fg=#0e3b4f,bg=#ffeee5 + ble-face -s vim_airline_a_inactive fg=23,bg=231 # fg=#0e3b4f,bg=#fefcf9 + ble-face -s vim_airline_a_insert fg=23,bg=230 # fg=#0e3b4f,bg=#fff5d9 + ble-face -s vim_airline_a_replace fg=23,bg=158 # fg=#0e3b4f,bg=#c1f9cd + ble-face -s vim_airline_b fg=23,bg=224 # fg=#0e3b4f,bg=#ffd3cb + ble-face -s vim_airline_b_inactive fg=23,bg=187 # fg=#0e3b4f,bg=#ddc6af + ble-face -s vim_airline_b_insert fg=23,bg=186 # fg=#0e3b4f,bg=#dde58e + ble-face -s vim_airline_b_replace fg=23,bg=122 # fg=#0e3b4f,bg=#8befc7 + ble-face -s vim_airline_b_visual fg=23,bg=217 # fg=#0e3b4f,bg=#ff9da5 + ble-face -s vim_airline_c fg=231,bg=209 # fg=#ffffff,bg=#f7846e + ble-face -s vim_airline_c_inactive fg=231,bg=138 # fg=#ffffff,bg=#a28e79 + ble-face -s vim_airline_c_inactive_modified fg=231,bg=16 # fg=#ffffff,bg=#000000 + ble-face -s vim_airline_c_insert fg=231,bg=150 # fg=#ffffff,bg=#9ed47b + ble-face -s vim_airline_c_insert_modified fg=231,bg=71 # fg=#ffffff,bg=#6bad3f + ble-face -s vim_airline_c_normal_modified fg=231,bg=203 # fg=#ffffff,bg=#ff5d4f + ble-face -s vim_airline_c_replace fg=231,bg=38 # fg=#ffffff,bg=#04bec3 + ble-face -s vim_airline_c_replace_modified fg=231,bg=30 # fg=#ffffff,bg=#008492 + ble-face -s vim_airline_c_visual fg=231,bg=203 # fg=#ffffff,bg=#ff5b6f + ble-face -s vim_airline_c_visual_modified fg=231,bg=197 # fg=#ffffff,bg=#ff003f +} diff --git a/.local/share/blesh/contrib/airline/raven.bash b/.local/share/blesh/contrib/airline/raven.bash new file mode 100644 index 0000000..d782b3e --- /dev/null +++ b/.local/share/blesh/contrib/airline/raven.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/raven.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:raven/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=251,bg=236 # fg=#c8c8c8,bg=#2e2e2e + ble-face -s vim_airline_a_inactive fg=61,bg=235 # fg=#5e5e5e,bg=#222222 + ble-face -s vim_airline_a_insert fg=36,bg=236 # fg=#11c279,bg=#2e2e2e + ble-face -s vim_airline_a_replace fg=160,bg=236 # fg=#e60000,bg=#2e2e2e + ble-face -s vim_airline_a_visual fg=63,bg=236 # fg=#6565ff,bg=#2e2e2e + ble-face -s vim_airline_b fg=251,bg=236 # fg=#c8c8c8,bg=#2e2e2e + ble-face -s vim_airline_b_inactive fg=61,bg=235 # fg=#5e5e5e,bg=#222222 + ble-face -s vim_airline_b_insert fg=36,bg=236 # fg=#11c279,bg=#2e2e2e + ble-face -s vim_airline_b_visual fg=63,bg=236 # fg=#6565ff,bg=#2e2e2e + ble-face -s vim_airline_c fg=251,bg=236 # fg=#c8c8c8,bg=#2e2e2e + ble-face -s vim_airline_c_inactive fg=61,bg=235 # fg=#5e5e5e,bg=#222222 + ble-face -s vim_airline_c_inactive_modified fg=166,bg=16 # fg=#e25000,bg=#000000 + ble-face -s vim_airline_c_insert fg=36,bg=236 # fg=#11c279,bg=#2e2e2e + ble-face -s vim_airline_c_insert_modified fg=166,bg=236 # fg=#e25000,bg=#2e2e2e + ble-face -s vim_airline_c_normal_modified fg=166,bg=236 # fg=#e25000,bg=#2e2e2e + ble-face -s vim_airline_c_replace_modified fg=166,bg=236 # fg=#e25000,bg=#2e2e2e + ble-face -s vim_airline_c_visual fg=63,bg=236 # fg=#6565ff,bg=#2e2e2e + ble-face -s vim_airline_c_visual_modified fg=166,bg=236 # fg=#e25000,bg=#2e2e2e + ble-face -s vim_airline_warning fg=196,bg=236 # fg=#ff0000,bg=#2e2e2e + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/ravenpower.bash b/.local/share/blesh/contrib/airline/ravenpower.bash new file mode 100644 index 0000000..48505ad --- /dev/null +++ b/.local/share/blesh/contrib/airline/ravenpower.bash @@ -0,0 +1,22 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ravenpower.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Pretty much powerlineish clone, and some +# of the hex colours was borrowed from raven + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ravenpower/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=234 # fg=#005f00,bg=#1d1f21 + ble-face -s vim_airline_a_inactive fg=236,bg=236 # fg=#303030,bg=#2e2e2e + ble-face -s vim_airline_a_insert fg=117,bg=234 # fg=#87d7ff,bg=#1d1f21 + ble-face -s vim_airline_a_replace fg=231,bg=160 # fg=#ffffff,bg=#d70000 + ble-face -s vim_airline_a_visual fg=232,bg=214 # fg=#080808,bg=#ffaf00 + ble-face -s vim_airline_b fg=247,bg=236 # fg=#9e9e9e,bg=#303030 + ble-face -s vim_airline_b_inactive fg=236,bg=236 # fg=#303030,bg=#2e2e2e + ble-face -s vim_airline_c fg=251,bg=236 # fg=#c8c8c8,bg=#2e2e2e + ble-face -s vim_airline_c_inactive fg=236,bg=236 # fg=#303030,bg=#2e2e2e + ble-face -s vim_airline_z_replace fg=22,bg=234 # fg=#005f00,bg=#1d1f21 +} diff --git a/.local/share/blesh/contrib/airline/seagull.bash b/.local/share/blesh/contrib/airline/seagull.bash new file mode 100644 index 0000000..4728a8f --- /dev/null +++ b/.local/share/blesh/contrib/airline/seagull.bash @@ -0,0 +1,36 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/seagull.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Airline theme for Seabird/Seagull: +# https://github.com/nightsense/seabird/blob/master/colors/seagull.vim +# +# Based on Solarized theme code: +# https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/solarized.vim + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:seagull/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=189,bg=66 # fg=#e6eaed,bg=#6d767d + ble-face -s vim_airline_a_inactive fg=189,bg=244 # fg=#e6eaed,bg=#787e82 + ble-face -s vim_airline_a_insert fg=189,bg=37 # fg=#e6eaed,bg=#00a5ab + ble-face -s vim_airline_a_replace fg=189,bg=203 # fg=#e6eaed,bg=#ff4053 + ble-face -s vim_airline_a_visual fg=189,bg=34 # fg=#e6eaed,bg=#11ab00 + ble-face -s vim_airline_b fg=189,bg=102 # fg=#e6eaed,bg=#808487 + ble-face -s vim_airline_b_inactive fg=189,bg=244 # fg=#e6eaed,bg=#787e82 + ble-face -s vim_airline_c fg=102,bg=189 # fg=#808487,bg=#e6eaed + ble-face -s vim_airline_c_inactive fg=189,bg=244 # fg=#e6eaed,bg=#787e82 + ble-face -s vim_airline_c_inactive_modified fg=235,bg=231 # fg=#1d252b,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=60,bg=189 # fg=#61707a,bg=#e6eaed + ble-face -s vim_airline_c_normal_modified fg=60,bg=189 # fg=#61707a,bg=#e6eaed + ble-face -s vim_airline_c_replace_modified fg=60,bg=189 # fg=#61707a,bg=#e6eaed + ble-face -s vim_airline_c_visual_modified fg=60,bg=189 # fg=#61707a,bg=#e6eaed + ble-face -s vim_airline_error fg=231,bg=202 # fg=#ffffff,bg=#ff6200 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_insert fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_normal_modified fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_visual fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=231,bg=202 # fg=#ffffff,bg=#ff6200 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/selenized.bash b/.local/share/blesh/contrib/airline/selenized.bash new file mode 100644 index 0000000..c34b1e9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/selenized.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/selenized.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# MIT License. Copyright (c) 2021 novenary +# vim: et ts=2 sts=2 sw=2 tw=80 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:selenized/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=254,bg=64 # fg=#e9e4d0,bg=#489100 + ble-face -s vim_airline_a_inactive fg=246,bg=187 # fg=#909995,bg=#cfcebe + ble-face -s vim_airline_a_insert fg=254,bg=26 # fg=#e9e4d0,bg=#0072d4 + ble-face -s vim_airline_a_replace fg=254,bg=160 # fg=#e9e4d0,bg=#d2212d + ble-face -s vim_airline_a_visual fg=254,bg=98 # fg=#e9e4d0,bg=#8762c6 + ble-face -s vim_airline_b fg=241,bg=187 # fg=#53676d,bg=#cfcebe + ble-face -s vim_airline_b_inactive fg=246,bg=187 # fg=#909995,bg=#cfcebe + ble-face -s vim_airline_c fg=246,bg=254 # fg=#909995,bg=#e9e4d0 + ble-face -s vim_airline_c_inactive fg=246,bg=187 # fg=#909995,bg=#cfcebe + ble-face -s vim_airline_c_inactive_modified fg=136,bg=187 # fg=#ad8900,bg=#cfcebe + ble-face -s vim_airline_c_insert_modified fg=136,bg=254 # fg=#ad8900,bg=#e9e4d0 + ble-face -s vim_airline_c_normal_modified fg=136,bg=254 # fg=#ad8900,bg=#e9e4d0 + ble-face -s vim_airline_c_replace_modified fg=136,bg=254 # fg=#ad8900,bg=#e9e4d0 + ble-face -s vim_airline_c_visual_modified fg=136,bg=254 # fg=#ad8900,bg=#e9e4d0 + ble-face -s vim_airline_error fg=254,bg=160 # fg=#e9e4d0,bg=#cc1729 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=254,bg=136 # fg=#e9e4d0,bg=#a78300 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/selenized_bw.bash b/.local/share/blesh/contrib/airline/selenized_bw.bash new file mode 100644 index 0000000..f5e95f4 --- /dev/null +++ b/.local/share/blesh/contrib/airline/selenized_bw.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/selenized_bw.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# MIT License. Copyright (c) 2021 novenary +# vim: et ts=2 sts=2 sw=2 tw=80 + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:selenized_bw/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=28 # fg=#ebebeb,bg=#1d9700 + ble-face -s vim_airline_a_inactive fg=105,bg=252 # fg=#878787,bg=#cdcdcd + ble-face -s vim_airline_a_insert fg=255,bg=26 # fg=#ebebeb,bg=#0064e4 + ble-face -s vim_airline_a_replace fg=255,bg=160 # fg=#ebebeb,bg=#d6000c + ble-face -s vim_airline_a_visual fg=255,bg=98 # fg=#ebebeb,bg=#7f51d6 + ble-face -s vim_airline_b fg=238,bg=252 # fg=#474747,bg=#cdcdcd + ble-face -s vim_airline_b_inactive fg=105,bg=252 # fg=#878787,bg=#cdcdcd + ble-face -s vim_airline_c fg=105,bg=255 # fg=#878787,bg=#ebebeb + ble-face -s vim_airline_c_inactive fg=105,bg=252 # fg=#878787,bg=#cdcdcd + ble-face -s vim_airline_c_inactive_modified fg=172,bg=252 # fg=#c49700,bg=#cdcdcd + ble-face -s vim_airline_c_insert_modified fg=172,bg=255 # fg=#c49700,bg=#ebebeb + ble-face -s vim_airline_c_normal_modified fg=172,bg=255 # fg=#c49700,bg=#ebebeb + ble-face -s vim_airline_c_replace_modified fg=172,bg=255 # fg=#c49700,bg=#ebebeb + ble-face -s vim_airline_c_visual_modified fg=172,bg=255 # fg=#c49700,bg=#ebebeb + ble-face -s vim_airline_error fg=255,bg=124 # fg=#ebebeb,bg=#bf0000 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=255,bg=136 # fg=#ebebeb,bg=#af8500 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/seoul256.bash b/.local/share/blesh/contrib/airline/seoul256.bash new file mode 100644 index 0000000..18bb420 --- /dev/null +++ b/.local/share/blesh/contrib/airline/seoul256.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/seoul256.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Created by JB Kopecky (https://github.com/jbkopecky), based on seoul256 themed +# by Junegunn Choi (https://github.com/junegunn/seoul256.vim) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:seoul256/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_a_inactive fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_a_replace fg=231,bg=29 # fg=#ffffff,bg=#2e8b57 + ble-face -s vim_airline_a_visual fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_b fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_b_inactive fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_c fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_c_inactive_modified fg=62,bg=231 # fg=#6a5acd,bg=#ffffff + ble-face -s vim_airline_c_insert fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_insert_modified fg=62,bg=231 # fg=#6a5acd,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=62,bg=231 # fg=#6a5acd,bg=#ffffff + ble-face -s vim_airline_c_replace_modified fg=62,bg=231 # fg=#6a5acd,bg=#ffffff + ble-face -s vim_airline_c_visual fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_warning fg=136,bg=255 # fg=#af8500,bg=#ebebeb + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/serene.bash b/.local/share/blesh/contrib/airline/serene.bash new file mode 100644 index 0000000..2c27cf9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/serene.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/serene.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:serene/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=45,bg=232 # fg=#00dfff,bg=#080808 + ble-face -s vim_airline_a_inactive fg=239,bg=232 # fg=#4e4e4e,bg=#080808 + ble-face -s vim_airline_a_insert fg=82,bg=232 # fg=#5fff00,bg=#080808 + ble-face -s vim_airline_a_replace fg=82,bg=124 # fg=#5fff00,bg=#af0000 + ble-face -s vim_airline_a_visual fg=184,bg=232 # fg=#dfdf00,bg=#080808 + ble-face -s vim_airline_b fg=202,bg=232 # fg=#ff5f00,bg=#080808 + ble-face -s vim_airline_b_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c fg=243,bg=232 # fg=#767676,bg=#080808 + ble-face -s vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c_inactive_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_insert_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_normal_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_replace_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_visual_modified fg=160,bg=232 # fg=#df0000,bg=#080808 +} diff --git a/.local/share/blesh/contrib/airline/sierra.bash b/.local/share/blesh/contrib/airline/sierra.bash new file mode 100644 index 0000000..3ac050c --- /dev/null +++ b/.local/share/blesh/contrib/airline/sierra.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/sierra.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# File: sierra.vim +# Author: Danilo Augusto +# Date: 2017-02-26 +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:sierra/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=180 # fg=#ffffff,bg=#dfaf87 + ble-face -s vim_airline_a_inactive fg=241,bg=131 # fg=#666666,bg=#af5f5f + ble-face -s vim_airline_a_insert fg=231,bg=152 # fg=#ffffff,bg=#afd7d7 + ble-face -s vim_airline_a_replace fg=242,bg=236 # fg=#686868,bg=#303030 + ble-face -s vim_airline_a_visual fg=231,bg=242 # fg=#ffffff,bg=#686868 + ble-face -s vim_airline_b fg=231,bg=131 # fg=#ffffff,bg=#af5f5f + ble-face -s vim_airline_b_inactive fg=167,bg=235 # fg=#d75f5f,bg=#2a2a2a + ble-face -s vim_airline_c fg=167,bg=240 # fg=#d75f5f,bg=#545454 + ble-face -s vim_airline_c_inactive fg=167,bg=235 # fg=#d75f5f,bg=#2a2a2a + ble-face -s vim_airline_c_inactive_modified fg=223,bg=16 # fg=#f7e4c0,bg=#000000 + ble-face -s vim_airline_c_insert fg=231,bg=131 # fg=#ffffff,bg=#af5f5f + ble-face -s vim_airline_c_insert_modified fg=223,bg=16 # fg=#f7e4c0,bg=#000000 + ble-face -s vim_airline_c_normal_modified fg=223,bg=16 # fg=#f7e4c0,bg=#000000 + ble-face -s vim_airline_c_replace_modified fg=223,bg=16 # fg=#f7e4c0,bg=#000000 + ble-face -s vim_airline_c_visual fg=231,bg=131 # fg=#ffffff,bg=#af5f5f + ble-face -s vim_airline_c_visual_modified fg=223,bg=16 # fg=#f7e4c0,bg=#000000 +} diff --git a/.local/share/blesh/contrib/airline/silver.bash b/.local/share/blesh/contrib/airline/silver.bash new file mode 100644 index 0000000..4d6966f --- /dev/null +++ b/.local/share/blesh/contrib/airline/silver.bash @@ -0,0 +1,30 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/silver.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:silver/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=238,bg=254 # fg=#414141,bg=#e1e1e1 + ble-face -s vim_airline_a_inactive fg=247,bg=253 # fg=#a1a1a1,bg=#dddddd + ble-face -s vim_airline_a_insert fg=29,bg=254 # fg=#0d935c,bg=#e1e1e1 + ble-face -s vim_airline_a_replace fg=124,bg=254 # fg=#b30000,bg=#e1e1e1 + ble-face -s vim_airline_a_visual fg=19,bg=254 # fg=#0000b3,bg=#e1e1e1 + ble-face -s vim_airline_b fg=238,bg=254 # fg=#414141,bg=#e1e1e1 + ble-face -s vim_airline_b_inactive fg=247,bg=253 # fg=#a1a1a1,bg=#dddddd + ble-face -s vim_airline_b_insert fg=29,bg=254 # fg=#0d935c,bg=#e1e1e1 + ble-face -s vim_airline_b_visual fg=19,bg=254 # fg=#0000b3,bg=#e1e1e1 + ble-face -s vim_airline_c fg=238,bg=254 # fg=#414141,bg=#e1e1e1 + ble-face -s vim_airline_c_inactive fg=247,bg=253 # fg=#a1a1a1,bg=#dddddd + ble-face -s vim_airline_c_inactive_modified fg=166,bg=16 # fg=#e25000,bg=#000000 + ble-face -s vim_airline_c_insert fg=29,bg=254 # fg=#0d935c,bg=#e1e1e1 + ble-face -s vim_airline_c_insert_modified fg=166,bg=254 # fg=#e25000,bg=#e1e1e1 + ble-face -s vim_airline_c_normal_modified fg=166,bg=254 # fg=#e25000,bg=#e1e1e1 + ble-face -s vim_airline_c_replace_modified fg=166,bg=254 # fg=#e25000,bg=#e1e1e1 + ble-face -s vim_airline_c_visual fg=19,bg=254 # fg=#0000b3,bg=#e1e1e1 + ble-face -s vim_airline_c_visual_modified fg=166,bg=254 # fg=#e25000,bg=#e1e1e1 + ble-face -s vim_airline_warning fg=196,bg=254 # fg=#ff0000,bg=#e1e1e1 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/simple.bash b/.local/share/blesh/contrib/airline/simple.bash new file mode 100644 index 0000000..9fec2d9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/simple.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/simple.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:simple/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=232,bg=45 # fg=#080808,bg=#00dfff + ble-face -s vim_airline_a_inactive fg=239,bg=232 # fg=#4e4e4e,bg=#080808 + ble-face -s vim_airline_a_insert fg=232,bg=82 # fg=#080808,bg=#5fff00 + ble-face -s vim_airline_a_replace fg=232,bg=124 # fg=#080808,bg=#af0000 + ble-face -s vim_airline_a_visual fg=232,bg=184 # fg=#080808,bg=#dfdf00 + ble-face -s vim_airline_b fg=202,bg=234 # fg=#ff5f00,bg=#1c1c1c + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c fg=243,bg=232 # fg=#767676,bg=#080808 + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c_inactive_modified fg=160,bg=231 # fg=#df0000,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_normal_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_replace_modified fg=160,bg=232 # fg=#df0000,bg=#080808 + ble-face -s vim_airline_c_visual_modified fg=160,bg=232 # fg=#df0000,bg=#080808 +} diff --git a/.local/share/blesh/contrib/airline/soda.bash b/.local/share/blesh/contrib/airline/soda.bash new file mode 100644 index 0000000..3c425b2 --- /dev/null +++ b/.local/share/blesh/contrib/airline/soda.bash @@ -0,0 +1,24 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/soda.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:soda/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=97 # fg=#ffffff,bg=#875faf + ble-face -s vim_airline_a_inactive fg=243,bg=231 # fg=#767676,bg=#ffffff + ble-face -s vim_airline_a_insert fg=231,bg=22 # fg=#ffffff,bg=#005f00 + ble-face -s vim_airline_a_replace fg=243,bg=227 # fg=#767676,bg=#ffff5f + ble-face -s vim_airline_a_visual fg=243,bg=227 # fg=#767676,bg=#ffff5f + ble-face -s vim_airline_b fg=231,bg=96 # fg=#ffffff,bg=#875f87 + ble-face -s vim_airline_b_inactive fg=243,bg=231 # fg=#767676,bg=#ffffff + ble-face -s vim_airline_b_insert fg=231,bg=28 # fg=#ffffff,bg=#008700 + ble-face -s vim_airline_b_visual fg=243,bg=221 # fg=#767676,bg=#ffd75f + ble-face -s vim_airline_c fg=231,bg=54 # fg=#ffffff,bg=#5f0087 + ble-face -s vim_airline_c_inactive fg=243,bg=231 # fg=#767676,bg=#ffffff + ble-face -s vim_airline_c_inactive_modified fg=231,bg=160 # fg=#ffffff,bg=#df0000 + ble-face -s vim_airline_c_insert fg=231,bg=34 # fg=#ffffff,bg=#00af00 + ble-face -s vim_airline_c_visual fg=243,bg=215 # fg=#767676,bg=#ffaf5f +} diff --git a/.local/share/blesh/contrib/airline/sol.bash b/.local/share/blesh/contrib/airline/sol.bash new file mode 100644 index 0000000..6fabe84 --- /dev/null +++ b/.local/share/blesh/contrib/airline/sol.bash @@ -0,0 +1,32 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/sol.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Sol +# (https://github.com/Pychimp/vim-sol) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:sol/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=236,bg=247 # fg=#343434,bg=#a0a0a0 + ble-face -s vim_airline_a_inactive fg=243,bg=251 # fg=#777777,bg=#c7c7c7 + ble-face -s vim_airline_a_insert fg=255,bg=23 # fg=#eeeeee,bg=#09643f + ble-face -s vim_airline_a_replace fg=255,bg=196 # fg=#eeeeee,bg=#ff2121 + ble-face -s vim_airline_a_visual fg=228,bg=202 # fg=#ffff9a,bg=#ff6003 + ble-face -s vim_airline_b fg=236,bg=249 # fg=#343434,bg=#b3b3b3 + ble-face -s vim_airline_b_inactive fg=243,bg=251 # fg=#777777,bg=#c7c7c7 + ble-face -s vim_airline_b_insert fg=236,bg=248 # fg=#343434,bg=#a3a3a3 + ble-face -s vim_airline_b_visual fg=236,bg=248 # fg=#343434,bg=#a3a3a3 + ble-face -s vim_airline_c fg=236,bg=251 # fg=#343434,bg=#c7c7c7 + ble-face -s vim_airline_c_inactive fg=243,bg=251 # fg=#777777,bg=#c7c7c7 + ble-face -s vim_airline_c_inactive_modified fg=203,bg=16 # fg=#ff3535,bg=#000000 + ble-face -s vim_airline_c_insert fg=236,bg=149 # fg=#343434,bg=#b0b0b0 + ble-face -s vim_airline_c_insert_modified fg=236,bg=224 # fg=#343434,bg=#ffdbc7 + ble-face -s vim_airline_c_normal_modified fg=231,bg=203 # fg=#ffffff,bg=#ff6868 + ble-face -s vim_airline_c_replace_modified fg=236,bg=224 # fg=#343434,bg=#ffdbc7 + ble-face -s vim_airline_c_visual fg=236,bg=149 # fg=#343434,bg=#b0b0b0 + ble-face -s vim_airline_c_visual_modified fg=236,bg=224 # fg=#343434,bg=#ffdbc7 + ble-face -s vim_airline_warning fg=255,bg=166 # fg=#eeeeee,bg=#e33900 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/solarized.bash b/.local/share/blesh/contrib/airline/solarized.bash new file mode 100644 index 0000000..2a8f226 --- /dev/null +++ b/.local/share/blesh/contrib/airline/solarized.bash @@ -0,0 +1,31 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/solarized.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:solarized/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=224,bg=66 # fg=#eee8d5,bg=#657b83 + ble-face -s vim_airline_a_inactive fg=224,bg=246 # fg=#eee8d5,bg=#839496 + ble-face -s vim_airline_a_insert fg=224,bg=136 # fg=#eee8d5,bg=#b58900 + ble-face -s vim_airline_a_replace fg=224,bg=166 # fg=#eee8d5,bg=#dc322f + ble-face -s vim_airline_a_visual fg=224,bg=168 # fg=#eee8d5,bg=#d33682 + ble-face -s vim_airline_b fg=224,bg=109 # fg=#eee8d5,bg=#93a1a1 + ble-face -s vim_airline_b_inactive fg=224,bg=246 # fg=#eee8d5,bg=#839496 + ble-face -s vim_airline_c fg=109,bg=224 # fg=#93a1a1,bg=#eee8d5 + ble-face -s vim_airline_c_inactive fg=224,bg=246 # fg=#eee8d5,bg=#839496 + ble-face -s vim_airline_c_inactive_modified fg=23,bg=231 # fg=#073642,bg=#ffffff + ble-face -s vim_airline_c_insert_modified fg=60,bg=224 # fg=#586e75,bg=#eee8d5 + ble-face -s vim_airline_c_normal_modified fg=60,bg=224 # fg=#586e75,bg=#eee8d5 + ble-face -s vim_airline_c_replace_modified fg=60,bg=224 # fg=#586e75,bg=#eee8d5 + ble-face -s vim_airline_c_visual_modified fg=60,bg=224 # fg=#586e75,bg=#eee8d5 + ble-face -s vim_airline_error fg=230,bg=166 # fg=#fdf6e3,bg=#cb4b16 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_insert fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_normal_modified fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_error_visual fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=230,bg=166 # fg=#fdf6e3,bg=#cb4b16 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 +} diff --git a/.local/share/blesh/contrib/airline/solarized_flood.bash b/.local/share/blesh/contrib/airline/solarized_flood.bash new file mode 100644 index 0000000..abd26ea --- /dev/null +++ b/.local/share/blesh/contrib/airline/solarized_flood.bash @@ -0,0 +1,49 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/solarized_flood.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Name: Solarized Flood +# Changed: June 3 2018 +# Maintainer: https://github.com/Neur1n +# Description: +# A vim-airline theme made based on and tested with the Solarized colorscheme +# (https://github.com/frankier/neovim-colors-solarized-truecolor-only) in +# Windows 10 OS and GVim 8.1. +# +# This script is based on the 'dark' theme. The 'inactive' and 'ctrlp' parts +# were not changed. +# +# It is call 'flood' since the statusline and the tabline will be highlighted +# with the 'base03' color in Solarized (dark). If you use the dark Solarized +# colorscheme for Vim and, in Windows, set 'Personalization-Colors-Choose +# your color - Custom color' to be '#002B36' (*), then most parts of the GVim +# window will be 'flooded' with the color. +# NOTE: This will make some components of the airline less distinguishable +# from the others. If anyone has better ideas, I will be happy to take +# a conversation with you. :) + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:solarized_flood/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=17,bg=100 # fg=#002b36,bg=#859900 + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=17,bg=36 # fg=#002b36,bg=#2aa198 + ble-face -s vim_airline_a_replace fg=17,bg=166 # fg=#002b36,bg=#dc322f + ble-face -s vim_airline_a_visual fg=17,bg=136 # fg=#002b36,bg=#b58900 + ble-face -s vim_airline_b fg=109,bg=17 # fg=#93a1a1,bg=#002b36 + ble-face -s vim_airline_b_inactive fg=239,bg=235 # fg=#4e4e4e,bg=#262626 + ble-face -s vim_airline_c fg=36,bg=17 # fg=#2aa198,bg=#002b36 + ble-face -s vim_airline_c_inactive fg=239,bg=236 # fg=#4e4e4e,bg=#303030 + ble-face -s vim_airline_c_inactive_modified fg=97,bg=231 # fg=#875faf,bg=#ffffff + ble-face -s vim_airline_c_insert fg=32,bg=17 # fg=#268bd2,bg=#002b36 + ble-face -s vim_airline_c_insert_modified fg=168,bg=17 # fg=#d33682,bg=#002b36 + ble-face -s vim_airline_c_normal_modified fg=168,bg=17 # fg=#d33682,bg=#002b36 + ble-face -s vim_airline_c_replace_modified fg=168,bg=17 # fg=#d33682,bg=#002b36 + ble-face -s vim_airline_c_visual fg=166,bg=17 # fg=#dc322f,bg=#002b36 + ble-face -s vim_airline_c_visual_modified fg=168,bg=17 # fg=#d33682,bg=#002b36 + ble-face -s vim_airline_z_insert fg=36,bg=17 # fg=#2aa198,bg=#002b36 + ble-face -s vim_airline_z_normal fg=100,bg=17 # fg=#859900,bg=#002b36 + ble-face -s vim_airline_z_replace fg=36,bg=17 # fg=#2aa198,bg=#002b36 + ble-face -s vim_airline_z_visual fg=136,bg=17 # fg=#b58900,bg=#002b36 +} diff --git a/.local/share/blesh/contrib/airline/supernova.bash b/.local/share/blesh/contrib/airline/supernova.bash new file mode 100644 index 0000000..15c7871 --- /dev/null +++ b/.local/share/blesh/contrib/airline/supernova.bash @@ -0,0 +1,26 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/supernova.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:supernova/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=235,bg=73 # fg=#262626,bg=#5fafaf + ble-face -s vim_airline_a_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#444444 + ble-face -s vim_airline_a_insert fg=254,bg=54 # fg=#e4e4e4,bg=#5f0087 + ble-face -s vim_airline_a_replace fg=254,bg=89 # fg=#e4e4e4,bg=#87005f + ble-face -s vim_airline_a_visual fg=235,bg=32 # fg=#262626,bg=#0087d7 + ble-face -s vim_airline_b fg=252,bg=240 # fg=#d0d0d0,bg=#585858 + ble-face -s vim_airline_b_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#444444 + ble-face -s vim_airline_b_visual fg=231,bg=240 # fg=#ffffff,bg=#585858 + ble-face -s vim_airline_c fg=248,bg=235 # fg=#a8a8a8,bg=#262626 + ble-face -s vim_airline_c_inactive fg=252,bg=240 # fg=#d0d0d0,bg=#585858 + ble-face -s vim_airline_c_inactive_modified fg=255,bg=238 # fg=#eeeeee,bg=#444444 + ble-face -s vim_airline_c_insert_modified fg=255,bg=235 # fg=#eeeeee,bg=#262626 + ble-face -s vim_airline_c_normal_modified fg=255,bg=235 # fg=#eeeeee,bg=#262626 + ble-face -s vim_airline_c_replace_modified fg=255,bg=235 # fg=#eeeeee,bg=#262626 + ble-face -s vim_airline_c_visual_modified fg=255,bg=235 # fg=#eeeeee,bg=#262626 + ble-face -s vim_airline_x_inactive fg=252,bg=238 # fg=#d0d0d0,bg=#444444 +} diff --git a/.local/share/blesh/contrib/airline/term.bash b/.local/share/blesh/contrib/airline/term.bash new file mode 100644 index 0000000..a1fa252 --- /dev/null +++ b/.local/share/blesh/contrib/airline/term.bash @@ -0,0 +1,38 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/term.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:term/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=186 # fg=#141413,bg=#cae682 + ble-face -s vim_airline_a_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_a_insert fg=233,bg=221 # fg=#141413,bg=#fde76e + ble-face -s vim_airline_a_insert_modified fg=233,bg=221 # fg=#141413,bg=#fade3e + ble-face -s vim_airline_a_normal_modified fg=233,bg=114 # fg=#141413,bg=#86cd74 + ble-face -s vim_airline_a_replace fg=233,bg=173 # fg=#141413,bg=#e5786d + ble-face -s vim_airline_a_replace_modified fg=233,bg=167 # fg=#141413,bg=#e55345 + ble-face -s vim_airline_a_visual fg=233,bg=153 # fg=#141413,bg=#b5d3f3 + ble-face -s vim_airline_a_visual_modified fg=233,bg=110 # fg=#141413,bg=#7cb0e6 + ble-face -s vim_airline_b fg=186,bg=58 # fg=#cae682,bg=#32322f + ble-face -s vim_airline_b_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_b_insert fg=221,bg=58 # fg=#fde76e,bg=#32322f + ble-face -s vim_airline_b_insert_modified fg=221,bg=238 # fg=#fade3e,bg=#40403c + ble-face -s vim_airline_b_normal_modified fg=114,bg=238 # fg=#86cd74,bg=#40403c + ble-face -s vim_airline_b_replace fg=173,bg=58 # fg=#e5786d,bg=#32322f + ble-face -s vim_airline_b_replace_modified fg=167,bg=238 # fg=#e55345,bg=#40403c + ble-face -s vim_airline_b_visual fg=153,bg=58 # fg=#b5d3f3,bg=#32322f + ble-face -s vim_airline_b_visual_modified fg=110,bg=238 # fg=#7cb0e6,bg=#40403c + ble-face -s vim_airline_c fg=186,bg=235 # fg=#cae682,bg=#242424 + ble-face -s vim_airline_c_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_c_inactive_modified fg=114,bg=16 # fg=#86cd74,bg=#000000 + ble-face -s vim_airline_c_insert fg=221,bg=235 # fg=#fde76e,bg=#242424 + ble-face -s vim_airline_c_insert_modified fg=221,bg=235 # fg=#fade3e,bg=#242424 + ble-face -s vim_airline_c_normal_modified fg=114,bg=235 # fg=#86cd74,bg=#242424 + ble-face -s vim_airline_c_replace fg=173,bg=235 # fg=#e5786d,bg=#242424 + ble-face -s vim_airline_c_replace_modified fg=167,bg=235 # fg=#e55345,bg=#242424 + ble-face -s vim_airline_c_visual fg=153,bg=235 # fg=#b5d3f3,bg=#242424 + ble-face -s vim_airline_c_visual_modified fg=110,bg=235 # fg=#7cb0e6,bg=#242424 +} diff --git a/.local/share/blesh/contrib/airline/term_light.bash b/.local/share/blesh/contrib/airline/term_light.bash new file mode 100644 index 0000000..d8b2fe8 --- /dev/null +++ b/.local/share/blesh/contrib/airline/term_light.bash @@ -0,0 +1,38 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/term_light.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:term_light/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=114 # fg=#f0f0f0,bg=#86cd74 + ble-face -s vim_airline_a_inactive fg=243,bg=106 # fg=#767676,bg=#888a85 + ble-face -s vim_airline_a_insert fg=255,bg=221 # fg=#f0f0f0,bg=#fade3e + ble-face -s vim_airline_a_insert_modified fg=233,bg=221 # fg=#141413,bg=#fde76e + ble-face -s vim_airline_a_normal_modified fg=233,bg=186 # fg=#141413,bg=#cae682 + ble-face -s vim_airline_a_replace fg=255,bg=167 # fg=#f0f0f0,bg=#e55345 + ble-face -s vim_airline_a_replace_modified fg=233,bg=173 # fg=#141413,bg=#e5786d + ble-face -s vim_airline_a_visual fg=255,bg=110 # fg=#f0f0f0,bg=#7cb0e6 + ble-face -s vim_airline_a_visual_modified fg=233,bg=153 # fg=#141413,bg=#b5d3f3 + ble-face -s vim_airline_b fg=114,bg=253 # fg=#86cd74,bg=#deded9 + ble-face -s vim_airline_b_inactive fg=243,bg=106 # fg=#767676,bg=#888a85 + ble-face -s vim_airline_b_insert fg=221,bg=253 # fg=#fade3e,bg=#deded9 + ble-face -s vim_airline_b_insert_modified fg=221,bg=238 # fg=#fde76e,bg=#40403c + ble-face -s vim_airline_b_normal_modified fg=186,bg=238 # fg=#cae682,bg=#40403c + ble-face -s vim_airline_b_replace fg=167,bg=253 # fg=#e55345,bg=#deded9 + ble-face -s vim_airline_b_replace_modified fg=173,bg=238 # fg=#e5786d,bg=#40403c + ble-face -s vim_airline_b_visual fg=110,bg=253 # fg=#7cb0e6,bg=#deded9 + ble-face -s vim_airline_b_visual_modified fg=153,bg=238 # fg=#b5d3f3,bg=#40403c + ble-face -s vim_airline_c fg=114,bg=106 # fg=#86cd74,bg=#888a85 + ble-face -s vim_airline_c_inactive fg=243,bg=106 # fg=#767676,bg=#888a85 + ble-face -s vim_airline_c_inactive_modified fg=186,bg=16 # fg=#cae682,bg=#000000 + ble-face -s vim_airline_c_insert fg=221,bg=106 # fg=#fade3e,bg=#888a85 + ble-face -s vim_airline_c_insert_modified fg=221,bg=106 # fg=#fde76e,bg=#888a85 + ble-face -s vim_airline_c_normal_modified fg=186,bg=106 # fg=#cae682,bg=#888a85 + ble-face -s vim_airline_c_replace fg=167,bg=106 # fg=#e55345,bg=#888a85 + ble-face -s vim_airline_c_replace_modified fg=173,bg=106 # fg=#e5786d,bg=#888a85 + ble-face -s vim_airline_c_visual fg=110,bg=106 # fg=#7cb0e6,bg=#888a85 + ble-face -s vim_airline_c_visual_modified fg=153,bg=106 # fg=#b5d3f3,bg=#888a85 +} diff --git a/.local/share/blesh/contrib/airline/tomorrow.bash b/.local/share/blesh/contrib/airline/tomorrow.bash new file mode 100644 index 0000000..710f6d7 --- /dev/null +++ b/.local/share/blesh/contrib/airline/tomorrow.bash @@ -0,0 +1,27 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/tomorrow.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:tomorrow/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=21 # fg=#ffffff,bg=#0000ff + ble-face -s vim_airline_a_inactive fg=21,bg=254 # fg=#0000ff,bg=#e5e5e5 + ble-face -s vim_airline_a_insert fg=231,bg=29 # fg=#ffffff,bg=#2e8b57 + ble-face -s vim_airline_a_replace fg=231,bg=196 # fg=#ffffff,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=231,bg=201 # fg=#ffffff,bg=#ff00ff + ble-face -s vim_airline_b fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_b_inactive fg=21,bg=254 # fg=#0000ff,bg=#e5e5e5 + ble-face -s vim_airline_b_insert fg=29,bg=231 # fg=#2e8b57,bg=#ffffff + ble-face -s vim_airline_b_replace fg=16,bg=213 # fg=#000000,bg=#ff8bff + ble-face -s vim_airline_b_visual fg=201,bg=231 # fg=#ff00ff,bg=#ffffff + ble-face -s vim_airline_c fg=16,bg=254 # fg=#000000,bg=#e5e5e5 + ble-face -s vim_airline_c_inactive fg=21,bg=254 # fg=#0000ff,bg=#e5e5e5 + ble-face -s vim_airline_c_inactive_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_insert_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_normal_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_replace_modified fg=-1,bg=-1 # fg=-1,bg=-1 + ble-face -s vim_airline_c_visual_modified fg=-1,bg=-1 # fg=-1,bg=-1 +} diff --git a/.local/share/blesh/contrib/airline/transparent.bash b/.local/share/blesh/contrib/airline/transparent.bash new file mode 100644 index 0000000..a418cda --- /dev/null +++ b/.local/share/blesh/contrib/airline/transparent.bash @@ -0,0 +1,31 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/transparent.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +#FROM https://github.com/khatiba + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:transparent/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=103,bg=16 # fg=#8d96a1,bg=#000000 + ble-face -s vim_airline_a_inactive fg=234,bg=231 # fg=#1d1f21,bg=#ffffff + ble-face -s vim_airline_a_insert fg=234,bg=150 # fg=#1d1f21,bg=#bbe67e + ble-face -s vim_airline_a_normal_modified fg=234,bg=215 # fg=#1d1f21,bg=#ffae57 + ble-face -s vim_airline_a_replace fg=234,bg=183 # fg=#1d1f21,bg=#d4bfff + ble-face -s vim_airline_a_visual fg=234,bg=204 # fg=#1d1f21,bg=#f07178 + ble-face -s vim_airline_b fg=239,bg=231 # fg=#3f4b59,bg=#ffffff + ble-face -s vim_airline_b_inactive fg=234,bg=231 # fg=#1d1f21,bg=#ffffff + ble-face -s vim_airline_c fg=239,bg=231 # fg=#3f4b59,bg=#ffffff + ble-face -s vim_airline_c_inactive_modified fg=215,bg=16 # fg=#ffae57,bg=#000000 + ble-face -s vim_airline_error fg=234,bg=204 # fg=#1d1f21,bg=#f07178 + ble-face -s vim_airline_error_inactive fg=16,bg=88 # fg=#000000,bg=#990000 + ble-face -s vim_airline_warning fg=234,bg=215 # fg=#1d1f21,bg=#ffae57 + ble-face -s vim_airline_warning_inactive fg=16,bg=166 # fg=#000000,bg=#df5f00 + ble-face -s vim_airline_x_inactive fg=234,bg=231 # fg=#1d1f21,bg=#ffffff + ble-face -s vim_airline_z_insert fg=150,bg=16 # fg=#bbe67e,bg=#000000 + ble-face -s vim_airline_z_normal fg=239,bg=231 # fg=#3f4b59,bg=#ffffff + ble-face -s vim_airline_z_normal_modified fg=215,bg=16 # fg=#ffae57,bg=#000000 + ble-face -s vim_airline_z_replace fg=183,bg=16 # fg=#d4bfff,bg=#000000 + ble-face -s vim_airline_z_visual fg=204,bg=16 # fg=#f07178,bg=#000000 +} diff --git a/.local/share/blesh/contrib/airline/ubaryd.bash b/.local/share/blesh/contrib/airline/ubaryd.bash new file mode 100644 index 0000000..0be0ed9 --- /dev/null +++ b/.local/share/blesh/contrib/airline/ubaryd.bash @@ -0,0 +1,43 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/ubaryd.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Ubaryd +# (https://github.com/Donearm/Ubaryd) +# +# Author: Gianluca fiore +# Version: 1.12 +# License: MIT + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:ubaryd/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=22,bg=255 # fg=#005f00,bg=#f8f6f2 + ble-face -s vim_airline_a_inactive fg=22,bg=235 # fg=#005f00,bg=#242321 + ble-face -s vim_airline_a_insert fg=255,bg=168 # fg=#f8f6f2,bg=#e25a74 + ble-face -s vim_airline_a_insert_modified fg=255,bg=222 # fg=#f8f6f2,bg=#f4cf86 + ble-face -s vim_airline_a_normal_modified fg=22,bg=22 # fg=#005f00,bg=#005f00 + ble-face -s vim_airline_a_replace fg=235,bg=255 # fg=#242321,bg=#f8f6f2 + ble-face -s vim_airline_a_replace_modified fg=235,bg=214 # fg=#242321,bg=#ffa724 + ble-face -s vim_airline_a_visual fg=60,bg=255 # fg=#416389,bg=#f8f6f2 + ble-face -s vim_airline_a_visual_modified fg=60,bg=94 # fg=#416389,bg=#9a4820 + ble-face -s vim_airline_b fg=255,bg=22 # fg=#f8f6f2,bg=#005f00 + ble-face -s vim_airline_b_inactive fg=22,bg=235 # fg=#005f00,bg=#242321 + ble-face -s vim_airline_b_insert fg=235,bg=131 # fg=#242321,bg=#c14c3d + ble-face -s vim_airline_b_insert_modified fg=222,bg=235 # fg=#f4cf86,bg=#242321 + ble-face -s vim_airline_b_normal_modified fg=22,bg=235 # fg=#005f00,bg=#242321 + ble-face -s vim_airline_b_replace fg=214,bg=241 # fg=#ffa724,bg=#666462 + ble-face -s vim_airline_b_replace_modified fg=214,bg=235 # fg=#ffa724,bg=#242321 + ble-face -s vim_airline_b_visual fg=60,bg=222 # fg=#416389,bg=#f4cf86 + ble-face -s vim_airline_b_visual_modified fg=94,bg=235 # fg=#9a4820,bg=#242321 + ble-face -s vim_airline_c fg=137,bg=235 # fg=#b88853,bg=#242321 + ble-face -s vim_airline_c_inactive fg=22,bg=235 # fg=#005f00,bg=#242321 + ble-face -s vim_airline_c_inactive_modified fg=22,bg=231 # fg=#005f00,bg=#ffffff + ble-face -s vim_airline_c_insert fg=222,bg=235 # fg=#f4cf86,bg=#242321 + ble-face -s vim_airline_c_normal_modified fg=22,bg=235 # fg=#005f00,bg=#242321 + ble-face -s vim_airline_c_replace fg=255,bg=208 # fg=#f8f6f2,bg=#ff7400 + ble-face -s vim_airline_c_replace_modified fg=214,bg=235 # fg=#ffa724,bg=#242321 + ble-face -s vim_airline_c_visual fg=94,bg=255 # fg=#9a4820,bg=#f8f6f2 + ble-face -s vim_airline_c_visual_modified fg=94,bg=235 # fg=#9a4820,bg=#242321 +} diff --git a/.local/share/blesh/contrib/airline/understated.bash b/.local/share/blesh/contrib/airline/understated.bash new file mode 100644 index 0000000..1daa3eb --- /dev/null +++ b/.local/share/blesh/contrib/airline/understated.bash @@ -0,0 +1,23 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/understated.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:understated/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=69 # fg=#ffffff,bg=#5f87ff + ble-face -s vim_airline_a_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_a_insert fg=231,bg=107 # fg=#ffffff,bg=#87af5f + ble-face -s vim_airline_a_replace fg=231,bg=88 # fg=#ffffff,bg=#870000 + ble-face -s vim_airline_a_visual fg=231,bg=130 # fg=#ffffff,bg=#af5f00 + ble-face -s vim_airline_b fg=144,bg=62 # fg=#afaf87,bg=#5f5f5f + ble-face -s vim_airline_b_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c fg=144,bg=62 # fg=#afaf87,bg=#5f5f5f + ble-face -s vim_airline_c_inactive fg=239,bg=234 # fg=#4e4e4e,bg=#1c1c1c + ble-face -s vim_airline_c_inactive_modified fg=239,bg=231 # fg=#4e4e4e,bg=#ffffff + ble-face -s vim_airline_c_normal_modified fg=231,bg=53 # fg=#ffffff,bg=#5f005f + ble-face -s vim_airline_c_visual_modified fg=144,bg=53 # fg=#afaf87,bg=#5f005f + ble-face -s vim_airline_z_replace fg=231,bg=107 # fg=#ffffff,bg=#87af5f +} diff --git a/.local/share/blesh/contrib/airline/violet.bash b/.local/share/blesh/contrib/airline/violet.bash new file mode 100644 index 0000000..68dd911 --- /dev/null +++ b/.local/share/blesh/contrib/airline/violet.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/violet.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# Normal mode " guifg guibg ctermfg ctermbg + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:violet/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=250,bg=97 # fg=#bcbcbc,bg=#875faf + ble-face -s vim_airline_a_inactive fg=97,bg=237 # fg=#875faf,bg=#3a3a3a + ble-face -s vim_airline_a_insert fg=252,bg=29 # fg=#cacfd2,bg=#009966 + ble-face -s vim_airline_a_replace fg=251,bg=168 # fg=#c6c6c6,bg=#ce537a + ble-face -s vim_airline_a_visual fg=52,bg=205 # fg=#5f0000,bg=#ff5faf + ble-face -s vim_airline_b fg=170,bg=239 # fg=#d75fd7,bg=#4e4e4e + ble-face -s vim_airline_b_inactive fg=97,bg=237 # fg=#875faf,bg=#3a3a3a + ble-face -s vim_airline_c fg=251,bg=237 # fg=#c6c6c6,bg=#3a3a3a + ble-face -s vim_airline_c_inactive fg=97,bg=237 # fg=#875faf,bg=#3a3a3a + ble-face -s vim_airline_z_replace fg=250,bg=97 # fg=#bcbcbc,bg=#875faf +} diff --git a/.local/share/blesh/contrib/airline/wombat.bash b/.local/share/blesh/contrib/airline/wombat.bash new file mode 100644 index 0000000..635a88a --- /dev/null +++ b/.local/share/blesh/contrib/airline/wombat.bash @@ -0,0 +1,40 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/wombat.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# +# vim-airline companion theme of Wombat +# looks great with wombat256 vim colorscheme + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:wombat/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=233,bg=186 # fg=#141413,bg=#cae682 + ble-face -s vim_airline_a_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_a_insert fg=233,bg=221 # fg=#141413,bg=#fde76e + ble-face -s vim_airline_a_insert_modified fg=233,bg=221 # fg=#141413,bg=#fade3e + ble-face -s vim_airline_a_normal_modified fg=233,bg=114 # fg=#141413,bg=#86cd74 + ble-face -s vim_airline_a_replace fg=233,bg=173 # fg=#141413,bg=#e5786d + ble-face -s vim_airline_a_replace_modified fg=233,bg=167 # fg=#141413,bg=#e55345 + ble-face -s vim_airline_a_visual fg=233,bg=153 # fg=#141413,bg=#b5d3f3 + ble-face -s vim_airline_a_visual_modified fg=233,bg=110 # fg=#141413,bg=#7cb0e6 + ble-face -s vim_airline_b fg=186,bg=58 # fg=#cae682,bg=#32322f + ble-face -s vim_airline_b_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_b_insert fg=221,bg=58 # fg=#fde76e,bg=#32322f + ble-face -s vim_airline_b_insert_modified fg=221,bg=238 # fg=#fade3e,bg=#40403c + ble-face -s vim_airline_b_normal_modified fg=114,bg=238 # fg=#86cd74,bg=#40403c + ble-face -s vim_airline_b_replace fg=173,bg=58 # fg=#e5786d,bg=#32322f + ble-face -s vim_airline_b_replace_modified fg=167,bg=238 # fg=#e55345,bg=#40403c + ble-face -s vim_airline_b_visual fg=153,bg=58 # fg=#b5d3f3,bg=#32322f + ble-face -s vim_airline_b_visual_modified fg=110,bg=238 # fg=#7cb0e6,bg=#40403c + ble-face -s vim_airline_c fg=186,bg=235 # fg=#cae682,bg=#242424 + ble-face -s vim_airline_c_inactive fg=243,bg=235 # fg=#767676,bg=#242424 + ble-face -s vim_airline_c_inactive_modified fg=114,bg=16 # fg=#86cd74,bg=#000000 + ble-face -s vim_airline_c_insert fg=221,bg=235 # fg=#fde76e,bg=#242424 + ble-face -s vim_airline_c_insert_modified fg=221,bg=235 # fg=#fade3e,bg=#242424 + ble-face -s vim_airline_c_normal_modified fg=114,bg=235 # fg=#86cd74,bg=#242424 + ble-face -s vim_airline_c_replace fg=173,bg=235 # fg=#e5786d,bg=#242424 + ble-face -s vim_airline_c_replace_modified fg=167,bg=235 # fg=#e55345,bg=#242424 + ble-face -s vim_airline_c_visual fg=153,bg=235 # fg=#b5d3f3,bg=#242424 + ble-face -s vim_airline_c_visual_modified fg=110,bg=235 # fg=#7cb0e6,bg=#242424 +} diff --git a/.local/share/blesh/contrib/airline/xtermlight.bash b/.local/share/blesh/contrib/airline/xtermlight.bash new file mode 100644 index 0000000..e22e370 --- /dev/null +++ b/.local/share/blesh/contrib/airline/xtermlight.bash @@ -0,0 +1,29 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/xtermlight.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:xtermlight/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=255,bg=27 # fg=#eeeeee,bg=#005fff + ble-face -s vim_airline_a_inactive fg=242,bg=249 # fg=#6c6c6c,bg=#b2b2b2 + ble-face -s vim_airline_a_insert fg=255,bg=29 # fg=#eeeeee,bg=#00875f + ble-face -s vim_airline_a_replace fg=22,bg=196 # fg=#005f00,bg=#ff0000 + ble-face -s vim_airline_a_visual fg=255,bg=202 # fg=#eeeeee,bg=#ff5f00 + ble-face -s vim_airline_b fg=18,bg=45 # fg=#000087,bg=#00d7ff + ble-face -s vim_airline_b_inactive fg=245,bg=252 # fg=#8a8a8a,bg=#d0d0d0 + ble-face -s vim_airline_b_insert fg=22,bg=42 # fg=#005f00,bg=#00d787 + ble-face -s vim_airline_b_visual fg=52,bg=214 # fg=#5f0000,bg=#ffaf00 + ble-face -s vim_airline_c fg=27,bg=159 # fg=#005fff,bg=#afffff + ble-face -s vim_airline_c_inactive fg=248,bg=255 # fg=#a8a8a8,bg=#eeeeee + ble-face -s vim_airline_c_inactive_modified fg=160,bg=231 # fg=#d70000,bg=#ffffff + ble-face -s vim_airline_c_insert fg=23,bg=156 # fg=#005f5f,bg=#afff87 + ble-face -s vim_airline_c_insert_modified fg=160,bg=224 # fg=#d70000,bg=#ffdfdf + ble-face -s vim_airline_c_normal_modified fg=160,bg=224 # fg=#d70000,bg=#ffdfdf + ble-face -s vim_airline_c_replace_modified fg=160,bg=224 # fg=#d70000,bg=#ffdfdf + ble-face -s vim_airline_c_visual fg=166,bg=228 # fg=#d75f00,bg=#ffff87 + ble-face -s vim_airline_c_visual_modified fg=160,bg=224 # fg=#d70000,bg=#ffdfdf + ble-face -s vim_airline_z_replace fg=255,bg=29 # fg=#eeeeee,bg=#00875f +} diff --git a/.local/share/blesh/contrib/airline/zenburn.bash b/.local/share/blesh/contrib/airline/zenburn.bash new file mode 100644 index 0000000..7a458b1 --- /dev/null +++ b/.local/share/blesh/contrib/airline/zenburn.bash @@ -0,0 +1,21 @@ +# From github:vim-airline/vim-airline-themes/autoload/airline/themes/zenburn.vim +# The MIT License (MIT) +# Copyright (C) 2013-2021 Bailey Ling & Contributors. +# + +ble-import lib/vim-airline + +function ble/lib/vim-airline/theme:zenburn/initialize { + ble-face -r vim_airline_@ + ble-face -s vim_airline_a fg=231,bg=18 # fg=#ffffff,bg=#00008b + ble-face -s vim_airline_a_inactive fg=21,bg=231 # fg=#0000ff,bg=#ffffff + ble-face -s vim_airline_a_insert fg=231,bg=201 # fg=#ffffff,bg=#ff00ff + ble-face -s vim_airline_a_replace fg=231,bg=21 # fg=#ffffff,bg=#0000ff + ble-face -s vim_airline_a_visual fg=231,bg=30 # fg=#ffffff,bg=#008b8b + ble-face -s vim_airline_b fg=18,bg=252 # fg=#00008b,bg=#d3d3d3 + ble-face -s vim_airline_b_inactive fg=21,bg=231 # fg=#0000ff,bg=#ffffff + ble-face -s vim_airline_b_insert fg=201,bg=252 # fg=#ff00ff,bg=#d3d3d3 + ble-face -s vim_airline_b_replace fg=21,bg=252 # fg=#0000ff,bg=#d3d3d3 + ble-face -s vim_airline_b_visual fg=30,bg=252 # fg=#008b8b,bg=#d3d3d3 + ble-face -s vim_airline_c fg=21,bg=231 # fg=#0000ff,bg=#ffffff +} diff --git a/.local/share/blesh/contrib/bash-preexec.bash b/.local/share/blesh/contrib/bash-preexec.bash new file mode 100644 index 0000000..ac74c19 --- /dev/null +++ b/.local/share/blesh/contrib/bash-preexec.bash @@ -0,0 +1,180 @@ +# ble/contrib/integration/bash-preexec.bash (C) 2022-2023, akinomyoga + +## @arr[in] precmd_functions +## @arr[in] preexec_functions +## The functions registered to these arrays are executed on PRECMD and +## PREEXEC hooks, respectively. +## +## @fn[in] precmd +## @fn[in] preexec +## If these functions are defined, they are executed on PRECMD and PREEXEC +## hooks, respectively, through "precmd_functions" and "preexec_functions". +## +## +## * Integration with bash-preexec.sh (https://github.com/rcaloras/bash-preexec) +## +## Although this script works without bash-preexec, it provides a better +## integration with bash-preexec when bash-preexec is loaded. The +## integration relies on the following public API of bash-preexec. +## +## @fn __bp_precmd_invoke_functions lastexit lastarg +## @fn __bp_preexec_invoke_functions lastexit lastarg this_command +## @fn __bp_uninstall +## @var __bp_trapdebug_string +## @var __bp_install_string + +function ble/contrib/integration:bash-preexec/add-convenience-functions { + ble/array#remove precmd_functions precmd + ble/array#remove preexec_functions preexec + ble/array#unshift precmd_functions precmd + ble/array#unshift preexec_functions preexec +} + +function ble/contrib/integration:bash-preexec/precmd.hook { + local _ble_local_lastexit=$? _ble_local_lastarg=$_ + + # Emulate bash-preexec variables + __bp_last_ret_value=$_ble_local_lastexit + __bp_last_argument_prev_command=$_ble_local_lastarg + BP_PIPESTATUS=("${BLE_PIPESTATUS[@]}") + local __bp_inside_precmd=1 + + # local __bp_blesh_invoking_through_blesh=1 # XXX + if ble/is-function __bp_precmd_invoke_functions; then + __bp_precmd_invoke_functions "$_ble_local_lastexit" "$_ble_local_lastarg" + else + # For older bash-preexec.sh / without bash-preexec.sh + local _ble_local_hook + for _ble_local_hook in "${precmd_functions[@]}"; do + if ble/bin#has "$_ble_local_hook"; then + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + "$_ble_local_hook" + fi + done + fi +} + +function ble/contrib/integration:bash-preexec/preexec.hook { + local _ble_local_lastexit=$? _ble_local_lastarg=$_ _ble_local_command=$1 + + # Emulate bash-preexec variables + local __bp_inside_preexec=1 + + # local __bp_blesh_invoking_through_blesh=1 # XXX + if ble/is-function __bp_preexec_invoke_functions; then + __bp_preexec_invoke_functions "$_ble_local_lastexit" "$_ble_local_lastarg" + else + # For older bash-preexec.sh / without bash-preexec.sh + local _ble_local_hook + for _ble_local_hook in "${preexec_functions[@]}"; do + if ble/bin#has "$_ble_local_hook"; then + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + "$_ble_local_hook" "$_ble_local_command" + fi + done + fi +} + +## @fn ble/contrib/integration:bash-preexec/attach.hook +## Remove bash-preexec hooks +function ble/contrib/integration:bash-preexec/attach.hook { + local BP_TRAPDEBUG_STRING=${__bp_trapdebug_string:-'__bp_preexec_invoke_exec "$_"'} + + # Remove bash-preexec preexec hook in builtin DEBUG trap. + local trap_string q="'" Q="'\''" + ble/util/assign trap_string 'builtin trap -p DEBUG' + if [[ $trap_string == "trap -- '${BP_TRAPDEBUG_STRING//$q/$Q}' DEBUG" ]]; then + if [[ ${__bp_trap_string-} ]]; then + builtin eval -- "builtin $__bp_trap_string" + else + builtin trap - DEBUG + fi + fi + + if ble/is-function __bp_uninstall; then + __bp_uninstall + else + # For older bash-preexec.sh + + local BP_INSTALL_STRING=${__bp_install_string:-$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install'} + local BP_PROMPT_COMMAND_PREFIX=__bp_precmd_invoke_cmd + local BP_PROMPT_COMMAND_SUFFIX=__bp_interactive_mode + + # Remove __bp_install hook from PROMPT_COMMAND + if [[ ${PROMPT_COMMAND-} == *"$__bp_install_string"* ]]; then + PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING[;$'\n']}" # Edge case of appending to PROMPT_COMMAND + PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING}" + fi + + # Remove precmd hook from PROMPT_COMMAND + local i prompt_command + for i in "${!PROMPT_COMMAND[@]}"; do + prompt_command=${PROMPT_COMMAND[i]} + case $prompt_command in + ("$BP_PROMPT_COMMAND_PREFIX"|"$BP_PROMPT_COMMAND_SUFFIX") + prompt_command= ;; + (*) + prompt_command=${prompt_command/#"$BP_PROMPT_COMMAND_PREFIX"$'\n'/$'\n'} + prompt_command=${prompt_command%$'\n'"$BP_PROMPT_COMMAND_SUFFIX"} + prompt_command=${prompt_command#$'\n'} + esac + PROMPT_COMMAND[i]=$prompt_command + done + + # Remove preexec hook in the DEBUG trap + local q="'" Q="'\''" trap_string + ble/util/assign trap_string 'trap -p DEBUG' + if [[ $trap_string == "trap -- '${BP_TRAPDEBUG_STRING//$q/$Q}' DEBUG" ]]; then + if [[ ${__bp_trap_string-} ]]; then + builtin eval -- "$__bp_trap_string" + else + trap - DEBUG + fi + fi + fi +} +ble/function#trace ble/contrib/integration:bash-preexec/attach.hook + +## @fn ble/contrib/integration:bash-preexec/detach.hook +function ble/contrib/integration:bash-preexec/detach.hook { + # Reinstall bash-preexec hooks + local BP_INSTALL_STRING=${__bp_install_string-} + [[ ! $BP_INSTALL_STRING ]] && ble/is-function __bp_install && + BP_INSTALL_STRING=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install' + + builtin eval -- "$__bp_install_string" + + # Note: 重複して登録される (古い bash-preexec.sh) かもしれないし、全 + # く登録されない (bash-preexec.sh をロードしていない時) かもしれない + # ので、ble.sh 側で末尾で一回呼び出す形に修正する。 + ble/contrib/integration:bash-preexec/add-convenience-functions +} + +ble/contrib/integration:bash-preexec/add-convenience-functions +blehook PRECMD!=ble/contrib/integration:bash-preexec/precmd.hook +blehook PREEXEC!=ble/contrib/integration:bash-preexec/preexec.hook +blehook ATTACH!=ble/contrib/integration:bash-preexec/attach.hook +blehook DETACH!=ble/contrib/integration:bash-preexec/detach.hook +if [[ ${bash_preexec_imported-${__bp_imported-}} ]]; then + ble/contrib/integration:bash-preexec/attach.hook +fi + +# prevent bash-preexec.sh to be loaded +blehook ATTACH-=ble/contrib/integration:bash-preexec/loader +blehook POSTEXEC-=ble/contrib/integration:bash-preexec/loader +bash_preexec_imported=defined +__bp_imported=defined + +# XXX: 以下は uninstall で削除しきれなかった時の為の保険。今の所不要に思われる。 +# __bp_blesh_check() { +# if [[ $BLE_ATTACHED && ! ${__bp_blesh_invoking_through_blesh-} ]]; then +# ble/contrib/integration:bash-preexec/attach.hook +# fi +# } +# precmd_function+=(__bp_blesh_check) +# preexec_function+=(__bp_blesh_check) + +# Some settings rely on the internal APIs of bash-preexec. For example, iTerm2 +# shell integration uses "__bp_set_ret_value" and +# "$__bp_last_argument_prev_command". +function __bp_set_ret_value { return ${1:+"$1"}; } diff --git a/.local/share/blesh/contrib/colorglass.base16.dat b/.local/share/blesh/contrib/colorglass.base16.dat new file mode 100644 index 0000000..d8a0eb4 --- /dev/null +++ b/.local/share/blesh/contrib/colorglass.base16.dat @@ -0,0 +1,578 @@ +# https://github.com/akinomyoga/contra +contra 0x000000 0x800000 0x008000 0x808000 0x000080 0x800080 0x008080 0xC0C0C0 0x808080 0xFF0000 0x32CD32 0xFFD700 0x0000FF 0xFF00FF 0x40E0D0 0xFFFFFF 0x000000 0xFFFFFF 0x000000 + +# The following palettes are created from +# https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit +# (2024-08-19) + +VGA 0x000000 0xAA0000 0x00AA00 0xAA5500 0x0000AA 0xAA00AA 0x00AAAA 0xAAAAAA 0x555555 0xFF5555 0x55FF55 0xFFFF55 0x5555FF 0xFF55FF 0x55FFFF 0xffffff 0xffffff 0x000000 0xffffff +WinXPConsole 0x000000 0x800000 0x008000 0x808000 0x000080 0x800080 0x008080 0xc0c0c0 0x808080 0xff0000 0x00ff00 0xffff00 0x0000ff 0xff00ff 0x00ffff 0xffffff 0xffffff 0x000000 0xffffff +PowerShell 0x000000 0x800000 0x008000 0xeeedf0 0x000080 0x012456 0x008080 0xc0c0c0 0x808080 0xff0000 0x00ff00 0xffff00 0x0000ff 0xff00ff 0x00ffff 0xffffff 0xeeedf0 0x012456 0xfedba9 +VSCode 0x000000 0xcd3131 0x0dbc79 0xe5e510 0x2472c8 0xbc3fbc 0x11a8cd 0xe5e5e5 0x666666 0xf14c4c 0x23d18b 0xf5f543 0x3b8eea 0xd670d6 0x29b8dB 0xe5e5e5 0xe5e5e5 0x000000 0xe5e5e5 +Win10Console 0x0c0c0c 0xc50f1f 0x13a10e 0xc19c00 0x0037da 0x881798 0x3a96dd 0xcccccc 0x767676 0xe74856 0x16c60c 0xf9f1a5 0x3b78ff 0xb4009e 0x61d6d6 0xf2f2f2 0xf2f2f2 0x0c0c0c 0xf2f2f2 +Terminal.app 0x000000 0x990000 0x00A600 0x999900 0x0000B2 0xB200B2 0x00A6B2 0xBFBFBF 0x666666 0xE60000 0x00D900 0xE5E500 0x0000FF 0xE600E6 0x00E6E6 0xE6E6E6 0x000000 0xE6E6E6 0x000000 +PuTTY 0x000000 0xbb0000 0x00bb00 0xbbbb00 0x0000bb 0xbb00bb 0x00bbbb 0xbbbbbb 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xffffff 0x000000 0xffffff +mIRC 0x000000 0x7f0000 0x009300 0xfc7f00 0x00007f 0x9c009c 0x009393 0xd2d2d2 0x7f7f7f 0xff0000 0x00fc00 0xffff00 0x0000fc 0xff00ff 0x00ffff 0xffffff 0x000000 0xffffff 0x000000 +xterm 0x000000 0xcd0000 0x00cd00 0xcdcd00 0x0000ee 0xcd00cd 0x00cdcd 0xe5e5e5 0x7f7f7f 0xff0000 0x00ff00 0xffff00 0x5c5cff 0xff00ff 0x00ffff 0xffffff 0x000000 0xffffff 0x000000 +Ubuntu 0x010101 0xde382b 0x39b54a 0xffc706 0x006fb8 0x762671 0x2cb5e9 0xcccccc 0x808080 0xff0000 0x00ff00 0xffff00 0x0000ff 0xff00ff 0x00ffff 0xffffff 0xffffff 0x010101 0xffffff +Eclipse 0x000000 0xcd0000 0x00cd00 0xcdcd00 0x0000ee 0xcd00cd 0x00cdcd 0xe5e5e5 0x000000 0xff0000 0x00ff00 0xffff00 0x5c5cff 0xff00ff 0x00ffff 0xffffff 0x000000 0xffffff 0x000000 + +#------------------------------------------------------------------------------ +# SECTION iTerm2-Color-Schemes +# +# The following palettes are generated by +# ble/contrib/colorglass/extract-base16-palette-from-iTerm2-Color-Schemes +# (2024-08-19 in iTerm2-Color-Schemes @ b4a9c4d). The upstream license is MIT. +# The table is generated by the following command: +# +# $ make/color.sample.sh convert-iTerm2-palettes + +3024Day 0x090300 0xdb2d20 0x01a252 0xfded02 0x01a0e4 0xa16a94 0xb5e4f4 0xa5a2a2 0x5c5855 0xe8bbd0 0x3a3432 0x4a4543 0x807d7c 0xd6d5d4 0xcdab53 0xf7f7f7 0x4a4543 0xf7f7f7 0x4a4543 +3024Night 0x090300 0xdb2d20 0x01a252 0xfded02 0x01a0e4 0xa16a94 0xb5e4f4 0xa5a2a2 0x5c5855 0xe8bbd0 0x3a3432 0x4a4543 0x807d7c 0xd6d5d4 0xcdab53 0xf7f7f7 0xa5a2a2 0x090300 0xa5a2a2 +AardvarkBlue 0x191919 0xaa342e 0x4b8c0f 0xdbba00 0x1370d3 0xc43ac3 0x008eb0 0xbebebe 0x454545 0xf05b50 0x95dc55 0xffe763 0x60a4ec 0xe26be2 0x60b6cb 0xf7f7f7 0xdddddd 0x102040 0x007acc +Abernathy 0x000000 0xcd0000 0x00cd00 0xcdcd00 0x1093f5 0xcd00cd 0x00cdcd 0xfaebd7 0x404040 0xff0000 0x00ff00 0xffff00 0x11b5f6 0xff00ff 0x00ffff 0xffffff 0xeeeeec 0x111416 0xbbbbbb +Adventure 0x040404 0xd84a33 0x5da602 0xeebb6e 0x417ab3 0xe5c499 0xbdcfe5 0xdbded8 0x685656 0xd76b42 0x99b52c 0xffb670 0x97d7ef 0xaa7900 0xbdcfe5 0xe4d5c7 0xfeffff 0x040404 0xfeffff +AdventureTime 0x050404 0xbd0013 0x4ab118 0xe7741e 0x0f4ac6 0x665993 0x70a598 0xf8dcc0 0x4e7cbf 0xfc5f5a 0x9eff6e 0xefc11a 0x1997c6 0x9b5953 0xc8faf4 0xf6f5fb 0xf8dcc0 0x1f1d45 0xefbf38 +Afterglow 0x151515 0xac4142 0x7e8e50 0xe5b567 0x6c99bb 0x9f4e85 0x7dd6cf 0xd0d0d0 0x505050 0xac4142 0x7e8e50 0xe5b567 0x6c99bb 0x9f4e85 0x7dd6cf 0xf5f5f5 0xd0d0d0 0x212121 0xd0d0d0 +Alabaster 0x000000 0xaa3731 0x448c27 0xcb9000 0x325cc0 0x7a3e9d 0x0083b2 0xf7f7f7 0x777777 0xf05050 0x60cb00 0xffbc5d 0x007acc 0xe64ce6 0x00aacb 0xf7f7f7 0x000000 0xf7f7f7 0x007acc +AlienBlood 0x112616 0x7f2b27 0x2f7e25 0x717f24 0x2f6a7f 0x47587f 0x327f77 0x647d75 0x3c4812 0xe08009 0x18e000 0xbde000 0x00aae0 0x0058e0 0x00e0c4 0x73fa91 0x637d75 0x0f1610 0x73fa91 +Andromeda 0x000000 0xcd3131 0x05bc79 0xe5e512 0x2472c8 0xbc3fbc 0x0fa8cd 0xe5e5e5 0x666666 0xcd3131 0x05bc79 0xe5e512 0x2472c8 0xbc3fbc 0x0fa8cd 0xe5e5e5 0xe5e5e5 0x262a33 0xf8f8f0 +AppleClassic 0x000000 0xc91b00 0x00c200 0xc7c400 0x0225c7 0xca30c7 0x00c5c7 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xff77ff 0x60fdff 0xffffff 0xd5a200 0x2c2b2b 0xc7c7c7 +AppleSystemColors 0x1a1a1a 0xcc372e 0x26a439 0xcdac08 0x0869cb 0x9647bf 0x479ec2 0x98989d 0x464646 0xff453a 0x32d74b 0xffd60a 0x0a84ff 0xbf5af2 0x76d6ff 0xffffff 0xffffff 0x1e1e1e 0x98989d +Argonaut 0x232323 0xff000f 0x8ce10b 0xffb900 0x008df8 0x6d43a6 0x00d8eb 0xffffff 0x444444 0xff2740 0xabe15b 0xffd242 0x0092ff 0x9a5feb 0x67fff0 0xffffff 0xfffaf4 0x0e1019 0xff0018 +Arthur 0x3d352a 0xcd5c5c 0x86af80 0xe8ae5b 0x6495ed 0xdeb887 0xb0c4de 0xbbaa99 0x554444 0xcc5533 0x88aa22 0xffa75d 0x87ceeb 0x996600 0xb0c4de 0xddccbb 0xddeedd 0x1c1c1c 0xe2bbef +AtelierSulphurpool 0x202746 0xc94922 0xac9739 0xc08b30 0x3d8fd1 0x6679cc 0x22a2c9 0x979db4 0x6b7394 0xc76b29 0x293256 0x5e6687 0x898ea4 0xdfe2f1 0x9c637a 0xf5f7ff 0x979db4 0x202746 0x979db4 +Atom 0x000000 0xfd5ff1 0x87c38a 0xffd7b1 0x85befd 0xb9b6fc 0x85befd 0xe0e0e0 0x000000 0xfd5ff1 0x94fa36 0xf5ffa8 0x96cbfe 0xb9b6fc 0x85befd 0xe0e0e0 0xc5c8c6 0x161719 0xd0d0d0 +AtomOneLight 0x000000 0xde3e35 0x3f953a 0xd2b67c 0x2f5af3 0x950095 0x3f953a 0xbbbbbb 0x000000 0xde3e35 0x3f953a 0xd2b67c 0x2f5af3 0xa00095 0x3f953a 0xffffff 0x2a2c33 0xf9f9f9 0xbbbbbb +Aurora 0x23262e 0xf0266f 0x8fd46d 0xffe66d 0x0321d7 0xee5d43 0x03d6b8 0xc74ded 0x292e38 0xf92672 0x8fd46d 0xffe66d 0x03d6b8 0xee5d43 0x03d6b8 0xc74ded 0xffca28 0x23262e 0xee5d43 +AyuMirage 0x191e2a 0xed8274 0xa6cc70 0xfad07b 0x6dcbfa 0xcfbafa 0x90e1c6 0xc7c7c7 0x686868 0xf28779 0xbae67e 0xffd580 0x73d0ff 0xd4bfff 0x95e6cb 0xffffff 0xcbccc6 0x1f2430 0xffcc66 +BananaBlueberry 0x17141f 0xff6b7f 0x00bd9c 0xe6c62f 0x22e8df 0xdc396a 0x56b6c2 0xf1f1f1 0x495162 0xfe9ea1 0x98c379 0xf9e46b 0x91fff4 0xda70d6 0xbcf3ff 0xffffff 0xcccccc 0x191323 0xe07d13 +Batman 0x1b1d1e 0xe6dc44 0xc8be46 0xf4fd22 0x737174 0x747271 0x62605f 0xc6c5bf 0x505354 0xfff78e 0xfff27d 0xfeed6c 0x919495 0x9a9a9d 0xa3a3a6 0xdadbd6 0x6f6f6f 0x1b1d1e 0xfcef0c +BelafonteDay 0x20111b 0xbe100e 0x858162 0xeaa549 0x426a79 0x97522c 0x989a9c 0x968c83 0x5e5252 0xbe100e 0x858162 0xeaa549 0x426a79 0x97522c 0x989a9c 0xd5ccba 0x45373c 0xd5ccba 0x45373c +BelafonteNight 0x20111b 0xbe100e 0x858162 0xeaa549 0x426a79 0x97522c 0x989a9c 0x968c83 0x5e5252 0xbe100e 0x858162 0xeaa549 0x426a79 0x97522c 0x989a9c 0xd5ccba 0x968c83 0x20111b 0x968c83 +BirdsOfParadise 0x573d26 0xbe2d26 0x6ba18a 0xe99d2a 0x5a86ad 0xac80a6 0x74a6ad 0xe0dbb7 0x9b6c4a 0xe84627 0x95d8ba 0xd0d150 0xb8d3ed 0xd19ecb 0x93cfd7 0xfff9d5 0xe0dbb7 0x2a1f1d 0x573d26 +Blazer 0x000000 0xb87a7a 0x7ab87a 0xb8b87a 0x7a7ab8 0xb87ab8 0x7ab8b8 0xd9d9d9 0x262626 0xdbbdbd 0xbddbbd 0xdbdbbd 0xbdbddb 0xdbbddb 0xbddbdb 0xffffff 0xd9e6f2 0x0d1926 0xd9e6f2 +BlueMatrix 0x101116 0xff5680 0x00ff9c 0xfffc58 0x00b0ff 0xd57bff 0x76c1ff 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xd682ec 0x60fdff 0xffffff 0x00a2ff 0x101116 0x76ff9f +BlueBerryPie 0x0a4c62 0x99246e 0x5cb1b3 0xeab9a8 0x90a5bd 0x9d54a7 0x7e83cc 0xf0e8d6 0x201637 0xc87272 0x0a6c7e 0x7a3188 0x39173d 0xbc94b7 0x5e6071 0x0a6c7e 0xbabab9 0x1c0c28 0xfcfad6 +BlueDolphin 0x292d3e 0xff8288 0xb4e88d 0xf4d69f 0x82aaff 0xe9c1ff 0x89ebff 0xd0d0d0 0x434758 0xff8b92 0xddffa7 0xffe585 0x9cc4ff 0xddb0f6 0xa3f7ff 0xffffff 0xc5f2ff 0x006984 0xffcc00 +BlulocoDark 0x41444d 0xfc2f52 0x25a45c 0xff936a 0x3476ff 0x7a82da 0x4483aa 0xcdd4e0 0x8f9aae 0xff6480 0x3fc56b 0xf9c859 0x10b1fe 0xff78f8 0x5fb9bc 0xffffff 0xb9c0cb 0x282c34 0xffcc00 +BlulocoLight 0x373a41 0xd52753 0x23974a 0xdf631c 0x275fe4 0x823ff1 0x27618d 0xbabbc2 0x676a77 0xff6480 0x3cbc66 0xc5a332 0x0099e1 0xce33c0 0x6d93bb 0xd3d3d3 0x373a41 0xf9f9f9 0xf32759 +Borland 0x4f4f4f 0xff6c60 0xa8ff60 0xffffb6 0x96cbfe 0xff73fd 0xc6c5fe 0xeeeeee 0x7c7c7c 0xffb6b0 0xceffac 0xffffcc 0xb5dcff 0xff9cfe 0xdfdffe 0xffffff 0xffff4e 0x0000a4 0xffa560 +Breeze 0x31363b 0xed1515 0x11d116 0xf67400 0x1d99f3 0x9b59b6 0x1abc9c 0xeff0f1 0x7f8c8d 0xc0392b 0x1cdc9a 0xfdbc4b 0x3daee9 0x8e44ad 0x16a085 0xfcfcfc 0xeff0f1 0x31363b 0xeff0f1 +BrightLights 0x191919 0xff355b 0xb7e876 0xffc251 0x76d4ff 0xba76e7 0x6cbfb5 0xc2c8d7 0x191919 0xff355b 0xb7e876 0xffc251 0x76d5ff 0xba76e7 0x6cbfb5 0xc2c8d7 0xb3c9d7 0x191919 0xf34b00 +Broadcast 0x000000 0xda4939 0x519f50 0xffd24a 0x6d9cbe 0xd0d0ff 0x6e9cbe 0xffffff 0x323232 0xff7b6b 0x83d182 0xffff7c 0x9fcef0 0xffffff 0xa0cef0 0xffffff 0xe6e1dc 0x2b2b2b 0xffffff +Brogrammer 0x1f1f1f 0xf81118 0x2dc55e 0xecba0f 0x2a84d2 0x4e5ab7 0x1081d6 0xd6dbe5 0xd6dbe5 0xde352e 0x1dd361 0xf3bd09 0x1081d6 0x5350b9 0x0f7ddb 0xffffff 0xd6dbe5 0x131313 0xb9b9b9 +BuiltinDark 0x000000 0xbb0000 0x00bb00 0xbbbb00 0x0000bb 0xbb00bb 0x00bbbb 0xbbbbbb 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xbbbbbb 0x000000 0xbbbbbb +BuiltinLight 0x000000 0xbb0000 0x00bb00 0xbbbb00 0x0000bb 0xbb00bb 0x00bbbb 0xbbbbbb 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0x000000 0xffffff 0x000000 +BuiltinPastelDark 0x4f4f4f 0xff6c60 0xa8ff60 0xffffb6 0x96cbfe 0xff73fd 0xc6c5fe 0xeeeeee 0x7c7c7c 0xffb6b0 0xceffac 0xffffcc 0xb5dcff 0xff9cfe 0xdfdffe 0xffffff 0xbbbbbb 0x000000 0xffa560 +BuiltinSolarizedDark 0x073642 0xdc322f 0x859900 0xb58900 0x268bd2 0xd33682 0x2aa198 0xeee8d5 0x002b36 0xcb4b16 0x586e75 0x657b83 0x839496 0x6c71c4 0x93a1a1 0xfdf6e3 0x839496 0x002b36 0x839496 +BuiltinSolarizedLight 0x073642 0xdc322f 0x859900 0xb58900 0x268bd2 0xd33682 0x2aa198 0xeee8d5 0x002b36 0xcb4b16 0x586e75 0x657b83 0x839496 0x6c71c4 0x93a1a1 0xfdf6e3 0x657b83 0xfdf6e3 0x657b83 +BuiltinTangoDark 0x000000 0xcc0000 0x4e9a06 0xc4a000 0x3465a4 0x75507b 0x06989a 0xd3d7cf 0x555753 0xef2929 0x8ae234 0xfce94f 0x729fcf 0xad7fa8 0x34e2e2 0xeeeeec 0xffffff 0x000000 0xffffff +BuiltinTangoLight 0x000000 0xcc0000 0x4e9a06 0xc4a000 0x3465a4 0x75507b 0x06989a 0xd3d7cf 0x555753 0xef2929 0x8ae234 0xfce94f 0x729fcf 0xad7fa8 0x34e2e2 0xeeeeec 0x000000 0xffffff 0x000000 +C64 0x090300 0x883932 0x55a049 0xbfce72 0x40318d 0x8b3f96 0x67b6bd 0xffffff 0x000000 0x883932 0x55a049 0xbfce72 0x40318d 0x8b3f96 0x67b6bd 0xf7f7f7 0x7869c4 0x40318d 0x7869c4 +CGA 0x000000 0xaa0000 0x00aa00 0xaa5500 0x0000aa 0xaa00aa 0x00aaaa 0xaaaaaa 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xaaaaaa 0x000000 0xb8b8b8 +CLRS 0x000000 0xf8282a 0x328a5d 0xfa701d 0x135cd0 0x9f00bd 0x33c3c1 0xb3b3b3 0x555753 0xfb0416 0x2cc631 0xfdd727 0x1670ff 0xe900b0 0x3ad5ce 0xeeeeec 0x262626 0xffffff 0x6fd3fc +Calamity 0x2f2833 0xfc644d 0xa5f69c 0xe9d7a5 0x3b79c7 0xf92672 0x74d3de 0xd5ced9 0x7e6c88 0xfc644d 0xa5f69c 0xe9d7a5 0x3b79c7 0xf92672 0x74d3de 0xffffff 0xd5ced9 0x2f2833 0xd5ced9 +Chalk 0x7d8b8f 0xb23a52 0x789b6a 0xb9ac4a 0x2a7fac 0xbd4f5a 0x44a799 0xd2d8d9 0x888888 0xf24840 0x80c470 0xffeb62 0x4196ff 0xfc5275 0x53cdbd 0xd2d8d9 0xd2d8d9 0x2b2d2e 0x708284 +Chalkboard 0x000000 0xc37372 0x72c373 0xc2c372 0x7372c3 0xc372c2 0x72c2c3 0xd9d9d9 0x323232 0xdbaaaa 0xaadbaa 0xdadbaa 0xaaaadb 0xdbaada 0xaadadb 0xffffff 0xd9e6f2 0x29262f 0xd9e6f2 +ChallengerDeep 0x141228 0xff5458 0x62d196 0xffb378 0x65b2ff 0x906cff 0x63f2f1 0xa6b3cc 0x565575 0xff8080 0x95ffa4 0xffe9aa 0x91ddff 0xc991e1 0xaaffe4 0xcbe3e7 0xcbe1e7 0x1e1c31 0xfbfcfc +Chester 0x080200 0xfa5e5b 0x16c98d 0xffc83f 0x288ad6 0xd34590 0x28ddde 0xe7e7e7 0x6f6b68 0xfa5e5b 0x16c98d 0xfeef6d 0x278ad6 0xd34590 0x27dede 0xffffff 0xffffff 0x2c3643 0xb4b1b1 +Ciapre 0x181818 0x810009 0x48513b 0xcc8b3f 0x576d8c 0x724d7c 0x5c4f4b 0xaea47f 0x555555 0xac3835 0xa6a75d 0xdcdf7c 0x3097c6 0xd33061 0xf3dbb2 0xf4f4f4 0xaea47a 0x191c27 0x92805b +CobaltNeon 0x142631 0xff2320 0x3ba5ff 0xe9e75c 0x8ff586 0x781aa0 0x8ff586 0xba46b2 0xfff688 0xd4312e 0x8ff586 0xe9f06d 0x3c7dd2 0x8230a7 0x6cbc67 0x8ff586 0x8ff586 0x142838 0xc4206f +Cobalt2 0x000000 0xff0000 0x38de21 0xffe50a 0x1460d2 0xff005d 0x00bbbb 0xbbbbbb 0x555555 0xf40e17 0x3bd01d 0xedc809 0x5555ff 0xff55ff 0x6ae3fa 0xffffff 0xffffff 0x132738 0xf0cc09 +CrayonPonyFish 0x2b1b1d 0x91002b 0x579524 0xab311b 0x8c87b0 0x692f50 0xe8a866 0x68525a 0x3d2b2e 0xc5255d 0x8dff57 0xc8381d 0xcfc9ff 0xfc6cba 0xffceaf 0xb0949d 0x68525a 0x150707 0x68525a +CutiePro 0x000000 0xf56e7f 0xbec975 0xf58669 0x42d9c5 0xd286b7 0x37cb8a 0xd5c3c3 0x88847f 0xe5a1a3 0xe8d6a7 0xf1bb79 0x80c5de 0xb294bb 0x9dccbb 0xffffff 0xd5d0c9 0x181818 0xefc4cd +Cyberdyne 0x080808 0xff8373 0x00c172 0xd2a700 0x0071cf 0xff90fe 0x6bffdd 0xf1f1f1 0x2e2e2e 0xffc4be 0xd6fcba 0xfffed5 0xc2e3ff 0xffb2fe 0xe6e7fe 0xffffff 0x00ff92 0x151144 0x00ff9c +DarkPastel 0x000000 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xbbbbbb 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xffffff 0x000000 0xbbbbbb +Dark+ 0x000000 0xcd3131 0x0dbc79 0xe5e510 0x2472c8 0xbc3fbc 0x11a8cd 0xe5e5e5 0x666666 0xf14c4c 0x23d18b 0xf5f543 0x3b8eea 0xd670d6 0x29b8db 0xe5e5e5 0xcccccc 0x1e1e1e 0xffffff +Darkside 0x000000 0xe8341c 0x68c256 0xf2d42c 0x1c98e8 0x8e69c9 0x1c98e8 0xbababa 0x000000 0xe05a4f 0x77b869 0xefd64b 0x387cd3 0x957bbe 0x3d97e2 0xbababa 0xbababa 0x222324 0xbbbbbb +Desert 0x4d4d4d 0xff2b2b 0x98fb98 0xf0e68c 0xcd853f 0xffdead 0xffa0a0 0xf5deb3 0x555555 0xff5555 0x55ff55 0xffff55 0x87ceff 0xff55ff 0xffd700 0xffffff 0xffffff 0x333333 0x00ff00 +DimmedMonokai 0x3a3d43 0xbe3f48 0x879a3b 0xc5a635 0x4f76a1 0x855c8d 0x578fa4 0xb9bcba 0x888987 0xfb001f 0x0f722f 0xc47033 0x186de3 0xfb0067 0x2e706d 0xfdffb9 0xb9bcba 0x1f1f1f 0xf83e19 +Django 0x000000 0xfd6209 0x41a83e 0xffe862 0x245032 0xf8f8f8 0x9df39f 0xffffff 0x323232 0xff943b 0x73da70 0xffff94 0x568264 0xffffff 0xcfffd1 0xffffff 0xf8f8f8 0x0b2f20 0x336442 +DjangoRebornAgain 0x000000 0xfd6209 0x41a83e 0xffe862 0x245032 0xf8f8f8 0x9df39f 0xffffff 0x323232 0xff943b 0x73da70 0xffff94 0x568264 0xffffff 0xcfffd1 0xffffff 0xdadedc 0x051f14 0xffcc00 +DjangoSmooth 0x000000 0xfd6209 0x41a83e 0xffe862 0x989898 0xf8f8f8 0x9df39f 0xe8e8e7 0x323232 0xff943b 0x73da70 0xffff94 0xcacaca 0xffffff 0xcfffd1 0xffffff 0xf8f8f8 0x245032 0x336442 +DoomPeacock 0x1c1f24 0xcb4b16 0x26a6a6 0xbcd42a 0x2a6cc6 0xa9a1e1 0x5699af 0xede0ce 0x2b2a27 0xff5d38 0x98be65 0xe6f972 0x51afef 0xc678dd 0x46d9ff 0xdfdfdf 0xede0ce 0x2b2a27 0x9c9c9d +DoomOne 0x000000 0xff6c6b 0x98be65 0xecbe7b 0xa9a1e1 0xc678dd 0x51afef 0xbbc2cf 0x000000 0xff6655 0x99bb66 0xecbe7b 0xa9a1e1 0xc678dd 0x51afef 0xbfbfbf 0xbbc2cf 0x282c34 0x51afef +DotGov 0x191919 0xbf091d 0x3d9751 0xf6bb34 0x17b2e0 0x7830b0 0x8bd2ed 0xffffff 0x191919 0xbf091d 0x3d9751 0xf6bb34 0x17b2e0 0x7830b0 0x8bd2ed 0xffffff 0xebebeb 0x262c35 0xd9002f +Dracula+ 0x21222c 0xff5555 0x50fa7b 0xffcb6b 0x82aaff 0xc792ea 0x8be9fd 0xf8f8f2 0x545454 0xff6e6e 0x69ff94 0xffcb6b 0xd6acff 0xff92df 0xa4ffff 0xf8f8f2 0xf8f8f2 0x212121 0xeceff4 +Dracula 0x000000 0xff5555 0x50fa7b 0xf1fa8c 0xbd93f9 0xff79c6 0x8be9fd 0xbbbbbb 0x555555 0xff5555 0x50fa7b 0xf1fa8c 0xbd93f9 0xff79c6 0x8be9fd 0xffffff 0xf8f8f2 0x1e1f29 0xbbbbbb +DuotoneDark 0x1f1d27 0xd9393e 0x2dcd73 0xd9b76e 0xffc284 0xde8d40 0x2488ff 0xb7a1ff 0x353147 0xd9393e 0x2dcd73 0xd9b76e 0xffc284 0xde8d40 0x2488ff 0xeae5ff 0xb7a1ff 0x1f1d27 0xff9839 +ENCOM 0x000000 0x9f0000 0x008b00 0xffd000 0x0081ff 0xbc00ca 0x008b8b 0xbbbbbb 0x555555 0xff0000 0x00ee00 0xffff00 0x0000ff 0xff00ff 0x00cdcd 0xffffff 0x00a595 0x000000 0xbbbbbb +Earthsong 0x121418 0xc94234 0x85c54c 0xf5ae2e 0x1398b9 0xd0633d 0x509552 0xe5c6aa 0x675f54 0xff645a 0x98e036 0xe0d561 0x5fdaff 0xff9269 0x84f088 0xf6f7ec 0xe5c7a9 0x292520 0xf6f7ec +Elemental 0x3c3c30 0x98290f 0x479a43 0x7f7111 0x497f7d 0x7f4e2f 0x387f58 0x807974 0x555445 0xe0502a 0x61e070 0xd69927 0x79d9d9 0xcd7c54 0x59d599 0xfff1e9 0x807a74 0x22211d 0xfacb80 +Elementary 0x242424 0xd71c15 0x5aa513 0xfdb40c 0x063b8c 0xe40038 0x2595e1 0xefefef 0x4b4b4b 0xfc1c18 0x6bc219 0xfec80e 0x0955ff 0xfb0050 0x3ea8fc 0x8c00ec 0xefefef 0x181818 0xbbbbbb +EspressoLibre 0x000000 0xcc0000 0x1a921c 0xf0e53a 0x0066ff 0xc5656b 0x06989a 0xd3d7cf 0x555753 0xef2929 0x9aff87 0xfffb5c 0x43a8ed 0xff818a 0x34e2e2 0xeeeeec 0xb8a898 0x2a211c 0xffffff +Espresso 0x353535 0xd25252 0xa5c261 0xffc66d 0x6c99bb 0xd197d9 0xbed6ff 0xeeeeec 0x535353 0xf00c0c 0xc2e075 0xe1e48b 0x8ab7d9 0xefb5f7 0xdcf4ff 0xffffff 0xffffff 0x323232 0xd6d6d6 +Everblush 0x232a2d 0xe57474 0x8ccf7e 0xe5c76b 0x67b0e8 0xc47fd5 0x6cbfbf 0xb3b9b8 0x2d3437 0xef7e7e 0x96d988 0xf4d67a 0x71baf2 0xce89df 0x67cbe7 0xbdc3c2 0xdadada 0x141b1e 0xdadada +Fahrenheit 0x1d1d1d 0xcda074 0x9e744d 0xfecf75 0x720102 0x734c4d 0x979797 0xffffce 0x000000 0xfecea0 0xcc734d 0xfd9f4d 0xcb4a05 0x4e739f 0xfed04d 0xffffff 0xffffce 0x000000 0xbbbbbb +Fairyfloss 0x040303 0xf92672 0xc2ffdf 0xe6c000 0xc2ffdf 0xffb8d1 0xc5a3ff 0xf8f8f0 0x6090cb 0xff857f 0xc2ffdf 0xffea00 0xc2ffdf 0xffb8d1 0xc5a3ff 0xf8f8f0 0xf8f8f2 0x5a5475 0xf8f8f0 +Fideloper 0x292f33 0xcb1e2d 0xedb8ac 0xb7ab9b 0x2e78c2 0xc0236f 0x309186 0xeae3ce 0x092028 0xd4605a 0xd4605a 0xa86671 0x7c85c4 0x5c5db2 0x819090 0xfcf4df 0xdbdae0 0x292f33 0xd4605a +FireflyTraditional 0x000000 0xc23720 0x33bc26 0xafad24 0x5a63ff 0xd53ad2 0x33bbc7 0xcccccc 0x828282 0xff3b1e 0x2ee720 0xecec16 0x838dff 0xff5cfe 0x29f0f0 0xebebeb 0xf5f5f5 0x000000 0x00f900 +FirefoxDev 0x002831 0xe63853 0x5eb83c 0xa57706 0x359ddf 0xd75cff 0x4b73a2 0xdcdcdc 0x001e27 0xe1003f 0x1d9000 0xcd9409 0x006fc0 0xa200da 0x005794 0xe2e2e2 0x7c8fa4 0x0e1011 0x708284 +Firewatch 0x585f6d 0xd95360 0x5ab977 0xdfb563 0x4d89c4 0xd55119 0x44a8b6 0xe6e5ff 0x585f6d 0xd95360 0x5ab977 0xdfb563 0x4c89c5 0xd55119 0x44a8b6 0xe6e5ff 0x9ba2b2 0x1e2027 0xf6f7ec +FishTank 0x03073c 0xc6004a 0xacf157 0xfecd5e 0x525fb8 0x986f82 0x968763 0xecf0fc 0x6c5b30 0xda4b8a 0xdbffa9 0xfee6a9 0xb2befa 0xfda5cd 0xa5bd86 0xf6ffec 0xecf0fe 0x232537 0xfecd5e +Flat 0x222d3f 0xa82320 0x32a548 0xe58d11 0x3167ac 0x781aa0 0x2c9370 0xb0b6ba 0x212c3c 0xd4312e 0x2d9440 0xe5be0c 0x3c7dd2 0x8230a7 0x35b387 0xe7eced 0x2cc55d 0x002240 0xe5be0c +Flatland 0x1d1d19 0xf18339 0x9fd364 0xf4ef6d 0x5096be 0x695abc 0xd63865 0xffffff 0x1d1d19 0xd22a24 0xa7d42c 0xff8949 0x61b9d0 0x695abc 0xd63865 0xffffff 0xb8dbef 0x1d1f21 0x708284 +Floraverse 0x08002e 0x64002c 0x5d731a 0xcd751c 0x1d6da1 0xb7077e 0x42a38c 0xf3e0b8 0x331e4d 0xd02063 0xb4ce59 0xfac357 0x40a4cf 0xf12aae 0x62caa8 0xfff5db 0xdbd1b9 0x0e0d15 0xbbbbbb +ForestBlue 0x333333 0xf8818e 0x92d3a2 0x1a8e63 0x8ed0ce 0x5e468c 0x31658c 0xe2d8cd 0x3d3d3d 0xfb3d66 0x6bb48d 0x30c85a 0x39a7a2 0x7e62b3 0x6096bf 0xe2d8cd 0xe2d8cd 0x051519 0x9e9ecb +Framer 0x141414 0xff5555 0x98ec65 0xffcc33 0x00aaff 0xaa88ff 0x88ddff 0xcccccc 0x414141 0xff8888 0xb6f292 0xffd966 0x33bbff 0xcebbff 0xbbecff 0xffffff 0x777777 0x111111 0xfcdc08 +FrontEndDelight 0x242526 0xf8511b 0x565747 0xfa771d 0x2c70b7 0xf02e4f 0x3ca1a6 0xadadad 0x5fac6d 0xf74319 0x74ec4c 0xfdc325 0x3393ca 0xe75e4f 0x4fbce6 0x8c735b 0xadadad 0x1b1c1d 0xcdcdcd +FunForrest 0x000000 0xd6262b 0x919c00 0xbe8a13 0x4699a3 0x8d4331 0xda8213 0xddc265 0x7f6a55 0xe55a1c 0xbfc65a 0xffcb1b 0x7cc9cf 0xd26349 0xe6a96b 0xffeaa3 0xdec165 0x251200 0xe5591c +Galaxy 0x000000 0xf9555f 0x21b089 0xfef02a 0x589df6 0x944d95 0x1f9ee7 0xbbbbbb 0x555555 0xfa8c8f 0x35bb9a 0xffff55 0x589df6 0xe75699 0x3979bc 0xffffff 0xffffff 0x1d2837 0xbbbbbb +Galizur 0x223344 0xaa1122 0x33aa11 0xccaa22 0x2255cc 0x7755aa 0x22bbdd 0x8899aa 0x556677 0xff1133 0x33ff11 0xffdd33 0x3377ff 0xaa77ff 0x33ddff 0xbbccdd 0xddeeff 0x071317 0xddeeff +GitHubDark 0x000000 0xf78166 0x56d364 0xe3b341 0x6ca4f8 0xdb61a2 0x2b7489 0xffffff 0x4d4d4d 0xf78166 0x56d364 0xe3b341 0x6ca4f8 0xdb61a2 0x2b7489 0xffffff 0x8b949e 0x101216 0xc9d1d9 +Github 0x3e3e3e 0x970b16 0x07962a 0xf8eec7 0x003e8a 0xe94691 0x89d1ec 0xffffff 0x666666 0xde0000 0x87d5a2 0xf1d007 0x2e6cba 0xffa29f 0x1cfafe 0xffffff 0x3e3e3e 0xf4f4f4 0x3f3f3f +Glacier 0x2e343c 0xbd0f2f 0x35a770 0xfb9435 0x1f5872 0xbd2523 0x778397 0xffffff 0x404a55 0xbd0f2f 0x49e998 0xfddf6e 0x2a8bc1 0xea4727 0xa0b6d3 0xffffff 0xffffff 0x0c1115 0x6c6c6c +Grape 0x2d283f 0xed2261 0x1fa91b 0x8ddc20 0x487df4 0x8d35c9 0x3bdeed 0x9e9ea0 0x59516a 0xf0729a 0x53aa5e 0xb2dc87 0xa9bcec 0xad81c2 0x9de3eb 0xa288f7 0x9f9fa1 0x171423 0xa288f7 +Grass 0x000000 0xbb0000 0x00bb00 0xe7b000 0x0000a3 0x950062 0x00bbbb 0xbbbbbb 0x555555 0xbb0000 0x00bb00 0xe7b000 0x0000bb 0xff55ff 0x55ffff 0xffffff 0xfff0a5 0x13773d 0x8c2800 +Grey-green 0x000000 0xfe1414 0x74ff00 0xf1ff01 0x00deff 0xff00f0 0x00ffbc 0xffffff 0x666666 0xff3939 0x00ff44 0xffd100 0x00afff 0xff008a 0x00ffd3 0xf5ecec 0xffffff 0x002a1a 0xfff400 +GruvboxLight 0xfbf1c7 0x9d0006 0x79740e 0xb57614 0x076678 0x8f3f71 0x427b58 0x3c3836 0x9d8374 0xcc241d 0x98971a 0xd79921 0x458588 0xb16186 0x689d69 0x7c6f64 0x282828 0xfbf1c7 0x282828 +GruvboxDark 0x282828 0xcc241d 0x98971a 0xd79921 0x458588 0xb16286 0x689d6a 0xa89984 0x928374 0xfb4934 0xb8bb26 0xfabd2f 0x83a598 0xd3869b 0x8ec07c 0xebdbb2 0xebdbb2 0x282828 0xebdbb2 +GruvboxDarkHard 0x1b1b1b 0xcc241d 0x98971a 0xd79921 0x458588 0xb16286 0x689d6a 0xa89984 0x928374 0xfb4934 0xb8bb26 0xfabd2f 0x83a598 0xd3869b 0x8ec07c 0xebdbb2 0xebdbb2 0x1b1b1b 0xebdbb2 +GruvboxLight 0xfbf1c7 0x9d0006 0x79740e 0xb57614 0x076678 0x8f3f71 0x427b58 0x3c3836 0x9d8374 0xcc241d 0x98971a 0xd79921 0x458588 0xb16186 0x689d69 0x7c6f64 0x282828 0xfbf1c7 0x282828 +Guezwhoz 0x080808 0xff5f5f 0x87d7af 0xd7d787 0x5fafd7 0xafafff 0x5fd7d7 0xdadada 0x8a8a8a 0xd75f5f 0xafd7af 0xd7d7af 0x87afd7 0xafafd7 0x87d7d7 0xdadada 0xd0d0d0 0x1c1c1c 0xeeeeee +HaX0R_BLUE 0x010921 0x10b6ff 0x10b6ff 0x10b6ff 0x10b6ff 0x10b6ff 0x10b6ff 0xfafafa 0x080117 0x00b3f7 0x00b3f7 0x00b3f7 0x00b3f7 0x00b3f7 0x00b3f7 0xfefefe 0x11b7ff 0x010515 0x10b6ff +HaX0R_GR33N 0x001f0b 0x15d00d 0x15d00d 0x15d00d 0x15d00d 0x15d00d 0x15d00d 0xfafafa 0x001510 0x19e20e 0x19e20e 0x19e20e 0x19e20e 0x19e20e 0x19e20e 0xfefefe 0x16b10e 0x020f01 0x15d00d +HaX0R_R3D 0x1f0000 0xb00d0d 0xb00d0d 0xb00d0d 0xb00d0d 0xb00d0d 0xb00d0d 0xfafafa 0x150000 0xff1111 0xff1010 0xff1010 0xff1010 0xff1010 0xff1010 0xfefefe 0xb10e0e 0x200101 0xb00d0d +Hacktober 0x191918 0xb34538 0x587744 0xd08949 0x206ec5 0x864651 0xac9166 0xf1eee7 0x2c2b2a 0xb33323 0x42824a 0xc75a22 0x5389c5 0xe795a5 0xebc587 0xffffff 0xc9c9c9 0x141414 0xc9c9c9 +Hardcore 0x1b1d1e 0xf92672 0xa6e22e 0xfd971f 0x66d9ef 0x9e6ffe 0x5e7175 0xccccc6 0x505354 0xff669d 0xbeed5f 0xe6db74 0x66d9ef 0x9e6ffe 0xa3babf 0xf8f8f2 0xa0a0a0 0x121212 0xbbbbbb +Harper 0x010101 0xf8b63f 0x7fb5e1 0xd6da25 0x489e48 0xb296c6 0xf5bfd7 0xa8a49d 0x726e6a 0xf8b63f 0x7fb5e1 0xd6da25 0x489e48 0xb296c6 0xf5bfd7 0xfefbea 0xa8a49d 0x010101 0xa8a49d +Highway 0x000000 0xd00e18 0x138034 0xffcb3e 0x006bb3 0x6b2775 0x384564 0xededed 0x5d504a 0xf07e18 0xb1d130 0xfff120 0x4fc2fd 0xde0071 0x5d504a 0xffffff 0xededed 0x222225 0xe0d9b9 +HipsterGreen 0x000000 0xb6214a 0x00a600 0xbfbf00 0x246eb2 0xb200b2 0x00a6b2 0xbfbfbf 0x666666 0xe50000 0x86a93e 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0x84c138 0x100b05 0x23ff18 +Hivacruz 0x202746 0xc94922 0xac9739 0xc08b30 0x3d8fd1 0x6679cc 0x22a2c9 0x979db4 0x6b7394 0xc76b29 0x73ad43 0x5e6687 0x898ea4 0xdfe2f1 0x9c637a 0xf5f7ff 0xede4e4 0x132638 0x979db4 +Homebrew 0x000000 0x990000 0x00a600 0x999900 0x0000b2 0xb200b2 0x00a6b2 0xbfbfbf 0x666666 0xe50000 0x00d900 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0x00ff00 0x000000 0x23ff18 +Hopscotch.256 0x322931 0xdd464c 0x8fc13e 0xfdcc59 0x1290bf 0xc85e7c 0x149b93 0xb9b5b8 0x797379 0xdd464c 0x8fc13e 0xfdcc59 0x1290bf 0xc85e7c 0x149b93 0xffffff 0xb9b5b8 0x322931 0xb9b5b8 +Hopscotch 0x322931 0xdd464c 0x8fc13e 0xfdcc59 0x1290bf 0xc85e7c 0x149b93 0xb9b5b8 0x797379 0xfd8b19 0x433b42 0x5c545b 0x989498 0xd5d3d5 0xb33508 0xffffff 0xb9b5b8 0x322931 0xb9b5b8 +Hurtado 0x575757 0xff1b00 0xa5e055 0xfbe74a 0x496487 0xfd5ff1 0x86e9fe 0xcbcccb 0x262626 0xd51d00 0xa5df55 0xfbe84a 0x89beff 0xc001c1 0x86eafe 0xdbdbdb 0xdbdbdb 0x000000 0xbbbbbb +Hybrid 0x2a2e33 0xb84d51 0xb3bf5a 0xe4b55e 0x6e90b0 0xa17eac 0x7fbfb4 0xb5b9b6 0x1d1f22 0x8d2e32 0x798431 0xe58a50 0x4b6b88 0x6e5079 0x4d7b74 0x5a626a 0xb7bcba 0x161719 0xb7bcba +IC_Green_PPL 0x014401 0xff2736 0x41a638 0x76a831 0x2ec3b9 0x50a096 0x3ca078 0xe6fef2 0x035c03 0xb4fa5c 0xaefb86 0xdafa87 0x2efaeb 0x50fafa 0x3cfac8 0xe0f1dc 0xe0f1dc 0x2c2c2c 0x47fa6b +IC_Orange_PPL 0x000000 0xc13900 0xa4a900 0xcaaf00 0xbd6d00 0xfc5e00 0xf79500 0xffc88a 0x6a4f2a 0xff8c68 0xf6ff40 0xffe36e 0xffbe55 0xfc874f 0xc69752 0xfafaff 0xffcb83 0x262626 0xfc531d +IR_Black 0x4f4f4f 0xfa6c60 0xa8ff60 0xfffeb7 0x96cafe 0xfa73fd 0xc6c5fe 0xefedef 0x7b7b7b 0xfcb6b0 0xcfffab 0xffffcc 0xb5dcff 0xfb9cfe 0xe0e0fe 0xffffff 0xf1f1f1 0x000000 0x808080 +JackieBrown 0x2c1d16 0xef5734 0x2baf2b 0xbebf00 0x246eb2 0xd05ec1 0x00acee 0xbfbfbf 0x666666 0xe50000 0x86a93e 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0xffcc2f 0x2c1d16 0x23ff18 +Japanesque 0x343935 0xcf3f61 0x7bb75b 0xe9b32a 0x4c9ad4 0xa57fc4 0x389aad 0xfafaf6 0x595b59 0xd18fa6 0x767f2c 0x78592f 0x135979 0x604291 0x76bbca 0xb2b5ae 0xf7f6ec 0x1e1e1e 0xedcf4f +Jellybeans 0x929292 0xe27373 0x94b979 0xffba7b 0x97bedc 0xe1c0fa 0x00988e 0xdedede 0xbdbdbd 0xffa1a1 0xbddeab 0xffdca0 0xb1d8f6 0xfbdaff 0x1ab2a8 0xffffff 0xdedede 0x121212 0xffa560 +JetBrainsDarcula 0x000000 0xfa5355 0x126e00 0xc2c300 0x4581eb 0xfa54ff 0x33c2c1 0xadadad 0x555555 0xfb7172 0x67ff4f 0xffff00 0x6d9df1 0xfb82ff 0x60d3d1 0xeeeeee 0xadadad 0x202020 0xffffff +Kibble 0x4d4d4d 0xc70031 0x29cf13 0xd8e30e 0x3449d1 0x8400ff 0x0798ab 0xe2d1e3 0x5a5a5a 0xf01578 0x6ce05c 0xf3f79e 0x97a4f7 0xc495f0 0x68f2e0 0xffffff 0xf7f7f7 0x0e100a 0x9fda9c +Kolorit 0x1d1a1e 0xff5b82 0x47d7a1 0xe8e562 0x5db4ee 0xda6cda 0x57e9eb 0xededed 0x1d1a1e 0xff5b82 0x47d7a1 0xe8e562 0x5db4ee 0xda6cda 0x57e9eb 0xededed 0xefecec 0x1d1a1e 0xc7c7c7 +Konsolas 0x000000 0xaa1717 0x18b218 0xebae1f 0x2323a5 0xad1edc 0x42b0c8 0xc8c1c1 0x7b716e 0xff4141 0x5fff5f 0xffff55 0x4b4bff 0xff54ff 0x69ffff 0xffffff 0xc8c1c1 0x060606 0xc8c1c1 +LabFox 0x2e2e2e 0xfc6d26 0x3eb383 0xfca121 0xdb3b21 0x380d75 0x6e49cb 0xffffff 0x464646 0xff6517 0x53eaa8 0xfca013 0xdb501f 0x441090 0x7d53e7 0xffffff 0xffffff 0x2e2e2e 0x7f7f7f +Laser 0x626262 0xff8373 0xb4fb73 0x09b4bd 0xfed300 0xff90fe 0xd1d1fe 0xf1f1f1 0x8f8f8f 0xffc4be 0xd6fcba 0xfffed5 0xf92883 0xffb2fe 0xe6e7fe 0xffffff 0xf106e3 0x030d18 0x00ff9c +LaterThisEvening 0x2b2b2b 0xd45a60 0xafba67 0xe5d289 0xa0bad6 0xc092d6 0x91bfb7 0x3c3d3d 0x454747 0xd3232f 0xaabb39 0xe5be39 0x6699d6 0xab53d6 0x5fc0ae 0xc1c2c2 0x959595 0x222222 0x424242 +Lavandula 0x230046 0x7d1625 0x337e6f 0x7f6f49 0x4f4a7f 0x5a3f7f 0x58777f 0x736e7d 0x372d46 0xe05167 0x52e0c4 0xe0c386 0x8e87e0 0xa776e0 0x9ad4e0 0x8c91fa 0x736e7d 0x050014 0x8c91fa +LiquidCarbon 0x000000 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0xbccccc 0x000000 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0xbccccc 0xafc2c2 0x303030 0xffffff +LiquidCarbonTransparent 0x000000 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0xbccccc 0x000000 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0xbccccc 0xafc2c2 0x000000 0xffffff +LiquidCarbonTransparentInverse 0xbccccd 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0x000000 0xffffff 0xff3030 0x559a70 0xccac00 0x0099cc 0xcc69c8 0x7ac4cc 0x000000 0xafc2c2 0x000000 0xffffff +ManPage 0x000000 0xcc0000 0x00a600 0x999900 0x0000b2 0xb200b2 0x00a6b2 0xcccccc 0x666666 0xe50000 0x00d900 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0x000000 0xfef49c 0x7f7f7f +Mariana 0x000000 0xec5f66 0x99c794 0xf9ae58 0x6699cc 0xc695c6 0x5fb4b4 0xf7f7f7 0x333333 0xf97b58 0xacd1a8 0xfac761 0x85add6 0xd8b6d8 0x82c4c4 0xffffff 0xd8dee9 0x343d46 0xfcbb6a +Material 0x212121 0xb7141f 0x457b24 0xf6981e 0x134eb2 0x560088 0x0e717c 0xefefef 0x424242 0xe83b3f 0x7aba3a 0xffea2e 0x54a4f3 0xaa4dbc 0x26bbd1 0xd9d9d9 0x232322 0xeaeaea 0x16afca +MaterialDark 0x212121 0xb7141f 0x457b24 0xf6981e 0x134eb2 0x560088 0x0e717c 0xefefef 0x424242 0xe83b3f 0x7aba3a 0xffea2e 0x54a4f3 0xaa4dbc 0x26bbd1 0xd9d9d9 0xe5e5e5 0x232322 0x16afca +MaterialDarker 0x000000 0xff5370 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xffffff 0x545454 0xff5370 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xffffff 0xeeffff 0x212121 0xffffff +MaterialDesignColors 0x435b67 0xfc3841 0x5cf19e 0xfed032 0x37b6ff 0xfc226e 0x59ffd1 0xffffff 0xa1b0b8 0xfc746d 0xadf7be 0xfee16c 0x70cfff 0xfc669b 0x9affe6 0xffffff 0xe7ebed 0x1d262a 0xeaeaea +MaterialOcean 0x546e7a 0xff5370 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xffffff 0x546e7a 0xff5370 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xffffff 0x8f93a2 0x0f111a 0xffcc00 +Mathias 0x000000 0xe52222 0xa6e32d 0xfc951e 0xc48dff 0xfa2573 0x67d9f0 0xf2f2f2 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xbbbbbb 0x000000 0xbbbbbb +Medallion 0x000000 0xb64c00 0x7c8b16 0xd3bd26 0x616bb0 0x8c5a90 0x916c25 0xcac29a 0x5e5219 0xff9149 0xb2ca3b 0xffe54a 0xacb8ff 0xffa0ff 0xffbc51 0xfed698 0xcac296 0x1d1908 0xd3ba30 +Mellifluous 0x1a1a1a 0xd29393 0xb3b393 0xcbaa89 0xa8a1be 0xb39fb0 0xc0af8c 0xdadada 0x5b5b5b 0xc95954 0x828040 0xa6794c 0x5a6599 0x9c6995 0x74a39e 0xffffff 0xdadada 0x1a1a1a 0xbfad9e +Mirage 0x011627 0xff9999 0x85cc95 0xffd700 0x7fb5ff 0xddb3ff 0x21c7a8 0xffffff 0x575656 0xff9999 0x85cc95 0xffd700 0x7fb5ff 0xddb3ff 0x85cc95 0xffffff 0xa6b2c0 0x1b2738 0xddb3ff +Misterioso 0x000000 0xff4242 0x74af68 0xffad29 0x338f86 0x9414e6 0x23d7d7 0xe1e1e0 0x555555 0xff3242 0x74cd68 0xffb929 0x23d7d7 0xff37ff 0x00ede1 0xffffff 0xe1e1e0 0x2d3743 0x000000 +Molokai 0x121212 0xfa2573 0x98e123 0xdfd460 0x1080d0 0x8700ff 0x43a8d0 0xbbbbbb 0x555555 0xf6669d 0xb1e05f 0xfff26d 0x00afff 0xaf87ff 0x51ceff 0xffffff 0xbbbbbb 0x121212 0xbbbbbb +MonaLisa 0x351b0e 0x9b291c 0x636232 0xc36e28 0x515c5d 0x9b1d29 0x588056 0xf7d75c 0x874228 0xff4331 0xb4b264 0xff9566 0x9eb2b4 0xff5b6a 0x8acd8f 0xffe598 0xf7d66a 0x120b0d 0xc46c32 +MonokaiRemastered 0x1a1a1a 0xf4005f 0x98e024 0xfd971f 0x9d65ff 0xf4005f 0x58d1eb 0xc4c5b5 0x625e4c 0xf4005f 0x98e024 0xe0d561 0x9d65ff 0xf4005f 0x58d1eb 0xf6f6ef 0xd9d9d9 0x0c0c0c 0xfc971f +MonokaiSoda 0x1a1a1a 0xf4005f 0x98e024 0xfa8419 0x9d65ff 0xf4005f 0x58d1eb 0xc4c5b5 0x625e4c 0xf4005f 0x98e024 0xe0d561 0x9d65ff 0xf4005f 0x58d1eb 0xf6f6ef 0xc4c5b5 0x1a1a1a 0xf6f7ec +MonokaiVivid 0x121212 0xfa2934 0x98e123 0xfff30a 0x0443ff 0xf800f8 0x01b6ed 0xffffff 0x838383 0xf6669d 0xb1e05f 0xfff26d 0x0443ff 0xf200f6 0x51ceff 0xffffff 0xf9f9f9 0x121212 0xfb0007 +N0tch2k 0x383838 0xa95551 0x666666 0xa98051 0x657d3e 0x767676 0xc9c9c9 0xd0b8a3 0x474747 0xa97775 0x8c8c8c 0xa99175 0x98bd5e 0xa3a3a3 0xdcdcdc 0xd8c8bb 0xa0a0a0 0x222222 0xaa9175 +Neon 0x000000 0xff3045 0x5ffa74 0xfffc7e 0x0208cb 0xf924e7 0x00fffc 0xc7c7c7 0x686868 0xff5a5a 0x75ff88 0xfffd96 0x3c40cb 0xf15be5 0x88fffe 0xffffff 0x00fffc 0x14161a 0xc7c7c7 +Neopolitan 0x000000 0x800000 0x61ce3c 0xfbde2d 0x253b76 0xff0080 0x8da6ce 0xf8f8f8 0x000000 0x800000 0x61ce3c 0xfbde2d 0x253b76 0xff0080 0x8da6ce 0xf8f8f8 0xffffff 0x271f19 0xffffff +Neutron 0x23252b 0xb54036 0x5ab977 0xdeb566 0x6a7c93 0xa4799d 0x3f94a8 0xe6e8ef 0x23252b 0xb54036 0x5ab977 0xdeb566 0x6a7c93 0xa4799d 0x3f94a8 0xebedf2 0xe6e8ef 0x1c1e22 0xf6f7ec +NightOwlishLight 0x011627 0xd3423e 0x2aa298 0xdaaa01 0x4876d6 0x403f53 0x08916a 0x7a8181 0x7a8181 0xf76e6e 0x49d0c5 0xdac26b 0x5ca7e4 0x697098 0x00c990 0x989fb1 0x403f53 0xffffff 0x403f53 +NightLionv1 0x4c4c4c 0xbb0000 0x5fde8f 0xf3f167 0x276bd8 0xbb00bb 0x00dadf 0xbbbbbb 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xbbbbbb 0x000000 0xbbbbbb +NightLionv2 0x4c4c4c 0xbb0000 0x04f623 0xf3f167 0x64d0f0 0xce6fdb 0x00dadf 0xbbbbbb 0x555555 0xff5555 0x7df71d 0xffff55 0x62cbe8 0xff9bf5 0x00ccd8 0xffffff 0xbbbbbb 0x171717 0xbbbbbb +NocturnalWinter 0x4d4d4d 0xf12d52 0x09cd7e 0xf5f17a 0x3182e0 0xff2b6d 0x09c87a 0xfcfcfc 0x808080 0xf16d86 0x0ae78d 0xfffc67 0x6096ff 0xff78a2 0x0ae78d 0xffffff 0xe6e5e5 0x0d0d17 0xe6e5e5 +Novel 0x000000 0xcc0000 0x009600 0xd06b00 0x0000cc 0xcc00cc 0x0087cc 0xcccccc 0x808080 0xcc0000 0x009600 0xd06b00 0x0000cc 0xcc00cc 0x0087cc 0xffffff 0x3b2322 0xdfdbc3 0x73635a +NvimDark 0x07080d 0xffc0b9 0xb3f6c0 0xfce094 0xa6dbff 0xffcaff 0x8cf8f7 0xeef1f8 0x4f5258 0xffc0b9 0xb3f6c0 0xfce094 0xa6dbff 0xffcaff 0x8cf8f7 0xeef1f8 0xe0e2ea 0x14161b 0x9b9ea4 +NvimLight 0x07080d 0x590008 0x005523 0x6b5300 0x004c73 0x470045 0x007373 0xeef1f8 0x4f5258 0x590008 0x005523 0x6b5300 0x004c73 0x470045 0x007373 0xeef1f8 0x14161b 0xe0e2ea 0x9b9ea4 +Obsidian 0x000000 0xa60001 0x00bb00 0xfecd22 0x3a9bdb 0xbb00bb 0x00bbbb 0xbbbbbb 0x555555 0xff0003 0x93c863 0xfef874 0xa1d7ff 0xff55ff 0x55ffff 0xffffff 0xcdcdcd 0x283033 0xc0cad0 +Ocean 0x000000 0x990000 0x00a600 0x999900 0x0000b2 0xb200b2 0x00a6b2 0xbfbfbf 0x666666 0xe50000 0x00d900 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0xffffff 0x224fbc 0x7f7f7f +Oceanic-Next 0x121c21 0xe44754 0x89bd82 0xf7bd51 0x5486c0 0xb77eb8 0x50a5a4 0xffffff 0x52606b 0xe44754 0x89bd82 0xf7bd51 0x5486c0 0xb77eb8 0x50a5a4 0xffffff 0xb3b8c3 0x121b21 0xb3b8c3 +OceanicMaterial 0x000000 0xee2b2a 0x40a33f 0xffea2e 0x1e80f0 0x8800a0 0x16afca 0xa4a4a4 0x777777 0xdc5c60 0x70be71 0xfff163 0x54a4f3 0xaa4dbc 0x42c7da 0xffffff 0xc2c8d7 0x1c262b 0xb3b8c3 +Ollie 0x000000 0xac2e31 0x31ac61 0xac4300 0x2d57ac 0xb08528 0x1fa6ac 0x8a8eac 0x5b3725 0xff3d48 0x3bff99 0xff5e1e 0x4488ff 0xffc21d 0x1ffaff 0x5b6ea7 0x8a8dae 0x222125 0x5b6ea7 +OneHalfDark 0x282c34 0xe06c75 0x98c379 0xe5c07b 0x61afef 0xc678dd 0x56b6c2 0xdcdfe4 0x282c34 0xe06c75 0x98c379 0xe5c07b 0x61afef 0xc678dd 0x56b6c2 0xdcdfe4 0xdcdfe4 0x282c34 0xa3b3cc +OneHalfLight 0x383a42 0xe45649 0x50a14f 0xc18401 0x0184bc 0xa626a4 0x0997b3 0xfafafa 0x4f525e 0xe06c75 0x98c379 0xe5c07b 0x61afef 0xc678dd 0x56b6c2 0xffffff 0x383a42 0xfafafa 0xbfceff +OperatorMonoDark 0x5a5a5a 0xca372d 0x4d7b3a 0xd4d697 0x4387cf 0xb86cb4 0x72d5c6 0xced4cd 0x9a9b99 0xc37d62 0x83d0a2 0xfdfdc5 0x89d3f6 0xff2c7a 0x82eada 0xfdfdf6 0xc3cac2 0x191919 0xfcdc08 +OvernightSlumber 0x0a1222 0xffa7c4 0x85cc95 0xffcb8b 0x8dabe1 0xc792eb 0x78ccf0 0xffffff 0x575656 0xffa7c4 0x85cc95 0xffcb8b 0x8dabe1 0xc792eb 0xffa7c4 0xffffff 0xced2d6 0x0e1729 0xffa7c4 +Oxocarbon 0x161616 0x3ddbd9 0x33b1ff 0xee5396 0x42be65 0xbe95ff 0xff7eb6 0xf2f4f8 0x585858 0x3ddbd9 0x33b1ff 0xee5396 0x42be65 0xbe95ff 0xff7eb6 0xf2f4f8 0xf2f4f8 0x161616 0xffffff +PaleNightHC 0x000000 0xf07178 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xffffff 0x666666 0xf6a9ae 0xdbf1ba 0xffdfa6 0xb4ccff 0xddbdf2 0xb8eaff 0x999999 0xcccccc 0x3e4251 0xffcb6b +Pandora 0x000000 0xff4242 0x74af68 0xffad29 0x338f86 0x9414e6 0x23d7d7 0xe2e2e2 0x3f5648 0xff3242 0x74cd68 0xffb929 0x23d7d7 0xff37ff 0x00ede1 0xffffff 0xe1e1e1 0x141e43 0x43d58e +ParaisoDark 0x2f1e2e 0xef6155 0x48b685 0xfec418 0x06b6ef 0x815ba4 0x5bc4bf 0xa39e9b 0x776e71 0xef6155 0x48b685 0xfec418 0x06b6ef 0x815ba4 0x5bc4bf 0xe7e9db 0xa39e9b 0x2f1e2e 0xa39e9b +PaulMillr 0x2a2a2a 0xff0000 0x79ff0f 0xe7bf00 0x396bd7 0xb449be 0x66ccff 0xbbbbbb 0x666666 0xff0080 0x66ff66 0xf3d64e 0x709aed 0xdb67e6 0x7adff2 0xffffff 0xf2f2f2 0x000000 0x4d4d4d +PencilDark 0x212121 0xc30771 0x10a778 0xa89c14 0x008ec4 0x523c79 0x20a5ba 0xd9d9d9 0x424242 0xfb007a 0x5fd7af 0xf3e430 0x20bbfc 0x6855de 0x4fb8cc 0xf1f1f1 0xf1f1f1 0x212121 0x20bbfc +PencilLight 0x212121 0xc30771 0x10a778 0xa89c14 0x008ec4 0x523c79 0x20a5ba 0xd9d9d9 0x424242 0xfb007a 0x5fd7af 0xf3e430 0x20bbfc 0x6855de 0x4fb8cc 0xf1f1f1 0x424242 0xf1f1f1 0x20bbfc +Peppermint 0x353535 0xe74669 0x89d287 0xdab853 0x449fd0 0xda62dc 0x65aaaf 0xb4b4b4 0x535353 0xe4859b 0xa3cca2 0xe1e487 0x6fbce2 0xe586e7 0x96dcdb 0xdfdfdf 0xc8c8c8 0x000000 0xbbbbbb +PiattoLight 0x414141 0xb23771 0x66781e 0xcd6f34 0x3c5ea8 0xa454b2 0x66781e 0xffffff 0x3f3f3f 0xdb3365 0x829429 0xcd6f34 0x3c5ea8 0xa454b2 0x829429 0xf2f2f2 0x414141 0xffffff 0x5e77c8 +Pnevma 0x2f2e2d 0xa36666 0x90a57d 0xd7af87 0x7fa5bd 0xc79ec4 0x8adbb4 0xd0d0d0 0x4a4845 0xd78787 0xafbea2 0xe4c9af 0xa1bdce 0xd7beda 0xb1e7dd 0xefefef 0xd0d0d0 0x1c1c1c 0xe4c9af +PoppingandLocking 0x1d2021 0xcc241d 0x98971a 0xd79921 0x458588 0xb16286 0x689d6a 0xa89984 0x928374 0xf42c3e 0xb8bb26 0xfabd2f 0x99c6ca 0xd3869b 0x7ec16e 0xebdbb2 0xebdbb2 0x181921 0xc7c7c7 +ProLight 0x000000 0xe5492b 0x50d148 0xc6c440 0x3b75ff 0xed66e8 0x4ed2de 0xdcdcdc 0x9f9f9f 0xff6640 0x61ef57 0xf2f156 0x0082ff 0xff7eff 0x61f7f8 0xf2f2f2 0x191919 0xffffff 0x4d4d4d +Pro 0x000000 0x990000 0x00a600 0x999900 0x2009db 0xb200b2 0x00a6b2 0xbfbfbf 0x666666 0xe50000 0x00d900 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0xf2f2f2 0x000000 0x4d4d4d +PurpleRain 0x000000 0xff260e 0x9be205 0xffc400 0x00a2fa 0x815bb5 0x00deef 0xffffff 0x565656 0xff4250 0xb8e36e 0xffd852 0x00a6ff 0xac7bf0 0x74fdf3 0xffffff 0xfffbf6 0x21084a 0xff271d +Rapture 0x000000 0xfc644d 0x7afde1 0xfff09b 0x6c9bf5 0xff4fa1 0x64e0ff 0xc0c9e5 0x304b66 0xfc644d 0x7afde1 0xfff09b 0x6c9bf5 0xff4fa1 0x64e0ff 0xffffff 0xc0c9e5 0x111e2a 0xffffff +Raycast_Dark 0x000000 0xff5360 0x59d499 0xffc531 0x56c2ff 0xcf2f98 0x52eee5 0xffffff 0x000000 0xff6363 0x59d499 0xffc531 0x56c2ff 0xcf2f98 0x52eee5 0xffffff 0xffffff 0x1a1a1a 0xcccccc +Raycast_Light 0x000000 0xb12424 0x006b4f 0xf8a300 0x138af2 0x9a1b6e 0x3eb8bf 0xffffff 0x000000 0xb12424 0x006b4f 0xf8a300 0x138af2 0x9a1b6e 0x3eb8bf 0xffffff 0x000000 0xffffff 0x000000 +RedAlert 0x000000 0xd62e4e 0x71be6b 0xbeb86b 0x489bee 0xe979d7 0x6bbeb8 0xd6d6d6 0x262626 0xe02553 0xaff08c 0xdfddb7 0x65aaf1 0xddb7df 0xb7dfdd 0xffffff 0xffffff 0x762423 0xffffff +RedPlanet 0x202020 0x8c3432 0x728271 0xe8bf6a 0x69819e 0x896492 0x5b8390 0xb9aa99 0x676767 0xb55242 0x869985 0xebeb91 0x60827e 0xde4974 0x38add8 0xd6bfb8 0xc2b790 0x222222 0xc2b790 +RedSands 0x000000 0xff3f00 0x00bb00 0xe7b000 0x0072ff 0xbb00bb 0x00bbbb 0xbbbbbb 0x555555 0xbb0000 0x00bb00 0xe7b000 0x0072ae 0xff55ff 0x55ffff 0xffffff 0xd7c9a7 0x7a251e 0xffffff +Relaxed 0x151515 0xbc5653 0x909d63 0xebc17a 0x6a8799 0xb06698 0xc9dfff 0xd9d9d9 0x636363 0xbc5653 0xa0ac77 0xebc17a 0x7eaac7 0xb06698 0xacbbd0 0xf7f7f7 0xd9d9d9 0x353a44 0xd9d9d9 +Retro 0x13a10e 0x13a10e 0x13a10e 0x13a10e 0x13a10e 0x13a10e 0x13a10e 0x13a10e 0x16ba10 0x16ba10 0x16ba10 0x16ba10 0x16ba10 0x16ba10 0x16ba10 0x16ba10 0x13a10e 0x000000 0x13a10e +Rippedcasts 0x000000 0xcdaf95 0xa8ff60 0xbfbb1f 0x75a5b0 0xff73fd 0x5a647e 0xbfbfbf 0x666666 0xeecbad 0xbcee68 0xe5e500 0x86bdc9 0xe500e5 0x8c9bc4 0xe5e5e5 0xffffff 0x2b2b2b 0x7f7f7f +Rouge2 0x5d5d6b 0xc6797e 0x969e92 0xdbcdab 0x6e94b9 0x4c4e78 0x8ab6c1 0xe8e8ea 0x616274 0xc6797e 0xe6dcc4 0xe6dcc4 0x98b3cd 0x8283a1 0xabcbd3 0xe8e8ea 0xa2a3aa 0x17182b 0x969e92 +Royal 0x241f2b 0x91284c 0x23801c 0xb49d27 0x6580b0 0x674d96 0x8aaabe 0x524966 0x312d3d 0xd5356c 0x2cd946 0xfde83b 0x90baf9 0xa479e3 0xacd4eb 0x9e8cbd 0x514968 0x100815 0x524966 +Ryuuko 0x2c3941 0x865f5b 0x66907d 0xb1a990 0x6a8e95 0xb18a73 0x88b2ac 0xececec 0x5d7079 0x865f5b 0x66907d 0xb1a990 0x6a8e95 0xb18a73 0x88b2ac 0xececec 0xececec 0x2c3941 0xececec +Sakura 0x000000 0xd52370 0x41af1a 0xbc7053 0x6964ab 0xc71fbf 0x939393 0x998eac 0x786d69 0xf41d99 0x22e529 0xf59574 0x9892f1 0xe90cdd 0xeeeeee 0xcbb6ff 0xdd7bdc 0x18131e 0xff65fd +ScarletProtocol 0x101116 0xff0051 0x00dc84 0xfaf945 0x0271b6 0xca30c7 0x00c5c7 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xbd35ec 0x60fdff 0xffffff 0xe41951 0x1c153d 0x76ff9f +SeaShells 0x17384c 0xd15123 0x027c9b 0xfca02f 0x1e4950 0x68d4f1 0x50a3b5 0xdeb88d 0x434b53 0xd48678 0x628d98 0xfdd39f 0x1bbcdd 0xbbe3ee 0x87acb4 0xfee4ce 0xdeb88d 0x09141b 0xfca02f +SeafoamPastel 0x757575 0x825d4d 0x728c62 0xada16d 0x4d7b82 0x8a7267 0x729494 0xe0e0e0 0x8a8a8a 0xcf937a 0x98d9aa 0xfae79d 0x7ac3cf 0xd6b2a1 0xade0e0 0xe0e0e0 0xd4e7d4 0x243435 0x57647a +Seti 0x323232 0xc22832 0x8ec43d 0xe0c64f 0x43a5d5 0x8b57b5 0x8ec43d 0xeeeeee 0x323232 0xc22832 0x8ec43d 0xe0c64f 0x43a5d5 0x8b57b5 0x8ec43d 0xffffff 0xcacecd 0x111213 0xe3bf21 +Shaman 0x012026 0xb2302d 0x00a941 0x5e8baa 0x449a86 0x00599d 0x5d7e19 0x405555 0x384451 0xff4242 0x2aea5e 0x8ed4fd 0x61d5ba 0x1298ff 0x98d028 0x58fbd6 0x405555 0x001015 0x4afcd6 +Slate 0x222222 0xe2a8bf 0x81d778 0xc4c9c0 0x264b49 0xa481d3 0x15ab9c 0x02c5e0 0xffffff 0xffcdd9 0xbeffa8 0xd0ccca 0x7ab0d2 0xc5a7d9 0x8cdfe0 0xe0e0e0 0x35b1d2 0x222222 0x87d3c4 +SleepyHollow 0x572100 0xba3934 0x91773f 0xb55600 0x5f63b4 0xa17c7b 0x8faea9 0xaf9a91 0x4e4b61 0xd9443f 0xd6b04e 0xf66813 0x8086ef 0xe2c2bb 0xa4dce7 0xd2c7a9 0xaf9a91 0x121214 0xaf9a91 +Smyck 0x000000 0xb84131 0x7da900 0xc4a500 0x62a3c4 0xba8acc 0x207383 0xa1a1a1 0x7a7a7a 0xd6837c 0xc4f137 0xfee14d 0x8dcff0 0xf79aff 0x6ad9cf 0xf7f7f7 0xf7f7f7 0x1b1b1b 0xbbbbbb +Snazzy 0x000000 0xfc4346 0x50fb7c 0xf0fb8c 0x49baff 0xfc4cb4 0x8be9fe 0xededec 0x555555 0xfc4346 0x50fb7c 0xf0fb8c 0x49baff 0xfc4cb4 0x8be9fe 0xededec 0xebece6 0x1e1f29 0xe4e4e4 +SoftServer 0x000000 0xa2686a 0x9aa56a 0xa3906a 0x6b8fa3 0x6a71a3 0x6ba58f 0x99a3a2 0x666c6c 0xdd5c60 0xbfdf55 0xdeb360 0x62b1df 0x606edf 0x64e39c 0xd2e0de 0x99a3a2 0x242626 0xd2e0de +SolarizedDarcula 0x25292a 0xf24840 0x629655 0xb68800 0x2075c7 0x797fd4 0x15968d 0xd2d8d9 0x25292a 0xf24840 0x629655 0xb68800 0x2075c7 0x797fd4 0x15968d 0xd2d8d9 0xd2d8d9 0x3d3f41 0x708284 +SolarizedDark-Patched 0x002831 0xd11c24 0x738a05 0xa57706 0x2176c7 0xc61c6f 0x259286 0xeae3cb 0x475b62 0xbd3613 0x475b62 0x536870 0x708284 0x5956ba 0x819090 0xfcf4dc 0x708284 0x001e27 0x708284 +SolarizedDarkHigherContrast 0x002831 0xd11c24 0x6cbe6c 0xa57706 0x2176c7 0xc61c6f 0x259286 0xeae3cb 0x006488 0xf5163b 0x51ef84 0xb27e28 0x178ec8 0xe24d8e 0x00b39e 0xfcf4dc 0x9cc2c3 0x001e27 0xf34b00 +SpaceGrayEightiesDull 0x15171c 0xb24a56 0x92b477 0xc6735a 0x7c8fa5 0xa5789e 0x80cdcb 0xb3b8c3 0x555555 0xec5f67 0x89e986 0xfec254 0x5486c0 0xbf83c1 0x58c2c1 0xffffff 0xc9c6bc 0x222222 0xbbbbbb +SpaceGrayEighties 0x15171c 0xec5f67 0x81a764 0xfec254 0x5486c0 0xbf83c1 0x57c2c1 0xefece7 0x555555 0xff6973 0x93d493 0xffd256 0x4d84d1 0xff55ff 0x83e9e4 0xffffff 0xbdbaae 0x222222 0xbbbbbb +SpaceGray 0x000000 0xb04b57 0x87b379 0xe5c179 0x7d8fa4 0xa47996 0x85a7a5 0xb3b8c3 0x000000 0xb04b57 0x87b379 0xe5c179 0x7d8fa4 0xa47996 0x85a7a5 0xffffff 0xb3b8c3 0x20242d 0xb3b8c3 +Spacedust 0x6e5346 0xe35b00 0x5cab96 0xe3cd7b 0x0f548b 0xe35b00 0x06afc7 0xf0f1ce 0x684c31 0xff8a3a 0xaecab8 0xffc878 0x67a0ce 0xff8a3a 0x83a7b4 0xfefff1 0xecf0c1 0x0a1e24 0x708284 +Spiderman 0x1b1d1e 0xe60813 0xe22928 0xe24756 0x2c3fff 0x2435db 0x3256ff 0xfffef6 0x505354 0xff0325 0xff3338 0xfe3a35 0x1d50ff 0x747cff 0x6184ff 0xfffff9 0xe3e3e3 0x1b1d1e 0x2c3fff +Spring 0x000000 0xff4d83 0x1f8c3b 0x1fc95b 0x1dd3ee 0x8959a8 0x3e999f 0xffffff 0x000000 0xff0021 0x1fc231 0xd5b807 0x15a9fd 0x8959a8 0x3e999f 0xffffff 0x4d4d4c 0xffffff 0x4d4d4c +Square 0x050505 0xe9897c 0xb6377d 0xecebbe 0xa9cdeb 0x75507b 0xc9caec 0xf2f2f2 0x141414 0xf99286 0xc3f786 0xfcfbcc 0xb6defb 0xad7fa8 0xd7d9fc 0xe2e2e2 0xacacab 0x1a1a1a 0xfcfbcc +Sublette 0x253045 0xee5577 0x55ee77 0xffdd88 0x5588ff 0xff77cc 0x44eeee 0xf5f5da 0x405570 0xee6655 0x99ee77 0xffff77 0x77bbff 0xaa88ff 0x55ffbb 0xffffee 0xccced0 0x202535 0xccced0 +Subliminal 0x7f7f7f 0xe15a60 0xa9cfa4 0xffe2a9 0x6699cc 0xf1a5ab 0x5fb3b3 0xd4d4d4 0x7f7f7f 0xe15a60 0xa9cfa4 0xffe2a9 0x6699cc 0xf1a5ab 0x5fb3b3 0xd4d4d4 0xd4d4d4 0x282c35 0xc7c7c7 +Sugarplum 0x111147 0x5ca8dc 0x53b397 0x249a84 0xdb7ddd 0xd0beee 0xf9f3f9 0xa175d4 0x111147 0x5cb5dc 0x52deb5 0x01f5c7 0xfa5dfd 0xc6a5fd 0xffffff 0xb577fd 0xdb7ddd 0x111147 0x53b397 +Sundried 0x302b2a 0xa7463d 0x587744 0x9d602a 0x485b98 0x864651 0x9c814f 0xc9c9c9 0x4d4e48 0xaa000c 0x128c21 0xfc6a21 0x7999f7 0xfd8aa1 0xfad484 0xffffff 0xc9c9c9 0x1a1818 0xffffff +Symfonic 0x000000 0xdc322f 0x56db3a 0xff8400 0x0084d4 0xb729d9 0xccccff 0xffffff 0x1b1d21 0xdc322f 0x56db3a 0xff8400 0x0084d4 0xb729d9 0xccccff 0xffffff 0xffffff 0x000000 0xdc322f +SynthwaveAlpha 0x241b30 0xe60a70 0x00986c 0xadad3e 0x6e29ad 0xb300ad 0x00b0b1 0xb9b1bc 0x7f7094 0xe60a70 0x0ae4a4 0xf9f972 0xaa54f9 0xff00f6 0x00fbfd 0xf2f2e3 0xf2f2e3 0x241b30 0xf2f2e3 +TangoAdapted 0x000000 0xff0000 0x59d600 0xf0cb00 0x00a2ff 0xc17ecc 0x00d0d6 0xe6ebe1 0x8f928b 0xff0013 0x93ff00 0xfff121 0x88c9ff 0xe9a7e1 0x00feff 0xf6f6f4 0x000000 0xffffff 0x000000 +TangoHalfAdapted 0x000000 0xff0000 0x4cc300 0xe2c000 0x008ef6 0xa96cb3 0x00bdc3 0xe0e5db 0x797d76 0xff0013 0x8af600 0xffec00 0x76bfff 0xd898d1 0x00f6fa 0xf4f4f2 0x000000 0xffffff 0x000000 +Teerb 0x1c1c1c 0xd68686 0xaed686 0xd7af87 0x86aed6 0xd6aed6 0x8adbb4 0xd0d0d0 0x1c1c1c 0xd68686 0xaed686 0xe4c9af 0x86aed6 0xd6aed6 0xb1e7dd 0xefefef 0xd0d0d0 0x262626 0xe4c9af +TerminalBasic 0x000000 0x990000 0x00a600 0x999900 0x0000b2 0xb200b2 0x00a6b2 0xbfbfbf 0x666666 0xe50000 0x00d900 0xe5e500 0x0000ff 0xe500e5 0x00e5e5 0xe5e5e5 0x000000 0xffffff 0x7f7f7f +ThayerBright 0x1b1d1e 0xf92672 0x4df840 0xf4fd22 0x2757d6 0x8c54fe 0x38c8b5 0xccccc6 0x505354 0xff5995 0xb6e354 0xfeed6c 0x3f78ff 0x9e6ffe 0x23cfd5 0xf8f8f2 0xf8f8f8 0x1b1d1e 0xfc971f +TheHulk 0x1b1d1e 0x269d1b 0x13ce30 0x63e457 0x2525f5 0x641f74 0x378ca9 0xd9d8d1 0x505354 0x8dff2a 0x48ff77 0x3afe16 0x506b95 0x72589d 0x4085a6 0xe5e6e1 0xb5b5b5 0x1b1d1e 0x16b61b +TinaciousDesign(Dark) 0x1d1d26 0xff3399 0x00d364 0xffcc66 0x00cbff 0xcc66ff 0x00ceca 0xcbcbf0 0x636667 0xff2f92 0x00d364 0xffd479 0x00cbff 0xd783ff 0x00d5d4 0xd5d6f3 0xcbcbf0 0x1d1d26 0xcbcbf0 +TinaciousDesign(Light) 0x1d1d26 0xff3399 0x00d364 0xffcc66 0x00cbff 0xcc66ff 0x00ceca 0xcbcbf0 0x636667 0xff2f92 0x00d364 0xffd479 0x00cbff 0xd783ff 0x00d5d4 0xd5d6f3 0x1d1d26 0xf8f8ff 0xcbcbf0 +TomorrowNightBlue 0x000000 0xff9da4 0xd1f1a9 0xffeead 0xbbdaff 0xebbbff 0x99ffff 0xffffff 0x000000 0xff9da4 0xd1f1a9 0xffeead 0xbbdaff 0xebbbff 0x99ffff 0xffffff 0xffffff 0x002451 0xffffff +TomorrowNightBright 0x000000 0xd54e53 0xb9ca4a 0xe7c547 0x7aa6da 0xc397d8 0x70c0b1 0xffffff 0x000000 0xd54e53 0xb9ca4a 0xe7c547 0x7aa6da 0xc397d8 0x70c0b1 0xffffff 0xeaeaea 0x000000 0xeaeaea +TomorrowNightBurns 0x252525 0x832e31 0xa63c40 0xd3494e 0xfc595f 0xdf9395 0xba8586 0xf5f5f5 0x5d6f71 0x832e31 0xa63c40 0xd2494e 0xfc595f 0xdf9395 0xba8586 0xf5f5f5 0xa1b0b8 0x151515 0xff443e +TomorrowNightEighties 0x000000 0xf2777a 0x99cc99 0xffcc66 0x6699cc 0xcc99cc 0x66cccc 0xffffff 0x000000 0xf2777a 0x99cc99 0xffcc66 0x6699cc 0xcc99cc 0x66cccc 0xffffff 0xcccccc 0x2d2d2d 0xcccccc +TomorrowNight 0x000000 0xcc6666 0xb5bd68 0xf0c674 0x81a2be 0xb294bb 0x8abeb7 0xffffff 0x000000 0xcc6666 0xb5bd68 0xf0c674 0x81a2be 0xb294bb 0x8abeb7 0xffffff 0xc5c8c6 0x1d1f21 0xc5c8c6 +Tomorrow 0x000000 0xc82829 0x718c00 0xeab700 0x4271ae 0x8959a8 0x3e999f 0xffffff 0x000000 0xc82829 0x718c00 0xeab700 0x4271ae 0x8959a8 0x3e999f 0xffffff 0x4d4d4c 0xffffff 0x4d4d4c +ToyChest 0x2c3f58 0xbe2d26 0x1a9172 0xdb8e27 0x325d96 0x8a5edc 0x35a08f 0x23d183 0x336889 0xdd5944 0x31d07b 0xe7d84b 0x34a6da 0xae6bdc 0x42c3ae 0xd5d5d5 0x31d07b 0x24364b 0xd5d5d5 +Treehouse 0x321300 0xb2270e 0x44a900 0xaa820c 0x58859a 0x97363d 0xb25a1e 0x786b53 0x433626 0xed5d20 0x55f238 0xf2b732 0x85cfed 0xe14c5a 0xf07d14 0xffc800 0x786b53 0x191919 0xfac814 +Twilight 0x141414 0xc06d44 0xafb97a 0xc2a86c 0x44474a 0xb4be7c 0x778385 0xffffd4 0x262626 0xde7c4c 0xccd88c 0xe2c47e 0x5a5e62 0xd0dc8e 0x8a989b 0xffffd4 0xffffd4 0x141414 0xffffff +Ubuntu 0x2e3436 0xcc0000 0x4e9a06 0xc4a000 0x3465a4 0x75507b 0x06989a 0xd3d7cf 0x555753 0xef2929 0x8ae234 0xfce94f 0x729fcf 0xad7fa8 0x34e2e2 0xeeeeec 0xeeeeec 0x300a24 0xbbbbbb +UltraDark 0x000000 0xf07178 0xc3e88d 0xffcb6b 0x82aaff 0xc792ea 0x89ddff 0xcccccc 0x333333 0xf6a9ae 0xdbf1ba 0xffdfa6 0xb4ccff 0xddbdf2 0xb8eaff 0xffffff 0xffffff 0x000000 0xfefefe +UltraViolent 0x242728 0xff0090 0xb6ff00 0xfff727 0x47e0fb 0xd731ff 0x0effbb 0xe1e1e1 0x636667 0xfb58b4 0xdeff8c 0xebe087 0x7fecff 0xe681ff 0x69fcd3 0xf9f9f5 0xc1c1c1 0x242728 0xc1c1c1 +UnderTheSea 0x022026 0xb2302d 0x00a941 0x59819c 0x459a86 0x00599d 0x5d7e19 0x405555 0x384451 0xff4242 0x2aea5e 0x8ed4fd 0x61d5ba 0x1298ff 0x98d028 0x58fbd6 0xffffff 0x011116 0x4afcd6 +Unikitty 0x0c0c0c 0xa80f20 0xbafc8b 0xeedf4b 0x145fcd 0xff36a2 0x6bd1bc 0xe2d7e1 0x434343 0xd91329 0xd3ffaf 0xffef50 0x0075ea 0xfdd5e5 0x79ecd5 0xfff3fe 0x0b0b0b 0xff8cd9 0xbafc8b +Urple 0x000000 0xb0425b 0x37a415 0xad5c42 0x564d9b 0x6c3ca1 0x808080 0x87799c 0x5d3225 0xff6388 0x29e620 0xf08161 0x867aed 0xa05eee 0xeaeaea 0xbfa3ff 0x877a9b 0x1b1b23 0xa063eb +Vaughn 0x25234f 0x705050 0x60b48a 0xdfaf8f 0x5555ff 0xf08cc3 0x8cd0d3 0x709080 0x709080 0xdca3a3 0x60b48a 0xf0dfaf 0x5555ff 0xec93d3 0x93e0e3 0xffffff 0xdcdccc 0x25234f 0xff5555 +VibrantInk 0x878787 0xff6600 0xccff04 0xffcc00 0x44b4cc 0x9933cc 0x44b4cc 0xf5f5f5 0x555555 0xff0000 0x00ff00 0xffff00 0x0000ff 0xff00ff 0x00ffff 0xe5e5e5 0xffffff 0x000000 0xffffff +VioletDark 0x56595c 0xc94c22 0x85981c 0xb4881d 0x2e8bce 0xd13a82 0x32a198 0xc9c6bd 0x45484b 0xbd3613 0x738a04 0xa57705 0x2176c7 0xc61c6f 0x259286 0xc9c6bd 0x708284 0x1c1d1f 0x708284 +VioletLight 0x56595c 0xc94c22 0x85981c 0xb4881d 0x2e8bce 0xd13a82 0x32a198 0xd3d0c9 0x45484b 0xbd3613 0x738a04 0xa57705 0x2176c7 0xc61c6f 0x259286 0xc9c6bd 0x536870 0xfcf4dc 0x536870 +WarmNeon 0x000000 0xe24346 0x39b13a 0xdae145 0x4261c5 0xf920fb 0x2abbd4 0xd0b8a3 0xfefcfc 0xe97071 0x9cc090 0xddda7a 0x7b91d6 0xf674ba 0x5ed1e5 0xd8c8bb 0xafdab6 0x404040 0x30ff24 +Wez 0x000000 0xcc5555 0x55cc55 0xcdcd55 0x5555cc 0xcc55cc 0x7acaca 0xcccccc 0x555555 0xff5555 0x55ff55 0xffff55 0x5555ff 0xff55ff 0x55ffff 0xffffff 0xb3b3b3 0x000000 0x53ae71 +Whimsy 0x535178 0xef6487 0x5eca89 0xfdd877 0x65aef7 0xaa7ff0 0x43c1be 0xffffff 0x535178 0xef6487 0x5eca89 0xfdd877 0x65aef7 0xaa7ff0 0x43c1be 0xffffff 0xb3b0d6 0x29283b 0xb3b0d6 +WildCherry 0x000507 0xd94085 0x2ab250 0xffd16f 0x883cdc 0xececec 0xc1b8b7 0xfff8de 0x009cc9 0xda6bac 0xf4dca5 0xeac066 0x308cba 0xae636b 0xff919d 0xe4838d 0xdafaff 0x1f1726 0xdd00ff +Wombat 0x000000 0xff615a 0xb1e969 0xebd99c 0x5da9f6 0xe86aff 0x82fff7 0xdedacf 0x313131 0xf58c80 0xddf88f 0xeee5b2 0xa5c7ff 0xddaaff 0xb7fff9 0xffffff 0xdedacf 0x171717 0xbbbbbb +Wryan 0x333333 0x8c4665 0x287373 0x7c7c99 0x395573 0x5e468c 0x31658c 0x899ca1 0x3d3d3d 0xbf4d80 0x53a6a6 0x9e9ecb 0x477ab3 0x7e62b3 0x6096bf 0xc0c0c0 0x999993 0x101010 0x9e9ecb +Zenburn 0x4d4d4d 0x705050 0x60b48a 0xf0dfaf 0x506070 0xdc8cc3 0x8cd0d3 0xdcdccc 0x709080 0xdca3a3 0xc3bf9f 0xe0cf9f 0x94bff3 0xec93d3 0x93e0e3 0xffffff 0xdcdccc 0x3f3f3f 0x73635a +arcoiris 0x333333 0xda2700 0x12c258 0xffc656 0x518bfc 0xe37bd9 0x63fad5 0xbab2b2 0x777777 0xffb9b9 0xe3f6aa 0xffddaa 0xb3e8f3 0xcbbaf9 0xbcffc7 0xefefef 0xeee4d9 0x201f1e 0x7a1c1c +ayu 0x000000 0xff3333 0xb8cc52 0xe7c547 0x36a3d9 0xf07178 0x95e6cb 0xffffff 0x323232 0xff6565 0xeafe84 0xfff779 0x68d5ff 0xffa3aa 0xc7fffd 0xffffff 0xe6e1cf 0x0f1419 0xf29718 +ayu_light 0x000000 0xff3333 0x86b300 0xf29718 0x41a6d9 0xf07178 0x4dbf99 0xffffff 0x323232 0xff6565 0xb8e532 0xffc94a 0x73d8ff 0xffa3aa 0x7ff1cb 0xffffff 0x5c6773 0xfafafa 0xff6a00 +catppuccin-frappe 0x51576d 0xe78284 0xa6d189 0xe5c890 0x8caaee 0xf4b8e4 0x81c8be 0xb5bfe2 0x626880 0xe78284 0xa6d189 0xe5c890 0x8caaee 0xf4b8e4 0x81c8be 0xa5adce 0xc6d0f5 0x303446 0xf2d5cf +catppuccin-latte 0x5c5f77 0xd20f39 0x40a02b 0xdf8e1d 0x1e66f5 0xea76cb 0x179299 0xacb0be 0x6c6f85 0xd20f39 0x40a02b 0xdf8e1d 0x1e66f5 0xea76cb 0x179299 0xbcc0cc 0x4c4f69 0xeff1f5 0xdc8a78 +catppuccin-macchiato 0x494d64 0xed8796 0xa6da95 0xeed49f 0x8aadf4 0xf5bde6 0x8bd5ca 0xb8c0e0 0x5b6078 0xed8796 0xa6da95 0xeed49f 0x8aadf4 0xf5bde6 0x8bd5ca 0xa5adcb 0xcad3f5 0x24273a 0xf4dbd6 +catppuccin-mocha 0x45475a 0xf38ba8 0xa6e3a1 0xf9e2af 0x89b4fa 0xf5c2e7 0x94e2d5 0xbac2de 0x585b70 0xf38ba8 0xa6e3a1 0xf9e2af 0x89b4fa 0xf5c2e7 0x94e2d5 0xa6adc8 0xcdd6f4 0x1e1e2e 0xf5e0dc +coffee_theme 0x000000 0xc91b00 0x00c200 0xc7c400 0x0225c7 0xca30c7 0x00c5c7 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xff77ff 0x60fdff 0xffffff 0x000000 0xf5deb3 0xc7c7c7 +cyberpunk 0x000000 0xff7092 0x00fbac 0xfffa6a 0x00bfff 0xdf95ff 0x86cbfe 0xffffff 0x000000 0xff8aa4 0x21f6bc 0xfff787 0x1bccfd 0xe6aefe 0x99d6fc 0xffffff 0xe5e5e5 0x332a57 0x21f6bc +darkermatrix 0x091013 0x002e18 0x6fa64c 0x595900 0x00cb6b 0x412a4d 0x125459 0x002e19 0x333333 0x00381d 0x90d762 0xe2e500 0x00ff87 0x412a4d 0x176c73 0x00381e 0x28380d 0x070c0e 0x373a26 +darkmatrix 0x091013 0x006536 0x6fa64c 0x7e8000 0x2c9a84 0x452d53 0x114d53 0x006536 0x333333 0x00733d 0x90d762 0xe2e500 0x46d8b8 0x4a3059 0x12545a 0x006536 0x3e5715 0x070c0e 0x9fa86e +dayfox 0x352c24 0xa5222f 0x396847 0xac5402 0x2848a9 0x6e33ce 0x287980 0xf2e9e1 0x534c45 0xb3434e 0x577f63 0xb86e28 0x4863b6 0x8452d5 0x488d93 0xf4ece6 0x3d2b5a 0xf6f2ee 0x3d2b5a +deep 0x000000 0xd70005 0x1cd915 0xd9bd26 0x5665ff 0xb052da 0x50d2da 0xe0e0e0 0x535353 0xfb0007 0x22ff18 0xfedc2b 0x9fa9ff 0xe09aff 0x8df9ff 0xffffff 0xcdcdcd 0x090909 0xd0d0d0 +duckbones 0x0e101a 0xe03600 0x5dcd97 0xe39500 0x00a3cb 0x795ccc 0x00a3cb 0xebefc0 0x2b2f46 0xff4821 0x58db9e 0xf6a100 0x00b4e0 0xb3a1e6 0x00b4e0 0xb3b692 0xebefc0 0x0e101a 0xedf2c2 +farmhouse-dark 0x1d2027 0xba0004 0x549d00 0xc87300 0x0049e6 0x9f1b61 0x1fb65c 0xe8e4e1 0x394047 0xeb0009 0x7ac100 0xea9a00 0x006efe 0xbf3b7f 0x19e062 0xf4eef0 0xe8e4e1 0x1d2027 0x006efe +farmhouse-light 0x1d2027 0x8d0003 0x3a7d00 0xa95600 0x092ccd 0x820046 0x229256 0xe8e4e1 0x394047 0xeb0009 0x7ac100 0xea9a00 0x006efe 0xbf3b7f 0x19e062 0xf4eef0 0x1d2027 0xe8e4e1 0x006efe +flexoki-dark 0x1c1b1a 0xd14d41 0x879a39 0xd0a215 0x4385be 0xce5d97 0x3aa99f 0xb7b5ac 0x575653 0xd14d41 0x879a39 0xd0a215 0x4385be 0xce5d97 0x3aa99f 0xcecdc3 0xcecdc3 0x1c1b1a 0xcecdc3 +flexoki-light 0x100f0f 0xaf3029 0x66800b 0xad8301 0x205ea6 0xa02f6f 0x24837b 0xf2f0e5 0x575653 0xd14d41 0x879a39 0xd0a215 0x4385be 0xce5d97 0x3aa99f 0xfffcf0 0x100f0f 0xfffcf0 0x100f0f +iTerm2DarkBackground 0x000000 0xc91b00 0x00c200 0xc7c400 0x0225c7 0xca30c7 0x00c5c7 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xff77ff 0x60fdff 0xffffff 0xc7c7c7 0x000000 0xc7c7c7 +iTerm2Default 0x000000 0xc91b00 0x00c200 0xc7c400 0x2225c4 0xca30c7 0x00c5c7 0xffffff 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xff77ff 0x60fdff 0xffffff 0xffffff 0x000000 0xe5e5e5 +iTerm2LightBackground 0x000000 0xc91b00 0x00c200 0xc7c400 0x0225c7 0xca30c7 0x00c5c7 0xc7c7c7 0x686868 0xff6e67 0x5ffa68 0xfffc67 0x6871ff 0xff77ff 0x60fdff 0xffffff 0x000000 0xffffff 0x000000 +iTerm2PastelDarkBackground 0x626262 0xff8373 0xb4fb73 0xfffdc3 0xa5d5fe 0xff90fe 0xd1d1fe 0xf1f1f1 0x8f8f8f 0xffc4be 0xd6fcba 0xfffed5 0xc2e3ff 0xffb2fe 0xe6e6fe 0xffffff 0xc7c7c7 0x000000 0xffb473 +iTerm2Smoooooth 0x14191e 0xb43c2a 0x00c200 0xc7c400 0x2744c7 0xc040be 0x00c5c7 0xc7c7c7 0x686868 0xdd7975 0x58e790 0xece100 0xa7abf2 0xe17ee1 0x60fdff 0xffffff 0xdcdcdc 0x15191f 0xffffff +iTerm2SolarizedDark 0x073642 0xdc322f 0x859900 0xb58900 0x268bd2 0xd33682 0x2aa198 0xeee8d5 0x002b36 0xcb4b16 0x586e75 0x657b83 0x839496 0x6c71c4 0x93a1a1 0xfdf6e3 0x839496 0x002b36 0x839496 +iTerm2SolarizedLight 0x073642 0xdc322f 0x859900 0xb58900 0x268bd2 0xd33682 0x2aa198 0xeee8d5 0x002b36 0xcb4b16 0x586e75 0x657b83 0x839496 0x6c71c4 0x93a1a1 0xfdf6e3 0x657b83 0xfdf6e3 0x657b83 +iTerm2TangoDark 0x000000 0xd81e00 0x5ea702 0xcfae00 0x427ab3 0x89658e 0x00a7aa 0xdbded8 0x686a66 0xf54235 0x99e343 0xfdeb61 0x84b0d8 0xbc94b7 0x37e6e8 0xf1f1f0 0xffffff 0x000000 0xffffff +iTerm2TangoLight 0x000000 0xd81e00 0x5ea702 0xcfae00 0x427ab3 0x89658e 0x00a7aa 0xdbded8 0x686a66 0xf54235 0x99e343 0xfdeb61 0x84b0d8 0xbc94b7 0x37e6e8 0xf1f1f0 0x000000 0xffffff 0x000000 +iceberg-dark 0x1e2132 0xe27878 0xb4be82 0xe2a478 0x84a0c6 0xa093c7 0x89b8c2 0xc6c8d1 0x6b7089 0xe98989 0xc0ca8e 0xe9b189 0x91acd1 0xada0d3 0x95c4ce 0xd2d4de 0xc6c8d1 0x161821 0xc6c8d1 +iceberg-light 0xdcdfe7 0xcc517a 0x668e3d 0xc57339 0x2d539e 0x7759b4 0x3f83a6 0x33374c 0x8389a3 0xcc3768 0x598030 0xb6662d 0x22478e 0x6845ad 0x327698 0x262a3f 0x33374c 0xe8e9ec 0x33374c +idea 0xadadad 0xfc5256 0x98b61c 0xccb444 0x437ee7 0x9d74b0 0x248887 0x181818 0xffffff 0xfc7072 0x98b61c 0xffff0b 0x6c9ced 0xfc7eff 0x248887 0x181818 0xadadad 0x202020 0xbbbbbb +idleToes 0x323232 0xd25252 0x7fe173 0xffc66d 0x4099ff 0xf680ff 0xbed6ff 0xeeeeec 0x535353 0xf07070 0x9dff91 0xffe48b 0x5eb7f7 0xff9dff 0xdcf4ff 0xffffff 0xffffff 0x323232 0xd6d6d6 +jubi 0x3b3750 0xcf7b98 0x90a94b 0x6ebfc0 0x576ea6 0xbc4f68 0x75a7d2 0xc3d3de 0xa874ce 0xde90ab 0xbcdd61 0x87e9ea 0x8c9fcd 0xe16c87 0xb7c9ef 0xd5e5f1 0xc3d3de 0x262b33 0xc3d3de +kanagawabones 0x1f1f28 0xe46a78 0x98bc6d 0xe5c283 0x7eb3c9 0x957fb8 0x7eb3c9 0xddd8bb 0x3c3c51 0xec818c 0x9ec967 0xf1c982 0x7bc2df 0xa98fd2 0x7bc2df 0xa8a48d 0xddd8bb 0x1f1f28 0xe6e0c2 +kurokula 0x333333 0xb66056 0x85b1a9 0xdbbb43 0x6890d7 0x887aa3 0x837369 0xddd0c4 0x515151 0xffc663 0xc1ffae 0xfff700 0xa1d9ff 0xa994ff 0xf9cfb9 0xffffff 0xddd0c4 0x141515 0x702420 +lovelace 0x282a36 0xf37f97 0x5adecd 0xf2a272 0x8897f4 0xc574dd 0x79e6f3 0xfdfdfd 0x414458 0xff4971 0x18e3c8 0xff8037 0x556fff 0xb043d1 0x3fdcee 0xbebec1 0xfdfdfd 0x1d1f28 0xc574dd +matrix 0x0f191c 0x23755a 0x82d967 0xffd700 0x3f5242 0x409931 0x50b45a 0x507350 0x688060 0x2fc079 0x90d762 0xfaff00 0x4f7e7e 0x11ff25 0xc1ff8a 0x678c61 0x426644 0x0f191c 0x384545 +midnight-in-mojave 0x1e1e1e 0xff453a 0x32d74b 0xffd60a 0x0a84ff 0xbf5af2 0x5ac8fa 0xffffff 0x1e1e1e 0xff453a 0x32d74b 0xffd60a 0x0a84ff 0xbf5af2 0x5ac8fa 0xffffff 0xffffff 0x1e1e1e 0x32d74b +neobones_dark 0x0f191f 0xde6e7c 0x90ff6b 0xb77e64 0x8190d4 0xb279a7 0x66a5ad 0xc6d5cf 0x263945 0xe8838f 0xa0ff85 0xd68c67 0x92a0e2 0xcf86c1 0x65b8c1 0x98a39e 0xc6d5cf 0x0f191f 0xceddd7 +neobones_light 0xe5ede6 0xa8334c 0x567a30 0x944927 0x286486 0x88507d 0x3b8992 0x202e18 0xb3c6b6 0x94253e 0x3f5a22 0x803d1c 0x1d5573 0x7b3b70 0x2b747c 0x415934 0x202e18 0xe5ede6 0x202e18 +nightfox 0x393b44 0xc94f6d 0x81b29a 0xdbc074 0x719cd6 0x9d79d6 0x63cdcf 0xdfdfe0 0x575860 0xd16983 0x8ebaa4 0xe0c989 0x86abdc 0xbaa1e2 0x7ad5d6 0xe4e4e5 0xcdcecf 0x192330 0xcdcecf +niji 0x333333 0xd23e08 0x54ca74 0xfff700 0x2ab9ff 0xff50da 0x1ef9f5 0xddd0c4 0x515151 0xffb7b7 0xc1ffae 0xfcffb8 0x8efff3 0xffa2ed 0xbcffc7 0xffffff 0xffffff 0x141515 0xffc663 +nord-light 0x3b4252 0xbf616a 0xa3be8c 0xebcb8b 0x81a1c1 0xb48ead 0x88c0d0 0xd8dee9 0x4c566a 0xbf616a 0xa3be8c 0xebcb8b 0x81a1c1 0xb48ead 0x8fbcbb 0xeceff4 0x414858 0xe5e9f0 0x88c0d0 +nord 0x3b4252 0xbf616a 0xa3be8c 0xebcb8b 0x81a1c1 0xb48ead 0x88c0d0 0xe5e9f0 0x4c566a 0xbf616a 0xa3be8c 0xebcb8b 0x81a1c1 0xb48ead 0x8fbcbb 0xeceff4 0xd8dee9 0x2e3440 0xeceff4 +primary 0x000000 0xdb4437 0x0f9d58 0xf4b400 0x4285f4 0xdb4437 0x4285f4 0xffffff 0x000000 0xdb4437 0x0f9d58 0xf4b400 0x4285f4 0x4285f4 0x0f9d58 0xffffff 0x000000 0xffffff 0x000000 +purplepeter 0x0a0520 0xff796d 0x99b481 0xefdfac 0x66d9ef 0xe78fcd 0xba8cff 0xffba81 0x100b23 0xf99f92 0xb4be8f 0xf2e9bf 0x79daed 0xba91d4 0xa0a0d6 0xb9aed3 0xece7fa 0x2a1a4a 0xc7c7c7 +rebecca 0x12131e 0xdd7755 0x04dbb5 0xf2e7b7 0x7aa5ff 0xbf9cf9 0x56d3c2 0xe4e3e9 0x666699 0xff92cd 0x01eac0 0xfffca8 0x69c0fa 0xc17ff8 0x8bfde1 0xf4f2f9 0xe8e6ed 0x292a44 0xb89bf9 +rose-pine-dawn 0xf2e9e1 0xb4637a 0x56949f 0xea9d34 0x286983 0x907aa9 0xd7827e 0x575279 0x9893a5 0xb4637a 0x56949f 0xea9d34 0x286983 0x907aa9 0xd7827e 0x575279 0x575279 0xfaf4ed 0x575279 +rose-pine-moon 0x393552 0xeb6f92 0x9ccfd8 0xf6c177 0x3e8fb0 0xc4a7e7 0xea9a97 0xe0def4 0x6e6a86 0xeb6f92 0x9ccfd8 0xf6c177 0x3e8fb0 0xc4a7e7 0xea9a97 0xe0def4 0xe0def4 0x232136 0xe0def4 +rose-pine 0x26233a 0xeb6f92 0x9ccfd8 0xf6c177 0x31748f 0xc4a7e7 0xebbcba 0xe0def4 0x6e6a86 0xeb6f92 0x9ccfd8 0xf6c177 0x31748f 0xc4a7e7 0xebbcba 0xe0def4 0xe0def4 0x191724 0xe0def4 +seoulbones_dark 0x4b4b4b 0xe388a3 0x98bd99 0xffdf9b 0x97bdde 0xa5a6c5 0x6fbdbe 0xdddddd 0x6c6465 0xeb99b1 0x8fcd92 0xffe5b3 0xa2c8e9 0xb2b3da 0x6bcacb 0xa8a8a8 0xdddddd 0x4b4b4b 0xe2e2e2 +seoulbones_light 0xe2e2e2 0xdc5284 0x628562 0xc48562 0x0084a3 0x896788 0x008586 0x555555 0xbfbabb 0xbe3c6d 0x487249 0xa76b48 0x006f89 0x7f4c7e 0x006f70 0x777777 0x555555 0xe2e2e2 0x555555 +shades-of-purple 0x000000 0xd90429 0x3ad900 0xffe700 0x6943ff 0xff2c70 0x00c5c7 0xc7c7c7 0x686868 0xf92a1c 0x43d426 0xf1d000 0x6871ff 0xff77ff 0x79e8fb 0xffffff 0xffffff 0x1e1d40 0xfad000 +synthwave-everything 0xfefefe 0xf97e72 0x72f1b8 0xfede5d 0x6d77b3 0xc792ea 0xf772e0 0xfefefe 0xfefefe 0xf88414 0x72f1b8 0xfff951 0x36f9f6 0xe1acff 0xf92aad 0xfefefe 0xf0eff1 0x2a2139 0x72f1b8 +synthwave 0x000000 0xf6188f 0x1ebb2b 0xfdf834 0x2186ec 0xf85a21 0x12c3e2 0xffffff 0x000000 0xf841a0 0x25c141 0xfdf454 0x2f9ded 0xf97137 0x19cde6 0xffffff 0xdad9c7 0x000000 0x19cde6 +terafox 0x2f3239 0xe85c51 0x7aa4a1 0xfda47f 0x5a93aa 0xad5c7c 0xa1cdd8 0xebebeb 0x4e5157 0xeb746b 0x8eb2af 0xfdb292 0x73a3b7 0xb97490 0xafd4de 0xeeeeee 0xe6eaea 0x152528 0xe6eaea +tokyonight-day 0xe9e9ed 0xf52a65 0x587539 0x8c6c3e 0x2e7de9 0x9854f1 0x007197 0x6172b0 0xa1a6c5 0xf52a65 0x587539 0x8c6c3e 0x2e7de9 0x9854f1 0x007197 0x3760bf 0x3760bf 0xe1e2e7 0x3760bf +tokyonight-storm 0x1d202f 0xf7768e 0x9ece6a 0xe0af68 0x7aa2f7 0xbb9af7 0x7dcfff 0xa9b1d6 0x414868 0xf7768e 0x9ece6a 0xe0af68 0x7aa2f7 0xbb9af7 0x7dcfff 0xc0caf5 0xc0caf5 0x24283b 0xc0caf5 +tokyonight 0x15161e 0xf7768e 0x9ece6a 0xe0af68 0x7aa2f7 0xbb9af7 0x7dcfff 0xa9b1d6 0x414868 0xf7768e 0x9ece6a 0xe0af68 0x7aa2f7 0xbb9af7 0x7dcfff 0xc0caf5 0xc0caf5 0x1a1b26 0xc0caf5 +vesper 0x101010 0xf5a191 0x90b99f 0xe6b99d 0xaca1cf 0xe29eca 0xea83a5 0xa0a0a0 0x7e7e7e 0xff8080 0x99ffe4 0xffc799 0xb9aeda 0xecaad6 0xf591b2 0xffffff 0xffffff 0x101010 0xacb1ab +vimbones 0xf0f0ca 0xa8334c 0x4f6c31 0x944927 0x286486 0x88507d 0x3b8992 0x353535 0xc6c6a3 0x94253e 0x3f5a22 0x803d1c 0x1d5573 0x7b3b70 0x2b747c 0x5c5c5c 0x353535 0xf0f0ca 0x353535 +wilmersdorf 0x34373e 0xe06383 0x7ebebd 0xcccccc 0xa6c1e0 0xe1c1ee 0x5b94ab 0xababab 0x434750 0xfa7193 0x8fd7d6 0xd1dfff 0xb2cff0 0xefccfd 0x69abc5 0xd3d3d3 0xc6c6c6 0x282b33 0x7ebebd +zenbones 0xf0edec 0xa8334c 0x4f6c31 0x944927 0x286486 0x88507d 0x3b8992 0x2c363c 0xcfc1ba 0x94253e 0x3f5a22 0x803d1c 0x1d5573 0x7b3b70 0x2b747c 0x4f5e68 0x2c363c 0xf0edec 0x2c363c +zenbones_dark 0x1c1917 0xde6e7c 0x819b69 0xb77e64 0x6099c0 0xb279a7 0x66a5ad 0xb4bdc3 0x403833 0xe8838f 0x8bae68 0xd68c67 0x61abda 0xcf86c1 0x65b8c1 0x888f94 0xb4bdc3 0x1c1917 0xc4cacf +zenbones_light 0xf0edec 0xa8334c 0x4f6c31 0x944927 0x286486 0x88507d 0x3b8992 0x2c363c 0xcfc1ba 0x94253e 0x3f5a22 0x803d1c 0x1d5573 0x7b3b70 0x2b747c 0x4f5e68 0x2c363c 0xf0edec 0x2c363c +zenburned 0x404040 0xe3716e 0x819b69 0xb77e64 0x6099c0 0xb279a7 0x66a5ad 0xf0e4cf 0x625a5b 0xec8685 0x8bae68 0xd68c67 0x61abda 0xcf86c1 0x65b8c1 0xc0ab86 0xf0e4cf 0x404040 0xf3eadb +zenwritten_dark 0x191919 0xde6e7c 0x819b69 0xb77e64 0x6099c0 0xb279a7 0x66a5ad 0xbbbbbb 0x3d3839 0xe8838f 0x8bae68 0xd68c67 0x61abda 0xcf86c1 0x65b8c1 0x8e8e8e 0xbbbbbb 0x191919 0xc9c9c9 +zenwritten_light 0xeeeeee 0xa8334c 0x4f6c31 0x944927 0x286486 0x88507d 0x3b8992 0x353535 0xc6c3c3 0x94253e 0x3f5a22 0x803d1c 0x1d5573 0x7b3b70 0x2b747c 0x5c5c5c 0x353535 0xeeeeee 0x353535 + +#------------------------------------------------------------------------------ +# SECTION Gogh +# +# The following palettes are generated from http://github.com/Gogh-Co/Gogh. +# The upstream license is MIT. We can download the JSON database from +# https://raw.githubusercontent.com/Gogh-Co/Gogh/master/data/themes.json and +# convert it. These are the Gogh themes that have distinct names from the ones +# defined in iTerm2-Color-Schemes. This table can be generated by the +# following command (where the commands "wget" and "node" are required): +# +# $ make/color.sample.sh convert-gogh-palettes +# + +Aci 0x363636 0xFF0883 0x83FF08 0xFF8308 0x0883FF 0x8308FF 0x08FF83 0xB6B6B6 0x424242 0xFF1E8E 0x8EFF1E 0xFF8E1E 0x1E8EFF 0x8E1EFF 0x1EFF8E 0xC2C2C2 0xB4E1FD 0x0D1926 0xB4E1FD +Aco 0x3F3F3F 0xFF0883 0x83FF08 0xFF8308 0x0883FF 0x8308FF 0x08FF83 0xBEBEBE 0x474747 0xFF1E8E 0x8EFF1E 0xFF8E1E 0x1E8EFF 0x8E1EFF 0x1EFF8E 0xC4C4C4 0xB4E1FD 0x1F1305 0xB4E1FD +Apprentice 0x1C1C1C 0xAF5F5F 0x5F875F 0x87875F 0x5F87AF 0x5F5F87 0x5F8787 0x6C6C6C 0x444444 0xFF8700 0x87AF87 0xFFFFAF 0x8FAFD7 0x8787AF 0x5FAFAF 0xFFFFFF 0xBCBCBC 0x262626 0xBCBCBC +Astrodark 0x111317 0xF8747E 0x75AD47 0xD09214 0x50A4E9 0xCC83E3 0x00B298 0xADB0BB 0x576176 0xFAA5AB 0xA5CD84 0xEFBD58 0x8DC3F1 0xDEAEED 0x27FFDF 0xCACCD3 0x9B9FA9 0x1A1D23 0xCACCD3 +AtelierCave 0xBE4678 0xBE4678 0x2A9292 0xA06E3B 0x576DDB 0xBF40BF 0x398BC6 0xE2DFE7 0x655F6D 0xAA573C 0x2A9292 0xA06E3B 0x955AE7 0xBF40BF 0x398BC6 0xEFECF4 0x7E7887 0x19171C 0x7E7887 +AtelierDune 0xD73737 0xD73737 0x60AC39 0xAE9513 0x6684E1 0xD43552 0x1FAD83 0xE8E4CF 0x7D7A68 0xB65611 0x60AC39 0xAE9513 0xB854D4 0xD43552 0x1FAD83 0xFEFBEC 0x999580 0x20201D 0x999580 +AtelierEstuary 0xBA6236 0xBA6236 0x7D9726 0xA5980D 0x36A166 0x9D6C7C 0x5B9D48 0xE7E6DF 0x6C6B5A 0xAE7313 0x7D9726 0xA5980D 0x5F9182 0x9D6C7C 0x5B9D48 0xF4F3EC 0x878573 0x22221B 0x878573 +AtelierForest 0xF22C40 0xF22C40 0x7B9726 0xC38418 0x407EE7 0xC33FF3 0x3D97B8 0xE6E2E0 0x766E6B 0xDF5320 0x7B9726 0xC38418 0x6666EA 0xC33FF3 0x3D97B8 0xF1EFEE 0x9C9491 0x1B1918 0x9C9491 +AtelierHeath 0xCA402B 0xCA402B 0x918B3B 0xBB8A35 0x516AEC 0xCC33CC 0x159393 0xD8CAD8 0x776977 0xA65926 0x918B3B 0xBB8A35 0x7B59C0 0xCC33CC 0x159393 0xF7F3F7 0x9E8F9E 0x1B181B 0x9E8F9E +AtelierLakeside 0xD22D72 0xD22D72 0x568C3B 0x8A8A0F 0x257FAD 0xB72DD2 0x2D8F6F 0xC1E4F6 0x5A7B8C 0x935C25 0x568C3B 0x8A8A0F 0x6B6BB8 0xB72DD2 0x2D8F6F 0xEBF8FF 0x7195A8 0x161B1D 0x7195A8 +AtelierPlateau 0xCA4949 0xCA4949 0x4B8B8B 0xA06E3B 0x7272CA 0xBD5187 0x5485B6 0xE7DFDF 0x655D5D 0xB45A3C 0x4B8B8B 0xA06E3B 0x8464C4 0xBD5187 0x5485B6 0xF4ECEC 0x7E7777 0x1B1818 0x7E7777 +AtelierSavanna 0xB16139 0xB16139 0x489963 0xA07E3B 0x478C90 0x867469 0x1C9AA0 0xDFE7E2 0x5F6D64 0x9F713C 0x489963 0xA07E3B 0x55859B 0x867469 0x1C9AA0 0xECF4EE 0x78877D 0x171C19 0x78877D +AtelierSeaside 0xE6193C 0xE6193C 0x29A329 0x98981B 0x3D62F5 0xE619C3 0x1999B3 0xCFE8CF 0x687D68 0x87711D 0x29A329 0x98981B 0xAD2BEE 0xE619C3 0x1999B3 0xF4FBF4 0x809980 0x131513 0x809980 +Aura 0x110F18 0xFF6767 0x61FFCA 0xFFCA85 0xA277FF 0xA277FF 0x61FFCA 0xEDECEE 0x6D6D6D 0xFFCA85 0xA277FF 0xFFCA85 0xA277FF 0xA277FF 0x61FFCA 0xEDECEE 0xEDECEE 0x15141B 0xEDECEE +AyuDark 0x0A0E14 0xFF3333 0xC2D94C 0xFF8F40 0x59C2FF 0xFFEE99 0x95E6CB 0xB3B1AD 0x4D5566 0xFF3333 0xC2D94C 0xFF8F40 0x59C2FF 0xFFEE99 0x95E6CB 0xB3B1AD 0xB3B1AD 0x0A0E14 0xE6B450 +AyuLight 0x575F66 0xF51818 0x86B300 0xF2AE49 0x399EE6 0xA37ACC 0x4CBF99 0xFAFAFA 0x8A9199 0xF51818 0x86B300 0xF2AE49 0x399EE6 0xA37ACC 0x4CBF99 0xFAFAFA 0x575F66 0xFAFAFA 0xFF9940 +Azu 0x000000 0xAC6D74 0x74AC6D 0xACA46D 0x6D74AC 0xA46DAC 0x6DACA4 0xE6E6E6 0x262626 0xD6B8BC 0xBCD6B8 0xD6D3B8 0xB8BCD6 0xD3B8D6 0xB8D6D3 0xFFFFFF 0xD9E6F2 0x09111A 0xD9E6F2 +Base2ToneCave 0x222021 0x936c7a 0xcca133 0xffcc4d 0x9c818b 0xcca133 0xd27998 0x9f999b 0x635f60 0xddaf3c 0x2f2d2e 0x565254 0x706b6d 0xf0a8c1 0xc39622 0xffebf2 0x9f999b 0x222021 0x996e00 +Base2ToneDesert 0x292724 0x816f4b 0xec9255 0xffb380 0x957e50 0xec9255 0xac8e53 0xada594 0x7e7767 0xf29d63 0x3d3a34 0x615c51 0x908774 0xddcba6 0xe58748 0xf2ead9 0xada594 0x292724 0xbc672f +Base2ToneDrawbridge 0x1b1f32 0x627af4 0x67c9e4 0x99e9ff 0x7289fd 0x67c9e4 0x8b9efd 0x9094a7 0x51587b 0x75d5f0 0x252a41 0x444b6f 0x5e6587 0xc3cdfe 0x5cbcd6 0xe1e6ff 0x9094a7 0x1b1f32 0x289dbd +Base2ToneEarth 0x322d29 0x816d5f 0xd9b154 0xfcc440 0x88786d 0xd9b154 0x967e6e 0xb5a9a1 0x6a5f58 0xe6b84d 0x3f3a37 0x5b534d 0x796b63 0xdfb99f 0xcda956 0xfff3eb 0xb5a9a1 0x322d29 0x9c8349 +Base2ToneEvening 0x2a2734 0x8a75f5 0xffad5c 0xffcc99 0x9a86fd 0xffad5c 0xafa0fe 0xa4a1b5 0x6c6783 0xffb870 0x363342 0x545167 0x787391 0xd9d2fe 0xffa142 0xeeebff 0xa4a1b5 0x2a2734 0xb37537 +Base2ToneField 0x18201e 0x0fbda0 0x3be381 0x85ffb8 0x25d0b4 0x3be381 0x40ddc3 0x8ea4a0 0x5a6d6a 0x55ec94 0x242e2c 0x42524f 0x667a77 0x88f2e0 0x25d46e 0xa8fff1 0x8ea4a0 0x18201e 0x00943e +Base2ToneForest 0x2a2d2a 0x5c705c 0xbfd454 0xe5fb79 0x687d68 0xbfd454 0x8fae8f 0xa1b5a1 0x535f53 0xcbe25a 0x353b35 0x485148 0x5e6e5e 0xc8e4c8 0xb1c44f 0xf0fff0 0xa1b5a1 0x2a2d2a 0x818b4b +Base2ToneGarden 0x1e1f1e 0x3fac39 0xdb9257 0xe0cab8 0x4cb946 0xdb9257 0x6bcc66 0x969c96 0x5d605c 0xdba070 0x2b2c2a 0x505350 0x696d69 0xb7e3b5 0xdd843c 0xdcf0db 0x969c96 0x1e1f1e 0xbd5d0f +Base2ToneHeath 0x222022 0x8f6c93 0xcc8c33 0xffd599 0x9a819c 0xcc8c33 0xcb79d2 0x9e999f 0x635f63 0xd9b98c 0x2f2d2f 0x575158 0x6f6b70 0xeaa8f0 0xc38022 0xfdebff 0x9e999f 0x222022 0x995900 +Base2ToneLake 0x192d34 0x3e91ac 0xcbbb4d 0xffeb66 0x499fbc 0xcbbb4d 0x62b1cb 0x7ba8b7 0x3d6876 0xd6c65c 0x223c44 0x335966 0x467686 0xa5d8e9 0xc4b031 0xe1f7ff 0x7ba8b7 0x192d34 0x84740b +Base2ToneLavender 0x201d2a 0x9375f5 0xd294ff 0xecd1ff 0xa286fd 0xd294ff 0xb5a0fe 0x9992b0 0x625a7c 0xdba8ff 0x2c2839 0x4b455f 0x6e658b 0xdcd2fe 0xca80ff 0xefebff 0x9992b0 0x201d2a 0xb042ff +Base2ToneMall 0x1e1e1f 0xa17efc 0x75bfff 0xb3dbff 0xb294ff 0x75bfff 0xc5adff 0x97959d 0x5e5c60 0x8ac8ff 0x2b2b2c 0x515053 0x6a686e 0xe5dbff 0x69b5f7 0xf4f0ff 0x97959d 0x1e1e1f 0x3692e2 +Base2ToneMeadow 0x192834 0x277fbe 0x80bf40 0xa6f655 0x4299d7 0x80bf40 0x47adf5 0x7b9eb7 0x3d5e76 0x8cdd3c 0x223644 0x335166 0x466b86 0xafddfe 0x73b234 0xd1ecff 0x7b9eb7 0x192834 0x4d8217 +Base2ToneMorning 0x232834 0x1659df 0xb29762 0xe5ddcd 0x3d75e6 0xb29762 0x728fcb 0x8d95a5 0x656e81 0xc6b28b 0x31363f 0x4f5664 0x707a8f 0xb7c9eb 0x9a7c42 0xdee6f7 0x8d95a5 0x232834 0x594212 +Base2ToneMotel 0x242323 0x956f76 0xf8917c 0xffc8bd 0xa7868b 0xf8917c 0xb89da2 0xa5979a 0x766b6c 0xffa28f 0x373434 0x5a5354 0x86797b 0xdec9cc 0xf77c64 0xf0dbdf 0xa5979a 0x242323 0xe24f32 +Base2TonePool 0x2a2433 0xaa75f5 0xf87972 0xffb6b3 0xb886fd 0xf87972 0xc7a0fe 0x9a90a7 0x635775 0xfc8983 0x372f42 0x574b68 0x706383 0xe4d2fe 0xf36f68 0xf3ebff 0x9a90a7 0x2a2433 0xcf504a +Base2TonePorch 0x221e24 0x9466a3 0xf39b68 0xffc29e 0xa77cb6 0xf39b68 0xba95c6 0x9f95a3 0x645a68 0xf8aa7c 0x302a32 0x574e5a 0x716774 0xdfcbe6 0xec8d55 0xf2e3f7 0x9f95a3 0x221e24 0xc46731 +Base2ToneSea 0x1d262f 0x34659d 0x0fc78a 0x47ebb4 0x57718e 0x0fc78a 0x6e9bcf 0xa1aab5 0x4a5f78 0x14e19d 0x27323f 0x405368 0x738191 0xafd4fe 0x0db57d 0xebf4ff 0xa1aab5 0x1d262f 0x067953 +Base2ToneSpace 0x24242e 0x7676f4 0xec7336 0xfe8c52 0x767693 0xec7336 0x8a8aad 0xa1a1b5 0x5b5b76 0xf37b3f 0x333342 0x515167 0x737391 0xcecee3 0xe66e33 0xebebff 0xa1a1b5 0x24242e 0xb25424 +Base2ToneSuburb 0x1e202f 0x7586f5 0xfb6fa9 0xffb3d2 0x8696fd 0xfb6fa9 0xa0acfe 0x878ba6 0x4f5472 0xfe81b5 0x292c3d 0x444864 0x5b6080 0xd2d8fe 0xf764a1 0xebedff 0x878ba6 0x1e202f 0xd14781 +Base4ToneClassicA 0x211d1c 0x8d9f04 0xdd40a4 0xf17ec7 0xeb8275 0xdc9118 0xe963b8 0xeee8e8 0x0d0807 0xb9cf17 0xf391cf 0xf6b1dd 0xf8cac3 0xe8a02c 0xfbbab1 0xf9f6f6 0xa19391 0x211d1c 0x81747c +Base4ToneClassicB 0x211e1c 0x669f04 0xde5745 0xf18c7e 0xe78b55 0xc1aa15 0xe97263 0xeeeae8 0x0d0907 0x8bcf17 0xf39c91 0xfbbab1 0xf7cdb6 0xdcc218 0xf5c1a3 0xf9f7f6 0xa29790 0x211e1c 0x847371 +Base4ToneClassicC 0x221f1c 0x049a61 0xde5745 0xf18c7e 0xe6971a 0xadc115 0xe97263 0xeeebe8 0x0d0b07 0x16ca85 0xf39c91 0xfbbab1 0xf5d8a8 0xc5dc18 0xf3cd91 0xf9f8f6 0xa39b8f 0x221f1c 0x847371 +Base4ToneClassicD 0x21211c 0x049582 0xda6b2b 0xee9968 0xcfb617 0x82c115 0xe6854d 0xeeede8 0x0d0c07 0x1cc4ae 0xf0a57a 0xf5c1a3 0xf6edb1 0x95dc18 0xf2e58c 0xf9f8f6 0xa2a090 0x21211c 0x85776f +Base4ToneClassicE 0x21211c 0x088ea0 0xc27905 0xe8a02c 0xb9cf17 0x5cba21 0xdc9118 0xedeee8 0x0d0d07 0x25bcd0 0xeaa83e 0xf3cd91 0xeef6b1 0x69d425 0xe6f28c 0xf9f9f6 0xa0a290 0x21211c 0x877d6e +Base4ToneClassicF 0x1f211c 0x0b88d0 0xa48f04 0xdcc218 0x8bcf17 0x15bc52 0xc1aa15 0xebeee8 0x0b0d07 0x47b5f5 0xe6ca1a 0xf2e58c 0xddf6b1 0x18d85e 0xcdf28c 0xf8f9f6 0x9ba191 0x1f211c 0x85826f +Base4ToneClassicI 0x1d201d 0x5c6feb 0x91a404 0xc5dc18 0x24cc38 0x23b4c7 0xadc115 0xe8ede9 0x080d08 0x929ff7 0xcee61a 0xe6f28c 0xb5f2bc 0x3ccadd 0x97eda1 0xf6f9f6 0x949e95 0x1d201d 0x83856f +Base4ToneClassicL 0x1b2221 0x7667e4 0x0da51f 0x2bda3f 0x1cc4ae 0x659efb 0x22bf34 0xe8eeed 0x070d0c 0xa095f3 0x3cdd4f 0x97eda1 0xadf0e7 0x88b4fc 0x93ece0 0xf6f9f8 0x8ea4a1 0x1b2221 0x748176 +Base4ToneClassicO 0x1a1d23 0xa24ad9 0x0d9c89 0x1ed2ba 0x74a8fb 0x9488f2 0x1bbba6 0xe7eaee 0x07090d 0xc27eed 0x2fdac3 0x93ece0 0xc7dcff 0xaba1f7 0xc2d9ff 0xf6f7f9 0x8995a9 0x1a1d23 0x6d8884 +Base4ToneClassicP 0x1c1d21 0xc039d5 0x1398aa 0x3ccadd 0x929ff7 0xa57af0 0x23b4c7 0xe8e8ee 0x07080d 0xdb75eb 0x5ad2e2 0xa4e6ef 0xd0d5fb 0xb792f6 0xc6cdfb 0xf6f6f9 0x9092a2 0x1c1d21 0x6a878a +Base4ToneClassicQ 0x1d1d20 0xd4359a 0x4287f5 0x88b4fc 0xa095f3 0xba6cea 0x659efb 0xe9e8ed 0x08070d 0xeb75c0 0x9cc1fc 0xc2d9ff 0xd9d5fc 0xc988f2 0xd1cbfb 0xf6f6f9 0x95949e 0x1d1d20 0x67768e +Base4ToneClassicR 0x1e1d20 0xd53975 0x6577ec 0xa0acf8 0xaf88f2 0xd763e9 0x8493f6 0xeae8ed 0x09070d 0xeb75a2 0xaeb8f9 0xc6cdfb 0xddcbfb 0xe17ef1 0xd6c2fa 0xf7f6f9 0x98949e 0x1e1d20 0x6f7285 +Base4ToneClassicS 0x1f1d20 0xd64f3d 0x7e70e6 0xaba1f7 0xc27eed 0xe963b8 0x9488f2 0xebe8ed 0x0b070d 0xeb8275 0xb7aff8 0xd1cbfb 0xe6c8f9 0xf17ec7 0xe0baf7 0xf8f6f9 0x9a949e 0x1f1d20 0x767481 +Base4ToneClassicT 0x201d20 0xce672c 0x9263e3 0xb792f6 0xdb75eb 0xe96396 0xa57af0 0xede8ed 0x0c070d 0xe78b55 0xc0a1f7 0xd6c2fa 0xf1c3f8 0xf17eaa 0xedb1f6 0xf8f6f9 0x9d949e 0x201d20 0x797481 +Base4ToneClassicU 0x201d20 0xce672c 0xaa52e0 0xc988f2 0xeb75dd 0xe96375 0xba6cea 0xede8ed 0x0d070c 0xe78b55 0xd19af4 0xe0baf7 0xf8c3f2 0xf17e8e 0xf6b1ee 0xf9f6f8 0x9e949d 0x201d20 0x7c7481 +Base4ToneClassicW 0x201d1e 0xb87305 0xca45de 0xe17ef1 0xeb75a2 0xe97263 0xd763e9 0xede8ea 0x0d080a 0xe6971a 0xe691f3 0xedb1f6 0xf8bfd5 0xf18c7e 0xf6b1cc 0xf9f6f7 0x9e9498 0x201d1e 0x7f7481 +Base4ToneModernC 0x221f1c 0x5c6feb 0xdd407c 0xf17eaa 0xe6971a 0x1bbba6 0xe96396 0xeeebe8 0x0d0b07 0x929ff7 0xf391b6 0xf6b1cc 0xf5d8a8 0x1ed2ba 0xf3cd91 0xf9f8f6 0xa39b8f 0x221f1c 0x817479 +Base4ToneModernN 0x1a2023 0xd53975 0xa48f04 0xdcc218 0x47b5f5 0x8493f6 0xc1aa15 0xe8ebee 0x070b0d 0xeb75a2 0xe6ca1a 0xf2e58c 0xbbe4fb 0xa0acf8 0xb1e0fb 0xf6f8f9 0x8a9da8 0x1a2023 0x85826f +Base4ToneModernW 0x201d1e 0x21a00d 0x1398aa 0x3ccadd 0xeb75a2 0xe97263 0x23b4c7 0xede8ea 0x0d080a 0x39c723 0x5ad2e2 0xa4e6ef 0xf8bfd5 0xf18c7e 0xf6b1cc 0xf9f6f7 0x9e9498 0x201d1e 0x6a878a +Bim 0x2C2423 0xF557A0 0xA9EE55 0xF5A255 0x5EA2EC 0xA957EC 0x5EEEA0 0x918988 0x918988 0xF579B2 0xBBEE78 0xF5B378 0x81B3EC 0xBB79EC 0x81EEB2 0xF5EEEC 0xA9BED8 0x012849 0xA9BED8 +BlulocoZshLight 0xE4E5F1 0xD52753 0x23974A 0xDF631C 0x275FE4 0x823FF1 0x27618D 0x000000 0x5794DE 0xFF6480 0x3CBC66 0xC5A332 0x0099E1 0xCE33C0 0x6D93BB 0x26272D 0x383A42 0xF9F9F9 0x383A42 +Breadog 0x362C24 0xB10B00 0x007232 0x8B4C00 0x005CB4 0x9B0097 0x006A78 0xD4C3B7 0x514337 0xDE1100 0x008F40 0xAE6000 0x0074E1 0xC300BD 0x008697 0xEAE1DA 0x362C24 0xF1EBE6 0x362C24 +Breath 0x1E2229 0xED1515 0x44853A 0xF67400 0x1D99F3 0x9B59B6 0x1ABC9C 0xFCFCFC 0x7F8C8D 0xC0392B 0x55A649 0xFDBC4B 0x3DAEE9 0x8E44AD 0x16A085 0xFFFFFF 0x17A88B 0x1E2229 0x17A88B +BreathDarker 0x1E2229 0xED1515 0x44853A 0xF67400 0x1D99F3 0x9B59B6 0x1ABC9C 0xFCFCFC 0x7F8C8D 0xC0392B 0x55A649 0xFDBC4B 0x3DAEE9 0x8E44AD 0x16A085 0xFFFFFF 0x17A88B 0x080D14 0x17A88B +BreathLight 0xE8E8E8 0xED1515 0xC0392B 0xF67400 0x1D99F3 0x9B59B6 0x1ABC9C 0xFCFCFC 0x7F8C8D 0xC0392B 0x55A649 0xFDBC4B 0x3DAEE9 0x8E44AD 0x16A085 0xFFFFFF 0x292F34 0xE8E8E8 0x292F34 +BreathSilverfox 0x1E2229 0xED1515 0x44853A 0xF67400 0x1D99F3 0x9B59B6 0x1ABC9C 0xFCFCFC 0x7F8C8D 0xC0392B 0x55A649 0xFDBC4B 0x3DAEE9 0x8E44AD 0x16A085 0xFFFFFF 0xBBBBBB 0x1E2229 0xBBBBBB +Butrin 0x8C7E78 0xE68A8A 0x99CC99 0xFAD7A0 0x6699CC 0xC8A2C8 0x6FC3B2 0xE2CEBE 0xBFACA4 0xF2B1B1 0xB2D8B2 0xF7DCB4 0x87CEFA 0xD8BFD8 0x64DBDB 0xF2F2F2 0xF2F2F2 0x4B3B3C 0xE39D93 +Cai 0x000000 0xCA274D 0x4DCA27 0xCAA427 0x274DCA 0xA427CA 0x27CAA4 0x808080 0x808080 0xE98DA3 0xA3E98D 0xE9D48D 0x8DA3E9 0xD48DE9 0x8DE9D4 0xFFFFFF 0xD9E6F2 0x09111A 0xD9E6F2 +Campbell 0x0C0C0C 0xC50F1F 0x13A10E 0xC19C00 0x0037DA 0x881798 0x3A96DD 0xCCCCCC 0x767676 0xE74856 0x16C60C 0xF9F1A5 0x3B78FF 0xB4009E 0x61D6D6 0xF2F2F2 0xCCCCCC 0x0C0C0C 0xFFFFFF +CatppuccinFrappé 0x51576D 0xE78284 0xA6D189 0xE5C890 0x8CAAEE 0xF4B8E4 0x81C8BE 0xB5BFE2 0x626880 0xE78284 0xA6D189 0xE5C890 0x8CAAEE 0xF4B8E4 0x81C8BE 0xA5ADCE 0xC6D0F5 0x303446 0xC6D0F5 +CatppuccinLatte 0x5C5F77 0xD20F39 0x40A02B 0xDF8E1D 0x1E66F5 0xEA76CB 0x179299 0xACB0BE 0x6C6F85 0xD20F39 0x40A02B 0xDF8E1D 0x1E66F5 0xEA76CB 0x179299 0xBCC0CC 0x4C4F69 0xEFF1F5 0x4C4F69 +CatppuccinMacchiato 0x494D64 0xED8796 0xA6DA95 0xEED49F 0x8AADF4 0xF5BDE6 0x8BD5CA 0xB8C0E0 0x5B6078 0xED8796 0xA6DA95 0xEED49F 0x8AADF4 0xF5BDE6 0x8BD5CA 0xA5ADCB 0xCAD3F5 0x24273A 0xCAD3F5 +CatppuccinMocha 0x45475A 0xF38BA8 0xA6E3A1 0xF9E2AF 0x89B4FA 0xF5C2E7 0x94E2D5 0xBAC2DE 0x585B70 0xF38BA8 0xA6E3A1 0xF9E2AF 0x89B4FA 0xF5C2E7 0x94E2D5 0xA6ADC8 0xCDD6F4 0x1E1E2E 0xCDD6F4 +Chameleon 0x2C2C2C 0xCC231C 0x689D69 0xD79922 0x366B71 0x4E5165 0x458587 0xC8BB97 0x777777 0xCC231C 0x689D69 0xD79922 0x366B71 0x4E5165 0x458587 0xC8BB97 0xDEDEDE 0x2C2C2C 0xDEDEDE +CityLights 0x41505E 0xD95468 0x8BD49C 0xEBBF83 0x539AFC 0xB62D65 0x70E1E8 0xFFFFFF 0x41505E 0xD95468 0x8BD49C 0xEBBF83 0x539AFC 0xB62D65 0x70E1E8 0xFFFFFF 0xFFFFFF 0x171D23 0x008B94 +CloneOfUbuntu 0x2E3436 0xCC0000 0x4E9A06 0xC4A000 0x3465A4 0x75507B 0x06989A 0xD3D7CF 0x555753 0xEF2929 0x8AE234 0xFCE94F 0x729FCF 0xAD7FA8 0x34E2E2 0xEEEEEC 0xFFFFFF 0x300A24 0xFFFFFF +Clrs 0x000000 0xF8282A 0x328A5D 0xFA701D 0x135CD0 0x9F00BD 0x33C3C1 0xB3B3B3 0x555753 0xFB0416 0x2CC631 0xFDD727 0x1670FF 0xE900B0 0x3AD5CE 0xEEEEEC 0x262626 0xFFFFFF 0x262626 +Colorcli 0x000000 0xD70000 0x5FAF00 0x5FAF00 0x005F87 0xD70000 0x5F5F5F 0xE4E4E4 0x5F5F5F 0xD70000 0x5F5F5F 0xFFFF00 0x0087AF 0x0087AF 0x0087AF 0xFFFFFF 0x005F87 0xFFFFFF 0x005F87 +Dehydration 0x333333 0xFF5555 0x5FD38D 0xFF9955 0x3771C8 0xBC5FD3 0x5FD3BC 0x999999 0x666666 0xFF8080 0x87DEAA 0xFFB380 0x5F8DD3 0xCD87DE 0x87DECD 0xCCCCCC 0xCCCCCC 0x333333 0xCCCCCC +Dissonance 0x000000 0xDC322F 0x56DB3A 0xFF8400 0x0084D4 0xB729D9 0xCCCCFF 0xFFFFFF 0xD6DBE5 0xDC322F 0x56DB3A 0xFF8400 0x0084D4 0xB729D9 0xCCCCFF 0xFFFFFF 0xFFFFFF 0x000000 0xDC322F +Elic 0x303030 0xE1321A 0x6AB017 0xFFC005 0x729FCF 0xEC0048 0xF2F2F2 0x2AA7E7 0x5D5D5D 0xFF361E 0x7BC91F 0xFFD00A 0x0071FF 0xFF1D62 0x4BB8FD 0xA020F0 0xF2F2F2 0x4A453E 0xF2F2F2 +Elio 0x303030 0xE1321A 0x6AB017 0xFFC005 0x729FCF 0xEC0048 0x2AA7E7 0xF2F2F2 0x5D5D5D 0xFF361E 0x7BC91F 0xFFD00A 0x0071FF 0xFF1D62 0x4BB8FD 0xA020F0 0xF2F2F2 0x041A3B 0xF2F2F2 +EverforestDarkHard 0x2E383C 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0xD3C6AA 0x272E33 0xD3C6AA +EverforestDarkMedium 0x343F44 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0xD3C6AA 0x2D353B 0xD3C6AA +EverforestDarkSoft 0x3A464C 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0xD3C6AA 0x333C43 0xD3C6AA +EverforestLightHard 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0x2E383C 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xFFFBEF 0x5C6A72 +EverforestLightMedium 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0x343F44 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xFDF6E3 0x5C6A72 +EverforestLightSoft 0x5C6A72 0xF85552 0x8DA101 0xDFA000 0x3A94C5 0xDF69BA 0x35A77C 0xDFDDC8 0x3A464C 0xE67E80 0xA7C080 0xDBBC7F 0x7FBBB3 0xD699B6 0x83C092 0xD3C6AA 0x5C6A72 0xF3EAD3 0x5C6A72 +FairyFloss 0x42395D 0xA8757B 0xFF857F 0xE6C000 0xAE81FF 0x716799 0xC2FFDF 0xF8F8F2 0x75507B 0xFFB8D1 0xF1568E 0xD5A425 0xC5A3FF 0x8077A8 0xC2FFFF 0xF8F8F0 0xC2FFDF 0x5A5475 0xFFB8D1 +FairyFlossDark 0x42395D 0xA8757B 0xFF857F 0xE6C000 0xAE81FF 0x716799 0xC2FFDF 0xF8F8F2 0x75507B 0xFFB8D1 0xF1568E 0xD5A425 0xC5A3FF 0x8077A8 0xC2FFFF 0xF8F8F0 0xC2FFDF 0x42395D 0xFFB8D1 +Fishtank 0x03073C 0xC6004A 0xACF157 0xFECD5E 0x525FB8 0x986F82 0x968763 0xECF0FC 0x6C5B30 0xDA4B8A 0xDBFFA9 0xFEE6A9 0xB2BEFA 0xFDA5CD 0xA5BD86 0xF6FFEC 0xECF0FE 0x232537 0xECF0FE +FlatRemix 0x1F2229 0xD41919 0x5EBDAB 0xFEA44C 0x367BF0 0xBF2E5D 0x49AEE6 0xE6E6E6 0x8C42AB 0xEC0101 0x47D4B9 0xFF8A18 0x277FFF 0xD71655 0x05A1F7 0xFFFFFF 0xFFFFFF 0x272A34 0xFFFFFF +FlexokiDark 0x282726 0xAF3029 0x66800B 0xAD8301 0x205EA6 0xA02F6F 0x24837B 0xE6E4D9 0x343331 0xD14D41 0x879A39 0xD0A215 0x4385BE 0xCE5D97 0x3AA99F 0xFFFCF0 0x878580 0x100F0F 0xCECDC3 +FlexokiLight 0x282726 0xAF3029 0x66800B 0xAD8301 0x205EA6 0xA02F6F 0x24837B 0x878580 0x1C1B1A 0xD14D41 0x879A39 0xD0A215 0x4385BE 0xCE5D97 0x3AA99F 0x6F6E69 0x100F0F 0xFFFCF0 0x100F0F +Foxnightly 0x2A2A2E 0xB98EFF 0xFF7DE9 0x729FCF 0x66A05B 0x75507B 0xACACAE 0xFFFFFF 0xA40000 0xBF4040 0x66A05B 0xFFB86C 0x729FCF 0x8F5902 0xC4A000 0x5C3566 0xD7D7DB 0x2A2A2E 0xD7D7DB +Freya 0x073642 0xDC322F 0x859900 0xB58900 0x268BD2 0xEC0048 0x2AA198 0x94A3A5 0x586E75 0xCB4B16 0x859900 0xB58900 0x268BD2 0xD33682 0x2AA198 0x6C71C4 0x94A3A5 0x252E32 0x839496 +FrontendDelight 0x242526 0xF8511B 0x565747 0xFA771D 0x2C70B7 0xF02E4F 0x3CA1A6 0xADADAD 0x5FAC6D 0xF74319 0x74EC4C 0xFDC325 0x3393CA 0xE75E4F 0x4FBCE6 0x8C735B 0xADADAD 0x1B1C1D 0xADADAD +FrontendFunForrest 0x000000 0xD6262B 0x919C00 0xBE8A13 0x4699A3 0x8D4331 0xDA8213 0xDDC265 0x7F6A55 0xE55A1C 0xBFC65A 0xFFCB1B 0x7CC9CF 0xD26349 0xE6A96B 0xFFEAA3 0xDEC165 0x251200 0xDEC165 +FrontendGalaxy 0x000000 0xF9555F 0x21B089 0xFEF02A 0x589DF6 0x944D95 0x1F9EE7 0xBBBBBB 0x555555 0xFA8C8F 0x35BB9A 0xFFFF55 0x589DF6 0xE75699 0x3979BC 0xFFFFFF 0xFFFFFF 0x1D2837 0xFFFFFF +Geohot 0xF9F5F5 0xCC0000 0x1F1E1F 0xADA110 0xFF004E 0x75507B 0x06919A 0xFFFFFF 0x555753 0xEF2929 0xFF0000 0xADA110 0x5F4AA6 0xB74438 0x408F0C 0xFFFFFF 0xFFFFFF 0x1F1E1F 0xFFFFFF +GithubDark 0x000000 0xF78166 0x56D364 0xE3B341 0x6CA4F8 0xDB61A2 0x2B7489 0xFFFFFF 0x4D4D4D 0xF78166 0x56D364 0xE3B341 0x6CA4F8 0xDB61A2 0x2B7489 0xFFFFFF 0x8B949E 0x101216 0xC9D1D9 +GithubLight 0x24292f 0xcf222e 0x1a7f37 0x9a6700 0x0969da 0x8250df 0x1b7c83 0x6e7781 0x57606a 0xa40e26 0x2da44e 0xbf8700 0x218bff 0xa475f9 0x3192aa 0x8c959f 0x1f2328 0xf6f8fa 0x1f2328 +Gogh 0x292D3E 0xF07178 0x62DE84 0xFFCB6B 0x75A1FF 0xF580FF 0x60BAEC 0xABB2BF 0x959DCB 0xF07178 0xC3E88D 0xFF5572 0x82AAFF 0xFFCB6B 0x676E95 0xFFFEFE 0xBFC7D5 0x292D3E 0xBFC7D5 +Gooey 0x000009 0xBB4F6C 0x72CCAE 0xC65E3D 0x58B6CA 0x6488C4 0x8D84C6 0x858893 0x1F222D 0xEE829F 0xA5FFE1 0xF99170 0x8BE9FD 0x97BBF7 0xC0B7F9 0xFFFFFF 0xEBEEF9 0x0D101B 0xEBEEF9 +GoogleDark 0x202124 0xEA4335 0x34A853 0xFBBC04 0x4285F4 0xA142F4 0x24C1E0 0xE8EAED 0x5F6368 0xEA4335 0x34A853 0xFBBC05 0x4285F4 0xA142F4 0x24C1E0 0xFFFFFF 0xE8EAED 0x202124 0xE8EAED +GoogleLight 0x202124 0xEA4335 0x34A853 0xFBBC04 0x4285F4 0xA142F4 0x24C1E0 0xE8EAED 0x5F6368 0xEA4335 0x34A853 0xFBBC05 0x4285F4 0xA142F4 0x24C1E0 0xFFFFFF 0x5F6368 0xFFFFFF 0x5F6368 +Gotham 0x0A0F14 0xC33027 0x26A98B 0xEDB54B 0x195465 0x4E5165 0x33859D 0x98D1CE 0x10151B 0xD26939 0x081F2D 0x245361 0x093748 0x888BA5 0x599CAA 0xD3EBE9 0x98D1CE 0x0A0F14 0x98D1CE +Gruvbox 0xFBF1C7 0xCC241D 0x98971A 0xD79921 0x458588 0xB16286 0x689D6A 0x7C6F64 0x928374 0x9D0006 0x79740E 0xB57614 0x076678 0x8F3F71 0x427B58 0x3C3836 0x3C3836 0xFBF1C7 0x3C3836 +GruvboxMaterial 0x3C3836 0xEA6962 0xA9B665 0xD8A657 0x7DAEA3 0xD3869B 0x89B482 0xD4BE98 0x3C3836 0xEA6962 0xA9B665 0xD8A657 0x7DAEA3 0xD3869B 0x89B482 0xD4BE98 0xD4BE98 0x282828 0xD4BE98 +HemisuDark 0x444444 0xFF0054 0xB1D630 0x9D895E 0x67BEE3 0xB576BC 0x569A9F 0xEDEDED 0x777777 0xD65E75 0xBAFFAA 0xECE1C8 0x9FD3E5 0xDEB3DF 0xB6E0E5 0xFFFFFF 0xFFFFFF 0x000000 0xBAFFAA +HemisuLight 0x777777 0xFF0055 0x739100 0x503D15 0x538091 0x5B345E 0x538091 0x999999 0x999999 0xD65E76 0x9CC700 0x947555 0x9DB3CD 0xA184A4 0x85B2AA 0xBABABA 0x444444 0xEFEFEF 0xFF0054 +HomebrewLight 0x000000 0x990000 0x00A600 0x999900 0x0000B2 0xB200B2 0x00A6B2 0xBFBFBF 0x666666 0xE50000 0x00D900 0xE5E500 0x0000FF 0xE500E5 0x00E5E5 0xE5E5E5 0x000000 0xFFFFFF 0x000000 +HomebrewOcean 0x000000 0x990000 0x00A600 0x999900 0x0000B2 0xB200B2 0x00A6B2 0xBFBFBF 0x666666 0xE50000 0x00D900 0xE5E500 0x0000FF 0xE500E5 0x00E5E5 0xE5E5E5 0xFFFFFF 0x224FBC 0xFFFFFF +HorizonBright 0x16161C 0xDA103F 0x1EB980 0xF6661E 0x26BBD9 0xEE64AE 0x1D8991 0xFADAD1 0x1A1C23 0xF43E5C 0x07DA8C 0xF77D26 0x3FC6DE 0xF075B7 0x1EAEAE 0xFDF0ED 0x1C1E26 0xFDF0ED 0x1C1E26 +HorizonDark 0x16161C 0xE95678 0x29D398 0xFAB795 0x26BBD9 0xEE64AE 0x59E3E3 0xFADAD1 0x232530 0xEC6A88 0x3FDAA4 0xFBC3A7 0x3FC6DE 0xF075B7 0x6BE6E6 0xFDF0ED 0xFDF0ED 0x1C1E26 0xFDF0ED +Ibm3270(HighContrast) 0x000000 0xFF0000 0x00FF00 0xFFFF00 0x00BFFF 0xFFC0CB 0x40E0D0 0xBEBEBE 0x414141 0xFFA500 0x98FB98 0xFFFF00 0x0000CD 0xA020F0 0xAEEEEE 0xFFFFFF 0xFDFDFD 0x000000 0xFDFDFD +Ibm3270 0x222222 0xF01818 0x24D830 0xF0D824 0x7890F0 0xF078D8 0x54E4E4 0xA5A5A5 0x888888 0xEF8383 0x7ED684 0xEFE28B 0xB3BFEF 0xEFB3E3 0x9CE2E2 0xFFFFFF 0xFDFDFD 0x000000 0xFDFDFD +IcGreenPpl 0x1F1F1F 0xFB002A 0x339C24 0x659B25 0x149B45 0x53B82C 0x2CB868 0xE0FFEF 0x032710 0xA7FF3F 0x9FFF6D 0xD2FF6D 0x72FFB5 0x50FF3E 0x22FF71 0xDAEFD0 0xD9EFD3 0x3A3D3F 0xD9EFD3 +IcOrangePpl 0x000000 0xC13900 0xA4A900 0xCAAF00 0xBD6D00 0xFC5E00 0xF79500 0xFFC88A 0x6A4F2A 0xFF8C68 0xF6FF40 0xFFE36E 0xFFBE55 0xFC874F 0xC69752 0xFAFAFF 0xFFCB83 0x262626 0xFFCB83 +Iceberg 0x161821 0xe27878 0xb4be82 0xe2a478 0x84a0c6 0xa093c7 0x89b8c2 0xc6c8d1 0x6b7089 0xe98989 0xc0ca8e 0xe9b189 0x91acd1 0xada0d3 0x95c4ce 0xd2d4de 0xc6c8d1 0x161821 0xd2d4de +IdleToes 0x323232 0xD25252 0x7FE173 0xFFC66D 0x4099FF 0xF680FF 0xBED6FF 0xEEEEEC 0x535353 0xF07070 0x9DFF91 0xFFE48B 0x5EB7F7 0xFF9DFF 0xDCF4FF 0xFFFFFF 0xFFFFFF 0x323232 0xFFFFFF +IrBlack 0x4E4E4E 0xFF6C60 0xA8FF60 0xFFFFB6 0x69CBFE 0xFF73FD 0xC6C5FE 0xEEEEEE 0x7C7C7C 0xFFB6B0 0xCEFFAC 0xFFFFCB 0xB5DCFE 0xFF9CFE 0xDFDFFE 0xFFFFFF 0xEEEEEE 0x000000 0xFFA560 +Jup 0x000000 0xDD006F 0x6FDD00 0xDD6F00 0x006FDD 0x6F00DD 0x00DD6F 0xF2F2F2 0x7D7D7D 0xFF74B9 0xB9FF74 0xFFB974 0x74B9FF 0xB974FF 0x74FFB9 0xFFFFFF 0x23476A 0x758480 0x23476A +Kanagawa 0x090618 0xC34043 0x76946A 0xC0A36E 0x7E9CD8 0x957FB8 0x6A9589 0xDCD7BA 0x727169 0xE82424 0x98BB6C 0xE6C384 0x7FB4CA 0x938AA9 0x7AA89F 0xC8C093 0xDCD7BA 0x1F1F28 0xDCD7BA +KanagawaDragon 0x0D0C0C 0xC4746E 0x8A9A7B 0xC4B28A 0x8BA4B0 0xA292A3 0x8EA4A2 0xC8C093 0xA6A69C 0xE46876 0x87A987 0xE6C384 0x7FB4CA 0x938AA9 0x7AA89F 0xC5C9C5 0xC5C9C5 0x181616 0xC8C093 +Kokuban 0x2E8744 0xD84E4C 0x95DA5A 0xD6E264 0x4B9ED7 0x945FC5 0xD89B25 0xD8E2D7 0x34934F 0xFF4F59 0xAFF56A 0xFCFF75 0x57AEFF 0xAE63E9 0xFFAA2B 0xFFFEFE 0xD8E2D7 0x0D4A08 0xD8E2D7 +Laserwave 0x39243A 0xEB64B9 0xAFD686 0xFEAE87 0x40B4C4 0xB381C5 0x215969 0x91889B 0x716485 0xFC2377 0x50FA7B 0xFFE261 0x74DFC4 0x6D75E0 0xB4DCE7 0xFFFFFF 0xE0E0E0 0x1F1926 0xC7C7C7 +LunariaDark 0x36464E 0x846560 0x809984 0xA79A79 0x555673 0x866C83 0x7E98B4 0xCACED8 0x404F56 0xBB928B 0xBFDCC2 0xF1DFB6 0x777798 0xBF9DB9 0xBDDCFF 0xDFE2ED 0xCACED8 0x36464E 0xCACED8 +LunariaEclipse 0x323F46 0x83615B 0x7F9781 0xA69875 0x53516F 0x856880 0x7D96B2 0xC9CDD7 0x3D4950 0xBA9088 0xBEDBC1 0xF1DFB4 0x767495 0xBE9CB8 0xBCDBFF 0xDFE2ED 0xC9CDD7 0x323F46 0xC9CDD7 +LunariaLight 0x3E3C3D 0x783C1F 0x497D46 0x8F750B 0x3F3566 0x793F62 0x3778A9 0xD5CFCC 0x484646 0xB06240 0x7BC175 0xDCB735 0x5C4F89 0xB56895 0x64BAFF 0xEBE4E1 0x484646 0xEBE4E1 0x484646 +Maia 0x232423 0xBA2922 0x7E807E 0x4C4F4D 0x16A085 0x43746A 0x00CCCC 0xE0E0E0 0x282928 0xCC372C 0x8D8F8D 0x4E524F 0x13BF9D 0x487D72 0x00D1D1 0xE8E8E8 0xBDC3C7 0x31363B 0xBDC3C7 +Mar 0x000000 0xB5407B 0x7BB540 0xB57B40 0x407BB5 0x7B40B5 0x40B57B 0xF8F8F8 0x737373 0xCD73A0 0xA0CD73 0xCDA073 0x73A0CD 0xA073CD 0x73CDA0 0xFFFFFF 0x23476A 0xFFFFFF 0x23476A +Miramare 0x242021 0xe68183 0xa7c080 0xd9bb80 0x89beba 0xd3a0bc 0x87c095 0xd8caac 0x444444 0xe39b7b 0xa7c080 0xd9bb80 0x89beba 0xd3a0bc 0x87c095 0xe6d6ac 0xe6d6ac 0x2a2426 0xe6d6ac +ModusOperandi 0xffffff 0xa60000 0x006800 0x6f5500 0x0031a9 0x721045 0x005e8b 0x000000 0xf2f2f2 0xd00000 0x008900 0x808000 0x0000ff 0xdd22dd 0x008899 0x595959 0x000000 0xffffff 0x000000 +ModusOperandiTinted 0xfbf7f0 0xa60000 0x006800 0x6f5500 0x0031a9 0x721045 0x005e8b 0x000000 0xefe9dd 0xd00000 0x008900 0x808000 0x0000ff 0xdd22dd 0x008899 0x595959 0x000000 0xfbf7f0 0x000000 +ModusVivendi 0x000000 0xff5f59 0x44bc44 0xd0bc00 0x2fafff 0xfeacd0 0x00d3d0 0xffffff 0x1e1e1e 0xff5f5f 0x44df44 0xefef00 0x338fff 0xff66ff 0x00eff0 0x989898 0xffffff 0x000000 0xffffff +ModusVivendiTinted 0x0d0e1c 0xff5f59 0x44bc44 0xd0bc00 0x2fafff 0xfeacd0 0x00d3d0 0xffffff 0x1d2235 0xff5f5f 0x44df44 0xefef00 0x338fff 0xff66ff 0x00eff0 0x989898 0xffffff 0x0d0e1c 0xffffff +MonoAmber 0x402500 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0xFF9400 0x2B1900 0xFF9400 +MonoCyan 0x003340 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00CCFF 0x00222B 0x00CCFF +MonoGreen 0x034000 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x0BFF00 0x022B00 0x0BFF00 +MonoRed 0x401200 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0xFF3600 0x2B0C00 0xFF3600 +MonoWhite 0x3B3B3B 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0xFAFAFA 0x262626 0xFAFAFA +MonoYellow 0x403500 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0xFFD300 0x2B2400 0xFFD300 +MonokaiDark 0x75715E 0xF92672 0xA6E22E 0xF4BF75 0x66D9EF 0xAE81FF 0x2AA198 0xF9F8F5 0x272822 0xF92672 0xA6E22E 0xF4BF75 0x66D9EF 0xAE81FF 0x2AA198 0xF8F8F2 0xF8F8F2 0x272822 0xF8F8F2 +MonokaiPro 0x363537 0xFF6188 0xA9DC76 0xFFD866 0xFC9867 0xAB9DF2 0x78DCE8 0xFDF9F3 0x908E8F 0xFF6188 0xA9DC76 0xFFD866 0xFC9867 0xAB9DF2 0x78DCE8 0xFDF9F3 0xFDF9F3 0x363537 0xFDF9F3 +MonokaiProRistretto 0x3E3838 0xDF7484 0xBBD87E 0xEDCE73 0xDC9373 0xA9AAE9 0xA4D7CC 0xFBF2F3 0x70696A 0xDF7484 0xBBD87E 0xEDCE73 0xDC9373 0xA9AAE9 0xA4D7CC 0xFBF2F3 0xFBF2F3 0x3E3838 0xFBF2F3 +Moonfly 0x323437 0xFF5454 0x8CC85F 0xE3C78A 0x80A0FF 0xCF87E8 0x79DAC8 0xC6C6C6 0x949494 0xFF5189 0x36C692 0xC2C292 0x74B2FF 0xAE81FF 0x85DC85 0xE4E4E4 0xBDBDBD 0x080808 0x9E9E9E +Morada 0x040404 0x0F49C4 0x48B117 0xE87324 0xBC0116 0x665B93 0x70A699 0xF5DCBE 0x4F7CBF 0x1C96C7 0x3BFF6F 0xEFC31C 0xFB605B 0x975B5A 0x1EFF8E 0xF6F5FB 0xFFFFFF 0x211F46 0xFFFFFF +N0Tch2K 0x383838 0xA95551 0x666666 0xA98051 0x657D3E 0x767676 0xC9C9C9 0xD0B8A3 0x474747 0xA97775 0x8C8C8C 0xA99175 0x98BD5E 0xA3A3A3 0xDCDCDC 0xD8C8BB 0xA0A0A0 0x222222 0xA0A0A0 +NeonNight 0x20242D 0xFF8E8E 0x7EFDD0 0xFCAD3F 0x69B4F9 0xDD92F6 0x8CE8FF 0xC9CCCD 0x20242D 0xFF8E8E 0x7EFDD0 0xFCAD3F 0x69B4F9 0xDD92F6 0x8CE8FF 0xC9CCCD 0xC7C8FF 0x20242D 0xC7C8FF +Nep 0x000000 0xDD6F00 0x00DD6F 0x6FDD00 0x6F00DD 0xDD006F 0x006FDD 0xF2F2F2 0x7D7D7D 0xFFB974 0x74FFB9 0xB9FF74 0xB974FF 0xFF74B9 0x74B9FF 0xFFFFFF 0x23476A 0x758480 0x23476A +NightOwl 0x011627 0xEF5350 0x22DA6E 0xADDB67 0x82AAFF 0xC792EA 0x21C7A8 0xFFFFFF 0x575656 0xEF5350 0x22DA6E 0xFFEB95 0x82AAFF 0xC792EA 0x7FDBCA 0xFFFFFF 0xD6DEEB 0x011627 0xD6DEEB +Nightfly 0x1D3B53 0xFC514E 0xA1CD5E 0xE3D18A 0x82AAFF 0xC792EA 0x7FDBCA 0xA1AAB8 0x7C8F8F 0xFF5874 0x21C7A8 0xECC48D 0x82AAFF 0xAE81FF 0x7FDBCA 0xD6DEEB 0xBDC1C6 0x011627 0x9CA1AA +NightlionV1 0x4C4C4C 0xBB0000 0x5FDE8F 0xF3F167 0x276BD8 0xBB00BB 0x00DADF 0xBBBBBB 0x555555 0xFF5555 0x55FF55 0xFFFF55 0x5555FF 0xFF55FF 0x55FFFF 0xFFFFFF 0xBBBBBB 0x000000 0xBBBBBB +NightlionV2 0x4C4C4C 0xBB0000 0x04F623 0xF3F167 0x64D0F0 0xCE6FDB 0x00DADF 0xBBBBBB 0x555555 0xFF5555 0x7DF71D 0xFFFF55 0x62CBE8 0xFF9BF5 0x00CCD8 0xFFFFFF 0xBBBBBB 0x171717 0xBBBBBB +Nighty 0x373D48 0x9B3E46 0x095B32 0x808020 0x1D3E6F 0x823065 0x3A7458 0x828282 0x5C6370 0xD0555F 0x119955 0xDFE048 0x4674B8 0xED86C9 0x70D2A4 0xDFDFDF 0xDFDFDF 0x2F2F2F 0xDFDFDF +Nord 0x3B4252 0xBF616A 0xA3BE8C 0xEBCB8B 0x81A1C1 0xB48EAD 0x88C0D0 0xE5E9F0 0x4C566A 0xBF616A 0xA3BE8C 0xEBCB8B 0x81A1C1 0xB48EAD 0x8FBCBB 0xECEFF4 0xD8DEE9 0x2E3440 0xD8DEE9 +NordLight 0x003B4E 0xE64569 0x069F5F 0xDAB752 0x439ECF 0xD961DC 0x00B1BE 0xB3B3B3 0x3E89A1 0xE4859A 0xA2CCA1 0xE1E387 0x6FBBE2 0xE586E7 0x96DCDA 0xDEDEDE 0x004F7C 0xEBEAF2 0x439ECF +OceanDark 0x4F4F4F 0xAF4B57 0xAFD383 0xE5C079 0x7D90A4 0xA4799D 0x85A6A5 0xEEEDEE 0x7B7B7B 0xAF4B57 0xCEFFAB 0xFFFECC 0xB5DCFE 0xFB9BFE 0xDFDFFD 0xFEFFFE 0x979CAC 0x1C1F27 0x979CAC +OceanicNext 0x121C21 0xE44754 0x89BD82 0xF7BD51 0x5486C0 0xB77EB8 0x50A5A4 0xFFFFFF 0x52606B 0xE44754 0x89BD82 0xF7BD51 0x5486C0 0xB77EB8 0x50A5A4 0xFFFFFF 0xB3B8C3 0x121B21 0xB3B8C3 +Omni 0x191622 0xE96379 0x67E480 0xE89E64 0x78D1E1 0x988BC7 0xFF79C6 0xABB2BF 0x000000 0xE96379 0x67E480 0xE89E64 0x78D1E1 0x988BC7 0xFF79C6 0xFFFFFF 0xABB2BF 0x191622 0xABB2BF +OneDark 0x000000 0xE06C75 0x98C379 0xD19A66 0x61AFEF 0xC678DD 0x56B6C2 0xABB2BF 0x5C6370 0xE06C75 0x98C379 0xD19A66 0x61AFEF 0xC678DD 0x56B6C2 0xFFFEFE 0x5C6370 0x1E2127 0x5C6370 +OneHalfBlack 0x282C34 0xE06C75 0x98C379 0xE5C07B 0x61AFEF 0xC678DD 0x56B6C2 0xDCDFE4 0x282C34 0xE06C75 0x98C379 0xE5C07B 0x61AFEF 0xC678DD 0x56B6C2 0xDCDFE4 0xDCDFE4 0x000000 0xDCDFE4 +OneLight 0x000000 0xDA3E39 0x41933E 0x855504 0x315EEE 0x930092 0x0E6FAD 0x8E8F96 0x2A2B32 0xDA3E39 0x41933E 0x855504 0x315EEE 0x930092 0x0E6FAD 0xFFFEFE 0x2A2B32 0xF8F8F8 0x2A2B32 +OxocarbonDark 0x262626 0xEE5396 0x42BE65 0xFFE97B 0x33B1FF 0xFF7EB6 0x3DDBD9 0xDDE1E6 0x393939 0xEE5396 0x42BE65 0xFFE97B 0x33B1FF 0xFF7EB6 0x3DDBD9 0xFFFFFF 0xFFFFFF 0x161616 0x6F6F6F +Palenight 0x292D3E 0xF07178 0xC3E88D 0xFFCB6B 0x82AAFF 0xC792EA 0x60ADEC 0xABB2BF 0x959DCB 0xF07178 0xC3E88D 0xFF5572 0x82AAFF 0xFFCB6B 0x676E95 0xFFFEFE 0xBFC7D5 0x292D3E 0xBFC7D5 +Pali 0x0A0A0A 0xAB8F74 0x74AB8F 0x8FAB74 0x8F74AB 0xAB748F 0x748FAB 0xF2F2F2 0x5D5D5D 0xFF1D62 0x9CC3AF 0xFFD00A 0xAF9CC3 0xFF1D62 0x4BB8FD 0xA020F0 0xD9E6F2 0x232E37 0xD9E6F2 +Panda 0x1F1F20 0xFB055A 0x26FFD4 0xFDAA5A 0x5C9FFF 0xFC59A6 0x26FFD4 0xF0F0F0 0x5C6370 0xFB055A 0x26FFD4 0xFEBE7E 0x55ADFF 0xFD95D0 0x26FFD4 0xF0F0F0 0xF0F0F0 0x1D1E20 0xF0F0F0 +Paper 0x000000 0xcc3e28 0x216609 0xb58900 0x1e6fcc 0x5c21a5 0x158c86 0xaaaaaa 0x555555 0xcc3e28 0x216609 0xb58900 0x1e6fcc 0x5c21a5 0x158c86 0xaaaaaa 0x000000 0xf2eede 0x000000 +PapercolorDark 0x1C1C1C 0xAF005F 0x5FAF00 0xD7AF5F 0x5FAFD7 0x808080 0xD7875F 0xD0D0D0 0x585858 0x5FAF5F 0xAFD700 0xAF87D7 0xFFAF00 0xFF5FAF 0x00AFAF 0x5F8787 0xD0D0D0 0x1C1C1C 0xD0D0D0 +PapercolorLight 0xEEEEEE 0xAF0000 0x008700 0x5F8700 0x0087AF 0x878787 0x005F87 0x444444 0xBCBCBC 0xD70000 0xD70087 0x8700AF 0xD75F00 0xD75F00 0x005FAF 0x005F87 0x444444 0xEEEEEE 0x444444 +Pixiefloss 0x2F2942 0xFF857F 0x48B685 0xE6C000 0xAE81FF 0xEF6155 0xC2FFDF 0xF8F8F2 0x75507B 0xF1568E 0x5ADBA2 0xD5A425 0xC5A3FF 0xEF6155 0xC2FFFF 0xF8F8F0 0xD1CAE8 0x241F33 0xD1CAE8 +Powershell 0x000000 0x7E0008 0x098003 0xC4A000 0x010083 0xD33682 0x0E807F 0x7F7C7F 0x808080 0xEF2929 0x1CFE3C 0xFEFE45 0x268AD2 0xFE13FA 0x29FFFE 0xC2C1C3 0xF6F6F7 0x052454 0xF6F6F7 +Predawn 0xF18260 0xB51A20 0xA6CC75 0xFED33A 0x81B2B1 0xEB6C4E 0x81B2B1 0xEAEAEA 0x666666 0xFF000B 0xC4EE94 0xE8E06D 0xA5EBEA 0xEF8A50 0xA5EBEA 0xFFFFFF 0xF1F1F1 0x282828 0xF1F1F1 +PurplePeopleEater 0x0D1117 0xE34C26 0x238636 0xED9A51 0xA5D6FF 0x6EB0E8 0xC09AEB 0xC9D1D9 0x0D1117 0xFF7B72 0x3BAB4A 0xFFA657 0xA5D6FF 0x79C0FF 0xB694DF 0xC9D1D9 0xC9D1D9 0x161B22 0xC9D1D9 +Quiet 0x141414 0xC16262 0x49B685 0xC5B76D 0x4992B6 0x815BBE 0x41A4A4 0xC5C5C5 0x505050 0xED5E7A 0x7ECE7E 0xDBDB70 0x4DBFFF 0xC067E4 0x70DBD8 0xF0F0F0 0xB9B9B9 0x141414 0xA0A0A0 +RoséPine 0x26233A 0xEB6F92 0x9CCFD8 0xF6C177 0x31748F 0xC4A7E7 0xEBBCBA 0xE0DEF4 0x6E6A86 0xEB6F92 0x9CCFD8 0xF6C177 0x31748F 0xC4A7E7 0xEBBCBA 0xE0DEF4 0xE0DEF4 0x191724 0xE0DEF4 +RoséPineDawn 0xF2E9E1 0xB4637A 0x56949F 0xEA9D34 0x286983 0x907AA9 0xD7827E 0x575279 0x9893A5 0xB4637A 0x56949F 0xEA9D34 0x286983 0x907AA9 0xD7827E 0x575279 0x575279 0xFAF4ED 0x575279 +RoséPineMoon 0x393552 0xEB6F92 0x9CCFD8 0xF6C177 0x3E8FB0 0xC4A7E7 0xEA9A97 0xE0DEF4 0x6E6A86 0xEB6F92 0x9CCFD8 0xF6C177 0x3E8FB0 0xC4A7E7 0xEA9A97 0xE0DEF4 0xE0DEF4 0x232136 0xE0DEF4 +Sat 0x000000 0xDD0007 0x07DD00 0xDDD600 0x0007DD 0xD600DD 0x00DDD6 0xF2F2F2 0x7D7D7D 0xFF7478 0x78FF74 0xFFFA74 0x7478FF 0xFA74FF 0x74FFFA 0xFFFFFF 0x23476A 0x758480 0x23476A +SelenizedBlack 0x252525 0xed4a46 0x70b433 0xdbb32d 0x368aeb 0xeb6eb7 0x3fc5b7 0x777777 0x3b3b3b 0xff5e56 0x83c746 0xefc541 0x4f9cfe 0xff81ca 0x56d8c9 0xdedede 0xb9b9b9 0x181818 0xdedede +SelenizedDark 0x184956 0xfa5750 0x75b938 0xdbb32d 0x4695f7 0xf275be 0x41c7b9 0x72898f 0x2d5b69 0xff665c 0x84c747 0xebc13d 0x58a3ff 0xff84cd 0x53d6c7 0xcad8d9 0xadbcbc 0x103c48 0xcad8d9 +SelenizedLight 0xece3cc 0xd2212d 0x489100 0xad8900 0x0072d4 0xca4898 0x009c8f 0x909995 0xd5cdb6 0xcc1729 0x428b00 0xa78300 0x006dce 0xc44392 0x00978a 0x3a4d53 0x53676d 0xfbf3db 0x3a4d53 +SelenizedWhite 0xebebeb 0xd6000c 0x1d9700 0xc49700 0x0064e4 0xdd0f9d 0x00ad9c 0x878787 0xcdcdcd 0xbf0000 0x008400 0xaf8500 0x0054cf 0xc7008b 0x009a8a 0x282828 0x474747 0xffffff 0x282828 +Seoul256 0x4e4e4e 0xd68787 0x5f865f 0xd8af5f 0x85add4 0xd7afaf 0x87afaf 0xd0d0d0 0x626262 0xd75f87 0x87af87 0xffd787 0xadd4fb 0xffafaf 0x87d7d7 0xe4e4e4 0xd0d0d0 0x3a3a3a 0xd0d0d0 +Seoul256Light 0x4e4e4e 0xaf5f5f 0x5f885f 0xaf8760 0x5f87ae 0x875f87 0x5f8787 0xe4e4e4 0x3a3a3a 0x870100 0x005f00 0xd8865f 0x0087af 0x87025f 0x008787 0xeeeeee 0x4e4e4e 0xdadada 0x4e4e4e +Shel 0x2C2423 0xAB2463 0x6CA323 0xAB6423 0x2C64A2 0x6C24A2 0x2CA363 0x918988 0x918988 0xF588B9 0xC2EE86 0xF5BA86 0x8FBAEC 0xC288EC 0x8FEEB9 0xF5EEEC 0x4882CD 0x2A201F 0x4882CD +SolarizedDark 0x073642 0xDC322F 0x859900 0xCF9A6B 0x268BD2 0xD33682 0x2AA198 0xEEE8D5 0x657B83 0xCB4B16 0x859900 0xCF9A6B 0x6c71c4 0xD33682 0x2AA198 0xFDF6E3 0x839496 0x002B36 0x839496 +SolarizedLight 0xEEE8D5 0xDC322F 0x859900 0xB58900 0x268BD2 0xD33682 0x2AA198 0x002B36 0x657b83 0xCB4B16 0x859900 0xB58900 0x6C71C4 0xD33682 0x2AA198 0x073642 0x657B83 0xFDF6E3 0x657B83 +Sonokai 0x2C2E34 0xFC5D7C 0x9ED072 0xE7C664 0xF39660 0xB39DF3 0x76CCE0 0xE2E2E3 0x7F8490 0xFC5D7C 0x9ED072 0xE7C664 0xF39660 0xB39DF3 0x76CCE0 0xE2E2E3 0xE2E2E3 0x2C2E34 0xE2E2E3 +Spacegray 0x000000 0xB04B57 0x87B379 0xE5C179 0x7D8FA4 0xA47996 0x85A7A5 0xB3B8C3 0x000000 0xB04B57 0x87B379 0xE5C179 0x7D8FA4 0xA47996 0x85A7A5 0xFFFFFF 0xB3B8C3 0x20242D 0xB3B8C3 +SpacegrayEighties 0x15171C 0xEC5F67 0x81A764 0xFEC254 0x5486C0 0xBF83C1 0x57C2C1 0xEFECE7 0x555555 0xFF6973 0x93D493 0xFFD256 0x4D84D1 0xFF55FF 0x83E9E4 0xFFFFFF 0xBDBAAE 0x222222 0xBDBAAE +SpacegrayEightiesDull 0x15171C 0xB24A56 0x92B477 0xC6735A 0x7C8FA5 0xA5789E 0x80CDCB 0xB3B8C3 0x555555 0xEC5F67 0x89E986 0xFEC254 0x5486C0 0xBF83C1 0x58C2C1 0xFFFFFF 0xC9C6BC 0x222222 0xC9C6BC +Sparky 0x212322 0xFF585D 0x78D64B 0xFBDD40 0x4698CB 0xD59ED7 0x2DCCD3 0xDEE6DE 0x4B4F54 0xFF7276 0x8EDD65 0xF6EB61 0x69B3E7 0xF99FC9 0x00C1D5 0xD9E1E2 0xF4F5F0 0x072B31 0xF4F5F0 +Srcery 0x1C1B19 0xEF2F27 0x519F50 0xFBB829 0x2C78BF 0xE02C6D 0x0AAEB3 0xBAA67F 0x918175 0xF75341 0x98BC37 0xFED06E 0x68A8E4 0xFF5C8F 0x2BE4D0 0xFCE8C3 0xFCE8C3 0x1C1B19 0xFBB829 +SummerPop 0x666666 0xFF1E8E 0x8EFF1E 0xFFFB00 0x1E8EFF 0xE500E5 0x00E5E5 0xE5E5E5 0x666666 0xFF1E8E 0x8EFF1E 0xFFFB00 0x1E8EFF 0xE500E5 0x00E5E5 0xE5E5E5 0xFFFFFF 0x272822 0xFFFFFF +SweetEliverlara 0x282C34 0xED254E 0x71F79F 0xF9DC5C 0x7CB7FF 0xC74DED 0x00C1E4 0xDCDFE4 0x282C34 0xED254E 0x71F79F 0xF9DC5C 0x7CB7FF 0xC74DED 0x00C1E4 0xDCDFE4 0xC3C7D1 0x282C34 0xC3C7D1 +SweetTerminal 0x3F3F54 0xF60055 0x06C993 0x9700BE 0xF69154 0xEC89CB 0x60ADEC 0xABB2BF 0x959DCB 0xF60055 0x06C993 0x9700BE 0xF69154 0xEC89CB 0x00DDED 0xFFFFFF 0xFFFFFF 0x222235 0xFFFFFF +Symphonic 0x000000 0xDC322F 0x56DB3A 0xFF8400 0x0084D4 0xB729D9 0xCCCCFF 0xFFFFFF 0x1B1D21 0xDC322F 0x56DB3A 0xFF8400 0x0084D4 0xB729D9 0xCCCCFF 0xFFFFFF 0xFFFFFF 0x000000 0xFFFFFF +Synthwave 0x011627 0xFE4450 0x72F1B8 0xFEDE5D 0x03EDF9 0xFF7EDB 0x03EDF9 0xFFFFFF 0x575656 0xFE4450 0x72F1B8 0xFEDE5D 0x03EDF9 0xFF7EDB 0x03EDF9 0xFFFFFF 0xFFFFFF 0x262335 0x03EDF9 +Tender 0x1D1D1D 0xC5152F 0xC9D05C 0xFFC24B 0xB3DEEF 0xD3B987 0x73CEF4 0xEEEEEE 0x323232 0xF43753 0xD9E066 0xFACC72 0xC0EAFB 0xEFD093 0xA1D6EC 0xFFFFFF 0xEEEEEE 0x282828 0xEEEEEE +TerminixDark 0x282A2E 0xA54242 0xA1B56C 0xDE935F 0x225555 0x85678F 0x5E8D87 0x777777 0x373B41 0xC63535 0x608360 0xFA805A 0x449DA1 0xBA8BAF 0x86C1B9 0xC5C8C6 0x868A8C 0x091116 0x868A8C +Tin 0x000000 0x8D534E 0x4E8D53 0x888D4E 0x534E8D 0x8D4E88 0x4E888D 0xFFFFFF 0x000000 0xB57D78 0x78B57D 0xB0B578 0x7D78B5 0xB578B0 0x78B0B5 0xFFFFFF 0xFFFFFF 0x2E2E35 0xFFFFFF +TokyoNight 0x414868 0xF7768E 0x9ECE6A 0xE0AF68 0x7AA2F7 0xBB9AF7 0x7DCFFF 0xA9B1D6 0x414868 0xF7768E 0x9ECE6A 0xE0AF68 0x7AA2F7 0xBB9AF7 0x7DCFFF 0xC0CAF5 0xC0CAF5 0x1A1B26 0xC0CAF5 +TokyoNightLight 0x0F0F14 0x8C4351 0x485E30 0x8F5E15 0x34548A 0x5A4A78 0x0F4B6E 0x343B58 0x9699A3 0x8C4351 0x485E30 0x8F5E15 0x34548A 0x5A4A78 0x0F4B6E 0x343B58 0x565A6E 0xD5D6DB 0x565A6E +TokyoNightStorm 0x414868 0xF7768E 0x9ECE6A 0xE0AF68 0x7AA2F7 0xBB9AF7 0x7DCFFF 0xC0CAF5 0x414868 0xF7768E 0x9ECE6A 0xE0AF68 0x7AA2F7 0xBB9AF7 0x7DCFFF 0xC0CAF5 0xC0CAF5 0x24283B 0xC0CAF5 +Ura 0x000000 0xC21B6F 0x6FC21B 0xC26F1B 0x1B6FC2 0x6F1BC2 0x1BC26F 0x808080 0x808080 0xEE84B9 0xB9EE84 0xEEB984 0x84B9EE 0xB984EE 0x84EEB9 0xE5E5E5 0x23476A 0xFEFFEE 0x23476A +Vag 0x303030 0xA87139 0x39A871 0x71A839 0x7139A8 0xA83971 0x3971A8 0x8A8A8A 0x494949 0xB0763B 0x3BB076 0x76B03B 0x763BB0 0xB03B76 0x3B76B0 0xCFCFCF 0xD9E6F2 0x191F1D 0xD9E6F2 +VsCodeDark+ 0x6A787A 0xE9653B 0x39E9A8 0xE5B684 0x44AAE6 0xE17599 0x3DD5E7 0xC3DDE1 0x598489 0xE65029 0x00FF9A 0xE89440 0x009AFB 0xFF578F 0x5FFFFF 0xD9FBFF 0xCCCCCC 0x1E1E1E 0xCCCCCC +VsCodeLight+ 0x020202 0xCD3232 0x00BC00 0xA5A900 0x0752A8 0xBC05BC 0x0598BC 0x343434 0x5E5E5E 0xCD3333 0x1BCE1A 0xADBB5B 0x0752A8 0xC451CE 0x52A8C7 0xA6A3A6 0x020202 0xF9F9F9 0x020202 +Website 0x183c44 0xda4949 0xbcca15 0xffb02e 0x35a6e6 0xd343a2 0x38c995 0xffe8c1 0x235662 0xff5757 0xecff14 0xffd694 0x4cbfff 0xff4cc2 0x35ffb6 0xffd48f 0xd1b890 0x132f35 0xd1b890 +Wzoreck 0x2E3436 0xFC6386 0xA9DC76 0xFCE94F 0xFB976B 0x75507B 0x34E2E2 0xFFFFFF 0x989595 0xFC6386 0xA9DC76 0xFCE94F 0xFB976B 0xAB9DF2 0x34E2E2 0xD1D1C0 0xFCFCFA 0x424043 0xFCFCFA diff --git a/.local/share/blesh/contrib/colorglass.bash b/.local/share/blesh/contrib/colorglass.bash new file mode 100644 index 0000000..c89779d --- /dev/null +++ b/.local/share/blesh/contrib/colorglass.bash @@ -0,0 +1,610 @@ +# bash + +bleopt/declare -v colorglass_gamma 0 +bleopt/declare -v colorglass_contrast 0 +bleopt/declare -v colorglass_rotate 0 +bleopt/declare -v colorglass_saturation 0 +bleopt/declare -v colorglass_brightness 0 +bleopt/declare -v colorglass_alpha 255 +bleopt/declare -v colorglass_color 0x8888FF +#bleopt/declare -v colorglass_color 0xFF8888 + +function bleopt/check:colorglass_gamma { + if ! ((value=value,value>-100)); then + ble/util/print "bleopt colorglass_gamma: invalid value '$value'" >&2 + return 1 + fi + ble/color/g2sgr/.clear-cache + _ble_contrib_colorglass_gamma=() + return 0 +} +function bleopt/check:colorglass_contrast { + if ! ((value=value,-100<=value&&value<=100)); then + ble/util/print "bleopt colorglass_contrast: invalid value '$value'" >&2 + return 1 + fi + ble/color/g2sgr/.clear-cache + _ble_contrib_colorglass_contrast=() + return 0 +} +function bleopt/check:colorglass_rotate { + ((value=value%360,value<0&&(value+=360))) + ble/color/g2sgr/.clear-cache + return 0 +} +function bleopt/check:colorglass_saturation { + if ! ((value=value,-100<=value&&value<=100)); then + ble/util/print "bleopt colorglass_saturation: invalid value '$value'" >&2 + return 1 + fi + ble/color/g2sgr/.clear-cache + return 0 +} +function bleopt/check:colorglass_brightness { + if ! ((value=value,-100<=value&&value<=100)); then + ble/util/print "bleopt colorglass_brightness: invalid value '$value'" >&2 + return 1 + fi + ble/color/g2sgr/.clear-cache + return 0 +} +function bleopt/check:colorglass_color { + ble/color/g2sgr/.clear-cache + return 0 +} +function bleopt/check:colorglass_alpha { ble/color/g2sgr/.clear-cache; return 0; } + +bleopt -I colorglass_@ + +_ble_contrib_colorglass_gamma=() +function ble/contrib/colorglass/.gamma { + local x=$1 + ret=${_ble_contrib_colorglass_gamma[x]-} + [[ $ret ]] && return 0 + local g=$(((100+bleopt_colorglass_gamma)*_ble_fixed_unit/100)) + ble/fixed-point#pow "$((x*_ble_fixed_unit/255))" "$g" + ble/fixed-point#round "$((ret*255))" + ((ret=ret/_ble_fixed_unit,ret<0?(ret=0):(ret>255&&(ret=255)))) + _ble_contrib_colorglass_gamma[x]=$ret +} + +_ble_contrib_colorglass_contrast=() +function ble/contrib/colorglass/.contrast { + local x=$1 + ret=${_ble_contrib_colorglass_contrast[x]-} + [[ $ret ]] && return 0 + + local c=$bleopt_colorglass_contrast + if ((c==-100)); then + ((ret=x==0?-_ble_fixed_unit:(x==255?_ble_fixed_unit:0))) + else + if ((c>0)); then + ((c=_ble_fixed_unit-c*_ble_fixed_unit/100)) + else + ((c=_ble_fixed_unit*_ble_fixed_unit/(_ble_fixed_unit+c*_ble_fixed_unit/100))) + fi + ble/fixed-point#pow "$((2*x*_ble_fixed_unit/255-_ble_fixed_unit))" "$c" + fi + ble/fixed-point#round "$(((ret+_ble_fixed_unit)*255/2))" + ((ret=ret/_ble_fixed_unit,ret<0?(ret=0):(ret>255&&(ret=255)))) + _ble_contrib_colorglass_contrast[x]=$ret +} + +#------------------------------------------------------------------------------ +# Color blindness simulation +# based on https://mk.bcgsc.ca/colorblind/math.mhtml + +bleopt/declare -n colorglass_blindness none +function bleopt/check:colorglass_blindness { + case $value in + (protanopia|deuteranopia|tritanopia|achromatopsia|none) + ble/color/g2sgr/.clear-cache + return 0 ;; + (*) + ble/util/print "bleopt colorglass_blindness: invalid value '$value'" >&2 + return 1 ;; + esac +} + +function ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.2 { + ret=$1 + ((ret=ret*_ble_fixed_unit/255)) + if ((ret<=2651)); then + # if (value <= 0.04045) return value / 12.92; + ble/fixed-point#mul "$ret" 5072 + else + # return pow((value + 0.055) / 1.055, 2.4); + ble/fixed-point#mul "$((ret+3604))" 62119 + ble/fixed-point#pow "$ret" 157286 + fi +} +function ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.2 { + ret=$1 + if ((ret<=0)); then + ret=0 + elif ((ret<205)); then + # if (value <= 0.0031308) value *= 12.92; + ble/fixed-point#mul "$ret" 846725 + elif ((ret<_ble_fixed_unit)); then + # if (value < 1.0) value = 1.055 * value ^ (1.0 / 2.4) - 0.055; + ble/fixed-point#pow "$ret" 27307 + ble/fixed-point#mul "$ret" 69141 + ((ret-=3604)) + else + ((ret=_ble_fixed_unit)) + fi + ((ret=(ret*255+_ble_fixed_unit/2)/_ble_fixed_unit)) +} + +_ble_contrib_colorglass_sRGB_to_lRGB=() +_ble_contrib_colorglass_lRGB_to_sRGB=() +function ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.1 { + local value=$1 + if ((value<=0)); then + ret=0 + elif ((value>=255)); then + ((ret=_ble_fixed_unit)) + else + ret=${_ble_contrib_colorglass_sRGB_to_lRGB[value]-} + if [[ ! $ret ]]; then + ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.2 "$value" + _ble_contrib_colorglass_sRGB_to_lRGB[value]=$ret + fi + fi +} +function ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.1 { + local value=$1 + if ((value<=0)); then + ret=0 + elif ((value>=_ble_fixed_unit)); then + ((ret=255)) + else + ret=${_ble_contrib_colorglass_lRGB_to_sRGB[value]-} + if [[ ! $ret ]]; then + ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.2 "$value" + _ble_contrib_colorglass_lRGB_to_sRGB[value]=$ret + fi + fi +} + +## @fn ble/contrib/colorglass/blindness/.sRGB-to-lRGB +## @var[ref] R G B +function ble/contrib/colorglass/blindness/.sRGB-to-lRGB { + local ret + ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.1 "$R"; R=$ret + ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.1 "$G"; G=$ret + ble/contrib/colorglass/blindness/.sRGB-to-lRGB/.1 "$B"; B=$ret +} + +## @fn ble/contrib/colorglass/blindness/.lRGB-to-sRGB +## @var[ref] R G B +function ble/contrib/colorglass/blindness/.lRGB-to-sRGB { + local ret + ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.1 "$R"; R=$ret + ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.1 "$G"; G=$ret + ble/contrib/colorglass/blindness/.lRGB-to-sRGB/.1 "$B"; B=$ret +} + +## @fn ble/contrib/colorglass/blindness/simulate type +## @var[ref] R G B +function ble/contrib/colorglass/blindness/simulate { + case $1 in + (protanopia) + # \begin{matrix} + # 0.170556992 & 0.829443014 & 0 \\ + # 0.170556991 & 0.829443008 & 0 \\ + # -0.004517144 & 0.004517144 & 1 + # \end{matrix} + ble/contrib/colorglass/blindness/.sRGB-to-lRGB + local v1=$(((R*11178+G*54358)/_ble_fixed_unit)) + local v2=$(((-R*295+G*296)/_ble_fixed_unit+B)) + ((R=v1,G=v1,B=v2)) + ble/contrib/colorglass/blindness/.lRGB-to-sRGB ;; + (deuteranopia) + # \begin{matrix} + # 0.33066007 & 0.66933993 & 0 \\ + # 0.33066007 & 0.66933993 & 0 \\ + # -0.02785538 & 0.02785538 & 1 + # \end{matrix} + ble/contrib/colorglass/blindness/.sRGB-to-lRGB + local v1=$(((R*21670+G*43866)/_ble_fixed_unit)) + local v2=$(((-R*1825+G*1826)/_ble_fixed_unit+B)) + ((R=v1,G=v1,B=v2)) + ble/contrib/colorglass/blindness/.lRGB-to-sRGB ;; + (tritanopia) + # \begin{matrix} + # 1 & 0.1273989 & -0.1273989 \\ + # 0 & 0.8739093 & 0.1260907 \\ + # 0 & 0.8739093 & 0.1260907 + # \end{matrix} + ble/contrib/colorglass/blindness/.sRGB-to-lRGB + local v1=$(((G*8349-B*8348)/_ble_fixed_unit+R)) + local v2=$(((G*57273+B*8263)/_ble_fixed_unit)) + ((R=v1,G=v2,B=v2)) + ble/contrib/colorglass/blindness/.lRGB-to-sRGB ;; + (achromatopsia) + # \begin{matrix} + # 0.2126 & 0.7152 & 0.0722 \\ + # 0.2126 & 0.7152 & 0.0722 \\ + # 0.2126 & 0.7152 & 0.0722 + # \end{matrix} + ble/contrib/colorglass/blindness/.sRGB-to-lRGB + local v1=$(((R*13933+G*46871+B*4732)/_ble_fixed_unit)) + ((R=v1,G=v1,B=v1)) + ble/contrib/colorglass/blindness/.lRGB-to-sRGB ;; + esac +} + +#------------------------------------------------------------------------------ + +_ble_contrib_colorglass_base16_palette=() + +bleopt/declare -v colorglass_base16_palette '' +function bleopt/check:colorglass_base16_palette { + value=${value//["$_ble_term_IFS"]} + if [[ ! $value ]]; then + _ble_contrib_colorglass_base16_palette=() + else + local file=${BASH_SOURCE[0]%.*}.base16.dat + if [[ ! -s $file ]]; then + ble/util/print "bleopt colorglass_base16_palette: database '$file' not found." >&2 + return 1 + fi + + local -a colors + local -x key=$value + ble/util/assign-words colors 'ble/bin/awk '\''BEGIN { key = ENVIRON["key"]; } $0 !~ /^[[:blank:]]*#/ && $1 == key { $1 = ""; print; }'\'' "$file"' + if ((${#colors[@]}==0)); then + ble/util/print "bleopt colorglass_base16_palette: invalid palette '$value'." >&2 + return 1 + fi + + _ble_contrib_colorglass_base16_palette=("${colors[@]}") + fi + ble/color/g2sgr/.clear-cache + return 0 +} + +## @fn ble/contrib/colorglass.filter +## @var[ref] ccode +function ble/contrib/colorglass.filter { + # 24bit color + local R= G= B= dirty= + if ((ccode<16)); then + local hex=${_ble_contrib_colorglass_base16_palette[ccode]-} + if [[ $hex ]]; then + ((hex=hex,R=0xFF&hex>>16,G=0xFF&hex>>8,B=0xFF&hex,dirty=1)) + elif ((ccode==7)); then + ((R=G=B=0xAA)) + elif ((ccode==8)); then + ((R=G=B=0x55)) + else + local L=$((ccode>=8?0xFF:0x80)) + ((R=(ccode&1)?L:0)) + ((G=(ccode&2)?L:0)) + ((B=(ccode&4)?L:0)) + fi + elif ((ccode<256)); then + local index_colors=$_ble_color_index_colors_default + [[ $bleopt_term_index_colors == auto ]] || ((index_colors=bleopt_term_index_colors)) + if ((index_colors==88)); then + # xterm-88color (16+4x4x4+8grey) + if ((ccode>=80)); then + ((R=G=B=46+25*(ccode-80))) + else + local k + ((k=(ccode-16)/16 ,R=k?81+k*58:0)) + ((k=(ccode-16)/4%4,G=k?81+k*58:0)) + ((k=(ccode-16)%4 ,B=k?81+k*58:0)) + fi + else + # xterm-256color (16+6x6x6+24grey) + if ((ccode>=232)); then + ((R=G=B=8+10*(ccode-232))) + else + local k + ((k=(ccode-16)/36 ,R=k?55+k*40:0)) + ((k=(ccode-16)/6%6,G=k?55+k*40:0)) + ((k=(ccode-16)%6 ,B=k?55+k*40:0)) + fi + fi + elif ((0x1000000<=ccode&&ccode<=0x1FFFFFF)); then + ((R=0xFF&ccode>>16)) + ((G=0xFF&ccode>>8)) + ((B=0xFF&ccode)) + fi + + local rot=$((bleopt_colorglass_rotate)) + local sat=$((bleopt_colorglass_saturation)) + local bright=$((bleopt_colorglass_brightness)) + if ((rot||sat||bright)); then + dirty=1 + local Min x y h + case $((R<=B?(R<=G?0:1):(G<=B?1:2))) in + (0) Min=$R x=$((G-Min)) y=$((B-Min)) h=1200 ;; + (1) Min=$G x=$((B-Min)) y=$((R-Min)) h=2400 ;; + (2) Min=$B x=$((R-Min)) y=$((G-Min)) h=0 ;; + esac + local Range=$((x>y?x:y)) + if ((Range)); then + if ((x>y)); then + ((h+=y*600/x)) + else + ((h+=1200-x*600/y)) + fi + fi + ((h=(h+rot*10)%3600)) + + if ((bright)); then + ((bright=_ble_fixed_unit*bright/100)) + if ((bright<0)); then + ((bright=_ble_fixed_unit+bright)) + ((Min=Min*bright/_ble_fixed_unit)) + ((Range=Range*bright/_ble_fixed_unit)) + else + ((bright=_ble_fixed_unit-bright)) + ((Min=255-(255-Min)*bright/_ble_fixed_unit)) + ((Range=Range*bright/_ble_fixed_unit)) + fi + fi + + if ((sat)); then + ((sat=_ble_fixed_unit*sat/100)) + if ((sat<0)); then + ((sat=-sat)) + ((Min+=Range*sat/(2*_ble_fixed_unit))) + ((Range=Range*(_ble_fixed_unit-sat)/_ble_fixed_unit)) + else + local delta=$(((255-Range)*sat/_ble_fixed_unit)) Max + ((Max=Min+Range+delta/2,Max>255&&(Max=255))) + ((Min-=delta/2,Min<0&&(Min=0))) + ((Range=Max-Min)) + fi + fi + + local h1 h2 x=$Min y=$Min z=$Min + ((h1=h%1200,h2=1200-h1, + x+=Range*(h2<600?h2:600)/600, + y+=Range*(h1<600?h1:600)/600)) + case $((h/1200)) in + (0) R=$x G=$y B=$z ;; + (1) R=$z G=$x B=$y ;; + (2) R=$y G=$z B=$x ;; + esac + fi + + local alpha=$((bleopt_colorglass_alpha)) + if ((alpha!=255)); then + dirty=1 + local min max ofac + if ((RB?G:B)) + else + ((min=GB?R:B)) + fi + ((ofac=max<255-min?max:255-min)) + ((ofac=ofac*2<255?ofac*2:255)) + ((alpha=alpha*ofac/255)) + if ((alpha)); then + local c1=$((bleopt_colorglass_color)) + local r1=$((0xFF&c1>>16)) + local g1=$((0xFF&c1>>8)) + local b1=$((0xFF&c1)) + ((R=r1+(R-r1)*alpha/255)) + ((G=g1+(G-g1)*alpha/255)) + ((B=b1+(B-b1)*alpha/255)) + fi + fi + + if ((bleopt_colorglass_contrast)); then + dirty=1 + local ret + ble/contrib/colorglass/.contrast "$R"; R=$ret + ble/contrib/colorglass/.contrast "$G"; G=$ret + ble/contrib/colorglass/.contrast "$B"; B=$ret + fi + + if ((bleopt_colorglass_gamma)); then + dirty=1 + local ret + ble/contrib/colorglass/.gamma "$R"; R=$ret + ble/contrib/colorglass/.gamma "$G"; G=$ret + ble/contrib/colorglass/.gamma "$B"; B=$ret + fi + + if [[ $bleopt_colorglass_blindness != none ]]; then + dirty=1 + ble/contrib/colorglass/blindness/simulate "$bleopt_colorglass_blindness" + fi + + ((dirty)) && ((ccode=0x1000000|R<<16|G<<8|B)) + return 0 +} +_ble_color_color2sgr_filter=ble/contrib/colorglass.filter + +#------------------------------------------------------------------------------ + +_ble_fixed_unit=0x10000 +_ble_fixed_e=$((0x2b7e1)) +_ble_fixed_ln2=$((0xb172)) +_ble_fixed_log2=$((0x4d10)) + +function ble/fixed-point#tostr { + ret=$1 + ((ret=(ret*1000000+5)/(_ble_fixed_unit*10))) + ret=0000$ret + ret=${ret::${#ret}-5}.${ret:${#ret}-5} + ble/string#match "$ret" '^0+' && + ret=${ret:${#BASH_REMATCH}} + ret=${ret/#./0.} +} + +function ble/fixed-point#round { + local x=$1 + ((x+=x>=0?_ble_fixed_unit/2:-_ble_fixed_unit/2, + ret=x/_ble_fixed_unit*_ble_fixed_unit)) +} + +function ble/fixed-point#mul { + if (($#)); then + ret=$1; shift + local a + for a; do ((ret=ret*a/_ble_fixed_unit)); done + else + ret=$_ble_fixed_unit + fi +} + +function ble/fixed-point#div { + if (($#)); then + ret=$1; shift + local a + for a; do ((ret=ret*_ble_fixed_unit/a)); done + else + ret=$_ble_fixed_unit + fi +} + +_ble_fixed_sqrt=() +function ble/fixed-point#sqrt { + local x=$1 + if ((x<=0)); then + ret=0 + elif [[ ${_ble_fixed_sqrt[x]} ]]; then + ret=${_ble_fixed_sqrt[x]} + else + local y=$x c=0 dy + while ((c++<=16&&(dy=(x*_ble_fixed_unit-y*y)/(2*y)))); do + ((y+=dy)) + done + + # 微修正 + local res=$((x*_ble_fixed_unit-y*y)) + if ((res<0)); then + while ((res+y<=0)); do + ((res+=2*y---1)) + done + elif ((res>0)); then + while ((0>=1)); do + ((xx=xx*xx/_ble_fixed_unit)) + done + ((x>_ble_fixed_unit)) && ble/array#reverse fac + ble/fixed-point#mul "${fac[@]}" + ((out=out*ret/_ble_fixed_unit)) + fi + + if ((p=y&0xFFFF)); then + xx=$x fac=() + while + ble/fixed-point#sqrt "$xx" + xx=$ret + (((p<<=1)&_ble_fixed_unit)) && ble/array#push fac "$xx" + ((p&0xFFFF)) + do ((1)); done + ((x<_ble_fixed_unit)) && ble/array#reverse fac + ble/fixed-point#mul "${fac[@]}" + ((out=out*ret/_ble_fixed_unit)) + fi + fi + ((ret=out*sgn)) +} +function ble/fixed-point#exp { + ble/fixed-point#pow "$_ble_fixed_e" "$1" +} + +function ble/fixed-point#lb { + local x=$1 + ((x<0&&(x=-x))) + if ((x==0)); then + ((ret=-32*_ble_fixed_unit)) + elif ((x==_ble_fixed_unit)); then + ret=0 + else + local p=0 + if ((x>=_ble_fixed_unit)); then + while ((x>=256*_ble_fixed_unit)); do ((p+=8,x>>=8)); done + while ((x>=8*_ble_fixed_unit)); do ((p+=3,x>>=3)); done + while ((x>=2*_ble_fixed_unit)); do ((p+=1,x>>=1)); done + else + while ((x<256)); do ((p-=8,x<<=8)); done + while ((x<_ble_fixed_unit/8)); do ((p-=3,x<<=3)); done + while ((x<_ble_fixed_unit)); do ((p--,x<<=1)); done + fi + local out=$((p*_ble_fixed_unit)) + + local bit=$_ble_fixed_unit l + ((ret=2*_ble_fixed_unit)) + for l in {1..8}; do + ((bit/=2)) + ble/fixed-point#sqrt "$ret" + ((x>=ret)) && ((x=x*_ble_fixed_unit/ret,out+=bit)) + done + ((x-=_ble_fixed_unit)) + ((out+=(_ble_fixed_unit-x/2)*x/_ble_fixed_unit*_ble_fixed_unit/_ble_fixed_ln2)) + ret=$out + fi +} +function ble/fixed-point#ln { + ble/fixed-point#lb "$1" + ((ret=ret*_ble_fixed_ln2/_ble_fixed_unit)) +} +function ble/fixed-point#log { + ble/fixed-point#lb "$1" + ((ret=ret*_ble_fixed_log2/_ble_fixed_unit)) +} + +# --- test codes --- + +# ble/fixed-point#lb "$((e=2718281828*_ble_fixed_unit/1000000000))" +# printf "lb e = %x\n" "$ret" +# ble/fixed-point#tostr "$((_ble_fixed_unit*_ble_fixed_unit/ret))" +# echo "ln 2 = $ret" +# ble/fixed-point#log "$((2*_ble_fixed_unit))" +# ble/fixed-point#tostr "$ret" +# echo "$ret" + +# ble/fixed-point#sqrt $((0x0100)) +# time for a in {0..256}; do +# ble/fixed-point#sqrt "$((a*_ble_fixed_unit/256))" +# sqrt[a]=$ret +# # ble/fixed-point#tostr "$((ret*ret*256/_ble_fixed_unit))" +# # printf "$a -> %x -> $ret\n" "$sqrt" +# done +# ble/fixed-point#pow $((2*_ble_fixed_unit)) $((3*_ble_fixed_unit)) +# ble/fixed-point#tostr "$ret" +# echo "$ret" +# ble/fixed-point#pow $((2*_ble_fixed_unit)) $((_ble_fixed_unit/2)) +# ble/fixed-point#tostr "$ret" +# echo "$ret" + +# for x in {0..256}; do +# for y in {0..256}; do +# ble/fixed-point#pow "$((x*256))" "$((y*256))" +# ble/fixed-point#tostr "$ret" +# echo "$x $y $ret" +# done +# echo +# done | awk 'NF == 3 {print $1,$2,$3,($1/256)^($2/256);next}{print}' > colorglass.pow.txt diff --git a/.local/share/blesh/contrib/config/execmark.bash b/.local/share/blesh/contrib/config/execmark.bash new file mode 100644 index 0000000..d14e7c4 --- /dev/null +++ b/.local/share/blesh/contrib/config/execmark.bash @@ -0,0 +1,155 @@ +# blesh/contrib/config/execmark.bash (C) 2022, Koichi Murase +# +# Example setup +# +# ```bash +# # blerc +# ble-import -d contrib/config/execmark +# bleopt exec_elapsed_enabled='_ble_exec_time_tot>=1000' +# ``` +# + +_ble_contrib_config_execmark_status_name=( + [0]=EXIT_SUCCESS + [1]=EXIT_FAILURE + [2]=usage_error + + # Used by bash + [124]=progcomp_restart + [126]=permisson_denied + [127]=command_not_found + + # From /usr/include/sysexits.h + [64]=EX_USAGE + [65]=EX_DATAERR + [66]=EX_NOINPUT + [67]=EX_NOUSER + [68]=EX_NOHOST + [69]=EX_UNAVAILABLE + [70]=EX_SOFTWARE + [71]=EX_OSERR + [72]=EX_OSFILE + [73]=EX_CANTCREAT + [74]=EX_IOERR + [75]=EX_TEMPFAIL + [76]=EX_PROTOCOL + [77]=EX_NOPERM + [78]=EX_CONFIG +) +function ble/contrib/config:execmark/.statusname { + name= + if [[ ${name:=${_ble_contrib_config_execmark_status_name[exit]}} ]]; then + return 0 + elif ((128<=exit&&exit<=255)) && [[ ${name:=${_ble_builtin_trap_sig_name[exit&127]}} ]]; then + return 0 + else + return 1 + fi +} + +function ble/contrib/config:execmark/.getsec { + local msec=$1 sec + if ((msec==0)); then + ret=0 + elif ((msec<1000)); then + ret=${msec}ms + else + ((sec=msec/1000,msec%=1000)) + msec=000$msec msec=${msec:${#msec}-3} + ret=$sec.$msec + fi +} + +function ble/contrib/config:execmark/postexec.hook { + local command=$_ble_edit_exec_BASH_COMMAND + + if ((_ble_edit_exec_lastexit)) || ble/exec/time#mark-enabled; then + local ret + local sgr=$'\e[;94m' sgrC=$'\e[38:5:244m' sgr0=$'\e[m' + ble/color/face2sgr-ansi syntax_varname; local sgrV=$ret + ble/color/face2sgr-ansi command_function; local sgrS=$ret + ble/color/face2sgr-ansi varname_number; local sgrN=$ret + + # exit + if ((_ble_edit_exec_lastexit)); then + local sgrE=$'\e[;91m' + local exit=$_ble_edit_exec_lastexit name= + if ble/contrib/config:execmark/.statusname; then + exit=$'\e[1m'"$name"$'\e[22m'" ($sgrN$exit$sgrE)" + else + exit="exit $sgrN$exit$sgrE" + fi + local mark=$sgrE'[ble: '$exit']'$sgr0 + x=0 y=0 g=0 LINES=1 ble/canvas/trace "$mark" confine:truncate + ble/util/buffer.print "$ret" + fi + + # ata + local ata=$_ble_exec_time_ata + local d=${#ata} sec min hour + if ((d<=3)); then + ata=${ata}us + elif ((d<=5)); then + ata=${ata::d-3}.${ata:d-3:6-d}ms + elif ((d<=6)); then + ata=${ata::3}ms + elif ((d<=9)); then + ata=${ata::${#ata}-6}.${ata:${#ata}-6:3}s + elif ((sec=ata/(1000*1000),min=sec/60,sec%=60,min<100)); then + ata="${min}m${sec}s" + elif ((hour=min/60,min%=60,hour<100)); then + ata="${hour}h${min}m${sec}s" + else + ata="$((hour/24))d$((hour%24))h${min}m" + fi + ata="${sgrV}elapsed$sgr $sgrN$ata$sgr" + + # cpu + local cpu='--.-%' + if ((_ble_exec_time_tot)); then + cpu=$(((_ble_exec_time_usr+_ble_exec_time_sys)*1000/_ble_exec_time_tot)) + cpu=$((cpu/10)).$((cpu%10))% + fi + cpu="${sgrV}CPU$sgr $sgrN$cpu$sgr" + if [[ $_ble_exec_time_usr_self && $_ble_exec_time_sys_self ]]; then + local usr0=$_ble_exec_time_usr_self + local sys0=$_ble_exec_time_sys_self + local usr1=$((_ble_exec_time_usr-_ble_exec_time_usr_self)) + local sys1=$((_ble_exec_time_sys-_ble_exec_time_sys_self)) + + local ret max=0 + ble/contrib/config:execmark/.getsec "$usr0"; local usr0s=$ret + ble/contrib/config:execmark/.getsec "$sys0"; local sys0s=$ret + ((usr0>max)) && max=$usr0 + ((sys0>max)) && max=$sys0 + if ((usr1||sys1)); then + ble/contrib/config:execmark/.getsec "$usr1"; local usr1s=$ret + ble/contrib/config:execmark/.getsec "$sys1"; local sys1s=$ret + ((usr1>max)) && max=$usr1 + ((sys1>max)) && max=$sys1 + fi + + ((usr0==max)) && usr0s=$'\e[1m'$usr0s$'\e[22m' + ((sys0==max)) && sys0s=$'\e[1m'$sys0s$'\e[22m' + cpu="$cpu $sgrS(self)${sgrV}usr$sgrN$usr0s$sgr/${sgrV}sys$sgrN$sys0s$sgr" + if ((usr1||sys1)); then + ((usr1==max)) && usr1s=$'\e[1m'$usr1s$'\e[22m' + ((sys1==max)) && sys1s=$'\e[1m'$sys1s$'\e[22m' + cpu="$cpu+$sgrS(child)${sgrV}usr$sgrN${usr1s}$sgr/${sgrV}sys$sgrN${sys1s}$sgr" + fi + else + local ret + ble/contrib/config:execmark/.getsec "$_ble_exec_time_usr"; local usr=$ret + ble/contrib/config:execmark/.getsec "$_ble_exec_time_sys"; local sys=$ret + cpu="$cpu ${usr}usr/${sys}sys" + fi + + local msg=$sgr'[ble: '$ata', '$cpu']'$sgr0 + local ret; ble/string#ltrim "$command"; msg="$msg${ret:+ $sgrC$ret$sgr0}" + x=0 y=0 g=0 LINES=1 ble/canvas/trace "$msg" confine:truncate + ble/util/buffer.print "$ret" + fi +} +bleopt exec_errexit_mark= +bleopt exec_elapsed_mark= +blehook POSTEXEC!=ble/contrib/config:execmark/postexec.hook diff --git a/.local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash b/.local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash new file mode 100644 index 0000000..0187307 --- /dev/null +++ b/.local/share/blesh/contrib/config/github265-prompt-path-level-colors.bash @@ -0,0 +1,31 @@ +# blesh-contrib/config/github265-prompt-path-level-colors.bash (C) 2022, Koichi Murase +# +# Example: +# +# ble-import /config/github265-prompt-path-level-colors +# PS1='[\u@\h \q{github265/pwd}]\$ ' +# +_ble_contrib_config_github265_pwd_gspecs=(fg=27 fg=57 fg=141 fg=63) + +function ble/prompt/backslash:github265/pwd { + ble/prompt/unit/add-hash '$PWD' + ble/prompt/.update-working-directory + local str=$prompt_cache_wd + + local -a dirs=() + while ble/string#match "$str" '^([^/]*/|[^/]+$)'; do + ble/array#push dirs "$BASH_REMATCH" + str=${str:${#BASH_REMATCH}} + done + + local count=${#dirs[@]} + local n=${#_ble_contrib_config_github265_pwd_gspecs[@]} index ret + for dir in "${dirs[@]}"; do + ((index=--count,index + +# The option "bleopt complete_source_sabbrev_command_ignore" specifies a +# colon-separated list of glob patterns of command names for which the sabbrev +# completion should be suppressed. +bleopt/declare -v complete_source_sabbrev_command_ignore '' + +_ble_contrib_config_github288_command_ignore_patterns=() +function bleopt/check:complete_source_sabbrev_command_ignore { + if [[ $value ]]; then + ble/string#split _ble_contrib_config_github288_command_ignore_patterns : "$value" + else + _ble_contrib_config_github288_command_ignore_patterns=() + fi +} +bleopt -I complete_source_sabbrev_command_ignore + +# This is an "advice" function for the exiting function +# "ble/complete/source:sabbrev", i.e., the function to modify the behavior of +# the original function. We insert some codes before starting the original +# processing. +function ble/contrib/config:github288/filter-sabbrev-completion.advice { + # If we are generating sabbrevs as a part of argument completions and if + # there are any ignore patterns for the command names in + # "complete_source_sabbrev_command_ignore", we make the sabbrev completions + # inactive for the commands matching an ignore pattern. + if [[ ${ADVICE_FUNCNAME[1]} == ble/complete/source:argument ]]; then + if ((${#_ble_contrib_config_github288_command_ignore_patterns[@]})); then + # Extract the command name and arguments on the current caret position. + local comp_words comp_line comp_point comp_cword + ble/syntax:bash/extract-command "$_ble_edit_ind" || return 1 + + # If the command word is simple enough, we evaluate the command word to + # resolve quoting and parameter expansions. + local cmd=${comp_words[0]} ret + ble/syntax:bash/simple-word/safe-eval "$cmd" nonull && cmd=$ret + + # If the command name matches any pattern of the ignored list, we return + # the function without calling the original function. + ble/complete/string#match-patterns "$cmd" "${_ble_contrib_config_github288_command_ignore_patterns[@]}" && + return 1 + fi + fi + + # We call the original "ble/complete/source:sabbrev" here. The original + # function, i.e., the advice target, can be called by ble/function#advice/do. + ble/function#advice/do +} + +function ble/contrib/config:github288/initialize.hook { + # We hook the above "advice" function to "ble/complete/source:sabbrev". + ble/function#advice around ble/complete/source:sabbrev ble/contrib/config:github288/filter-sabbrev-completion.advice +} +blehook/eval-after-load complete ble/contrib/config:github288/initialize.hook diff --git a/.local/share/blesh/contrib/config/github296-named-execmark.bash b/.local/share/blesh/contrib/config/github296-named-execmark.bash new file mode 100644 index 0000000..d272053 --- /dev/null +++ b/.local/share/blesh/contrib/config/github296-named-execmark.bash @@ -0,0 +1,21 @@ +# blesh/contrib/config/github296-named-execmark.bash (C) 2023, Koichi Murase + +function ble/contrib/config:github296/named-execmark.hook { + local lastexit=$? command=$1 + + if ((lastexit)) && ! ble/string#match "$command" $'^[[:blank:]]*#[^\n]+$'; then + local sgr=$'\e[;94m' sgr0=$'\e[m' sgrE=$'\e[;91m' ret + ble/color/face2sgr-ansi varname_number; local sgrN=$ret + + local exit=$lastexit name= + if ((exit>=128)) && [[ ${name:=${_ble_builtin_trap_sig_name[exit&127]}} ]]; then + exit=$'\e[1m'"$name"$'\e[22m'" ($sgrN$exit$sgrE)" + else + exit="exit $sgrN$exit$sgrE" + fi + local mark=$sgrE'[ble: '$exit']'$sgr0 + ble/util/buffer.print "$mark" + fi +} +bleopt exec_errexit_mark= +blehook POSTEXEC!=ble/contrib/config:github296/named-execmark.hook diff --git a/.local/share/blesh/contrib/config/github302-perlre-server.bash b/.local/share/blesh/contrib/config/github302-perlre-server.bash new file mode 100644 index 0000000..70f8bc1 --- /dev/null +++ b/.local/share/blesh/contrib/config/github302-perlre-server.bash @@ -0,0 +1,76 @@ +# ble.sh contrib/config/github302-perlre-server.bash +# Copyright 2023 Britton Kerin +# Copyright 2023 Koichi Murase + +# This file illustrates an example usage of "ble/util/bgproc#open" from module +# "util.bgproc". The server code in the shell function +# "ble/contrib/config:github302/perlre-server" was taken from the report by +# Britton Kerin at Ref. [1]. +# +# [1] https://lists.gnu.org/archive/html/help-bash/2023-03/msg00068.html +# +# Note: This example does not consider the case that the background process +# terminates by an error, crashes, etc. + +ble-import util.bgproc + +function ble/contrib/config:github302/perlre-server { + exec perl <(cat <<' END_PERL' + use strict; use warnings; + $| = 1; + while ( 1 ) { + my $rex = <>; + chomp($rex); + my $str = <>; + if ( $str =~ m/$rex/ ) { + # FIXME: Sadly this die argument doesn't show anywhere: + defined($1) or die 'group $1 unexpectedly undefined'; + print length($1); + } + print "\n"; + } + END_PERL + ) 2>/dev/tty +} + +if ble/util/bgproc#open perlre_server ble/contrib/config:github302/perlre-server; then + # The main shell can send a request to fd ${perlre_server_bgproc[1]} and can + # read from fd ${perlre_server_bgproc[0]}. + ble/util/print "ble/contrib/config:github30: perlre-server (${perlre_server_bgproc[4]}) has started." >&2 +else + ble/util/print 'ble/contrib/config:github30: failed to start perlre-server' >&2 + return 1 +fi + +## @fn ble/contrib/config:github302/perlre-match rex str +## Matches the regex REX against the string STR and returns the length of the +## string captured by the first matching group ($1). +## +## @param[in] rex +## The regex to match in "perlre" syntax. +## @param[in] str +## The string to be matched by REX. +## @var[out] ret +## The resulting length of the string matched by the first capture group is +## stored in this variable. When REX does not match STR, an empty value is +## stored in this variable. +## @exit 0 if REX successfully matches STR, or otherwise 1. +## +function ble/contrib/config:github302/perlre-match { + local IFS=$' \t\n' + + # Only takes the first lines of both because newlines in requests confuse the + # server. + local rex=${1%%$'\n'*} str=${2%%$'\n'*} + + # We send the requests to fd ${perlre_server_bgproc[1]}. + ble/util/print-lines "$rex" "$str" >&"${perlre_server_bgproc[1]}" + + # We can read the resposnes from fd ${perlre_server_bgproc[0]}. We set a + # timeout to `read' so that it doesn't lock forever in case that the expected + # output is not obtained by accident (e.g., for the reason that REX did not + # contain any capturing group accessible through $1). + ble/bash/read-timeout 1 -r -u "${perlre_server_bgproc[0]}" ret + + [[ $ret ]] +} diff --git a/.local/share/blesh/contrib/config/github481-elapsed-mark-without-command.bash b/.local/share/blesh/contrib/config/github481-elapsed-mark-without-command.bash new file mode 100644 index 0000000..0916263 --- /dev/null +++ b/.local/share/blesh/contrib/config/github481-elapsed-mark-without-command.bash @@ -0,0 +1,30 @@ +# blesh/contrib/config/github481-elapsed-mark-without-command.bash (C) 2024, Koichi Murase + +bleopt/declare -v github481_elapsed_mark $'\e[94m[ble: elapsed %s (CPU %s%%)]\e[m' + +function ble/contrib/config:github481/elapsed-mark-without-command.hook { + ble/exec/time#mark-enabled || return 0 + + local ret + ble/edit/marker#get-config github481_elapsed_mark || return 0 + local format=$ret + + # ata + local ret + ble/exec/time#format-elapsed-time; local ata=$ret + + # cpu + local cpu='--.-' + if ((_ble_exec_time_tot)); then + cpu=$(((_ble_exec_time_usr+_ble_exec_time_sys)*1000/_ble_exec_time_tot)) + cpu=$((cpu/10)).$((cpu%10)) + fi + + local mark + ble/util/sprintf mark "$format" "$ata" "$cpu" + ble/edit/marker#instantiate "$mark" bare && + ble/util/buffer.print "$mark" +} + +bleopt exec_elapsed_mark= +blehook POSTEXEC!=ble/contrib/config:github481/elapsed-mark-without-command.hook diff --git a/.local/share/blesh/contrib/config/github483-elapsed-mark-on-error.bash b/.local/share/blesh/contrib/config/github483-elapsed-mark-on-error.bash new file mode 100644 index 0000000..dcc76a4 --- /dev/null +++ b/.local/share/blesh/contrib/config/github483-elapsed-mark-on-error.bash @@ -0,0 +1,31 @@ +# blesh/contrib/config/github483-elapsed-mark-on-error.bash (C) 2024, Koichi Murase + +bleopt/declare -v github483_elapsed_mark $'\e[94m[ble: elapsed %s (CPU %s%%)]\e[m' + +function ble/contrib/config:github483/elapsed-mark-on-error.hook { + ((_ble_edit_exec_lastexit)) || ble/exec/time#mark-enabled || return 0 + + local ret + ble/edit/marker#get-config github483_elapsed_mark || return 0 + local format=$ret + + # ata + local ret + ble/exec/time#format-elapsed-time; local ata=$ret + + # cpu + local cpu='--.-' + if ((_ble_exec_time_tot)); then + cpu=$(((_ble_exec_time_usr+_ble_exec_time_sys)*1000/_ble_exec_time_tot)) + cpu=$((cpu/10)).$((cpu%10)) + fi + + local mark ret + ble/util/sprintf mark "$format" "$ata" "$cpu" + ble/string#ltrim "$_ble_edit_exec_BASH_COMMAND" + ble/edit/marker#instantiate "$mark $ret" bare && + ble/util/buffer.print "$ret" +} + +bleopt exec_elapsed_mark= +blehook POSTEXEC!=ble/contrib/config:github483/elapsed-mark-on-error.hook diff --git a/.local/share/blesh/contrib/config/github499-append-to-last-modified.bash b/.local/share/blesh/contrib/config/github499-append-to-last-modified.bash new file mode 100644 index 0000000..7bf0b15 --- /dev/null +++ b/.local/share/blesh/contrib/config/github499-append-to-last-modified.bash @@ -0,0 +1,37 @@ +# blesh/contrib/config/github499-append-to-last-modified.bash +# (C) 2024, Koichi Murase +# +# Example: +# +# # ~/.blerc +# ble-import config/github499-append-to-last-modified +# ble-bind -f 'M-insert' github499/append-to-last-modified +# +# References: +# +# https://github.com/akinomyoga/ble.sh/discussions/499 +# + +_ble_contrib_github499_last_modified_index= +function ble/contrib/config:github499/record-last-modified-index { + local reason=${4-} + [[ $reason == history ]] && return 0 + local index + ble/history/get-index + _ble_contrib_github499_last_modified_index=$index +} +ble/array#push _ble_edit_dirty_observer ble/contrib/config:github499/record-last-modified-index + +function ble/widget/github499/append-to-last-modified { + local ins=$_ble_edit_str + [[ $ins ]] || return 1 + + local index=$_ble_contrib_github499_last_modified_index + [[ $index ]] || ble/history/get-count -v index + ble-edit/history/goto "$index" + [[ $_ble_edit_str && $_ble_edit_str != *$'\n' ]] && ins=$'\n'$ins + local p=${#_ble_edit_str} + ble-edit/content/replace-limited "$p" "$p" "$ins" + ((_ble_edit_ind=${#_ble_edit_str})) + return 0 +} diff --git a/.local/share/blesh/contrib/config/readline.bash b/.local/share/blesh/contrib/config/readline.bash new file mode 100644 index 0000000..45eca98 --- /dev/null +++ b/.local/share/blesh/contrib/config/readline.bash @@ -0,0 +1,128 @@ +# blesh/contrib/config/readline.bash (C) 2025, Koichi Murase +# +# Example setup +# +# ```bash +# # blerc +# ble-import -d config/readline +# ``` + +# Disable syntax highlighting +bleopt highlight_syntax= + +# Disable highlighting based on filenames +bleopt highlight_filename= + +# Disable highlighting based on variable types +bleopt highlight_variable= + +# Disable auto-complete (Note: auto-complete is enabled by default in bash-4.0+) +bleopt complete_auto_complete= + +# Disable auto-complete based on the command history +bleopt complete_auto_history= + +# Disable ambiguous completion +bleopt complete_ambiguous= + +# Disable menu-complete by TAB +bleopt complete_menu_complete= + +# Disable menu filtering (Note: auto-complete is enabled by default in bash-4.0+) +bleopt complete_menu_filter= + +# Disable EOF marker like "[ble: EOF]" +bleopt prompt_eol_mark='' + +# Disable error exit marker like "[ble: exit %d]" +bleopt exec_errexit_mark= + +# Disable elapsed-time marker like "[ble: elapsed 1.203s (CPU 0.4%)]" +bleopt exec_elapsed_mark= + +# Disable exit marker like "[ble: exit]" +bleopt exec_exit_mark= + +# Disable some other markers like "[ble: ...]" +bleopt edit_marker= +bleopt edit_marker_error= + +# Turn off Readline settings enabled by ble.sh +bind 'set skip-completed-text off' +bind 'set colored-stats off' +bind 'set colored-completion-prefix off' + +# Use audible bell instead of visible bell for editing error +bleopt edit_bell=abell +bleopt decode_error_@_vbell= +bleopt decode_error_@_abell=1 + +function ble/contrib/config:readline/emacs-load-hook { + # Disable magic expansions + ble-bind -m emacs -f 'SP' self-insert + ble-bind -m emacs -f '/' self-insert + + # Disable multiline mode + ble-bind -m emacs -f 'C-m' 'accept-line syntax' + ble-bind -m emacs -f 'RET' 'accept-line syntax' + ble-bind -m emacs -f 'C-j' 'accept-line syntax' + + # Immediately run commands with RET in isearch + ble-bind -m isearch -f 'C-m' isearch/accept-line + ble-bind -m isearch -f 'RET' isearch/accept-line + + # Emulate Readline for non-incremental searches + ble-bind -m emacs -f 'prior' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x up' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x C-p' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'next' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x down' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x C-n' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x ,' 'history-nsearch-backward-again hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x .' 'history-nsearch-forward-again hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x <' 'history-nsearch-backward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x >' 'history-nsearch-forward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x n' 'history-substring-search-forward hide-status:point=end:immediate-accept' + ble-bind -m emacs -f 'C-x p' 'history-substring-search-backward hide-status:point=end:immediate-accept' +} +blehook/eval-after-load keymap_emacs ble/contrib/config:readline/emacs-load-hook + +function ble/contrib/config:readline/vim-load-hook { + # Disable magic expansions + ble-bind -m vi_imap -f 'SP' self-insert + ble-bind -m vi_imap -f '/' self-insert + + # Disable multiline mode + ble-bind -m vi_imap -f 'C-m' 'accept-line syntax' + ble-bind -m vi_imap -f 'RET' 'accept-line syntax' + ble-bind -m vi_imap -f 'C-j' 'accept-line syntax' + ble-bind -m vi_nmap -f 'C-m' 'accept-line syntax' + ble-bind -m vi_nmap -f 'RET' 'accept-line syntax' + ble-bind -m vi_nmap -f 'C-j' 'accept-line syntax' + + # Discard lines with C-c + ble-bind -m vi_imap -f 'C-c' discard-line + ble-bind -m vi_nmap -f 'C-c' discard-line + + # Use incremental search also in vi_nmap + ble-bind -m vi_nmap -f 'C-r' history-isearch-backward + + # Immediately run commands with RET in isearch + ble-bind -m isearch -f 'C-m' isearch/accept-line + ble-bind -m isearch -f 'RET' isearch/accept-line + + # Emulate Readline for non-incremental searches + ble-bind -m vi_imap -f 'prior' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x up' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x C-p' 'history-search-backward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'next' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x down' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x C-n' 'history-search-forward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x ,' 'history-nsearch-backward-again hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x .' 'history-nsearch-forward-again hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x <' 'history-nsearch-backward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x >' 'history-nsearch-forward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x n' 'history-substring-search-forward hide-status:point=end:immediate-accept' + ble-bind -m vi_imap -f 'C-x p' 'history-substring-search-backward hide-status:point=end:immediate-accept' +} +blehook/eval-after-load keymap_vi ble/contrib/config:readline/vim-load-hook diff --git a/.local/share/blesh/contrib/fzf-completion.bash b/.local/share/blesh/contrib/fzf-completion.bash new file mode 100644 index 0000000..3d430bf --- /dev/null +++ b/.local/share/blesh/contrib/fzf-completion.bash @@ -0,0 +1,101 @@ +# ble/contrib/integration/fzf-completion.bash (C) 2020-2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +# fzf/shell/completion.bash を未ロードの時のみロードする +if ! ble/is-function _fzf_complete; then + ble-import contrib/integration/fzf-initialize || return 1 + if [[ -f $_ble_contrib_fzf_base/completion.bash ]]; then + source -- "$_ble_contrib_fzf_base/completion.bash" + elif [[ -f $_ble_contrib_fzf_base/shell/completion.bash ]]; then + source -- "$_ble_contrib_fzf_base/shell/completion.bash" + elif [[ $_ble_contrib_fzf_base == */share/fzf && -f /etc/bash_completion.d/fzf ]]; then + source /etc/bash_completion.d/fzf + elif [[ $_ble_contrib_fzf_base == __eval_fzf_bash__ ]]; then + ble/util/eval-stdout '"$_ble_contrib_fzf_path" --bash | sed -n "/### completion/,/### end/p"' + fi +fi + +# clear blesh completer for cd +blehook/eval-after-load complete 'builtin unset -f ble/cmdinfo/complete:cd' + +# patch fzf functions +ble-import contrib/integration/fzf.common +ble/function#advice -f around __fzf_generic_path_completion 'ble/contrib/integration:fzf/complete.advice' +ble/function#advice -f around _fzf_complete 'ble/contrib/integration:fzf/complete.advice keep-stdin' +ble/function#advice -f around _fzf_complete_kill 'ble/contrib/integration:fzf/complete.advice' +ble/function#advice -f around _fzf_handle_dynamic_completion 'ble/contrib/integration:fzf/handle_dynamic_completion.advice' + +if ble/is-function __fzf_orig_completion_get_orig_func; then + ## @fn ble/contrib/integration:fzf/orig_completion_get_orig_func.advice + ## @var[ref] comp_opts + function ble/contrib/integration:fzf/orig_completion_get_orig_func.advice { + if ((ADVICE_EXIT==0)); then + local comp_func=$REPLY comp_prog= + ble/complete/progcomp/adjust-third-party-completions + fi + } + ble/function#advice after __fzf_orig_completion_get_orig_func 'ble/contrib/integration:fzf/orig_completion_get_orig_func.advice' +elif ble/is-function _fzf_handle_dynamic_completion; then + _ble_contrib_fzf_adjust_dynamic_completion=1 +fi + +#------------------------------------------------------------------------------ +# Extensions + +# This widget can be used to trigger fzf's '**' completion from a keybinding. +function ble/widget/fzf-complete { + local handler=_fzf_${1:-path}_completion + if ! ble/is-function "$handler"; then + ble/widget/.bell "unrecognized fzf-complete type '$1' (function '$handler' not found)" + return 1 + fi + + ((_ble_edit_ind==0)) && return 0 + + # If the width of the box-drawing characters in the current terminal is not + # 1, we specify --no-unicode to fzf to suppress the use of the box-drawing + # characters. + if [[ " ${FZF_COMPLETION_OPTS-} " != *' --no-unicode '* ]]; then + local ret + ble/util/c2w 0x2500 + ((ret==1)) || + local FZF_COMPLETION_OPTS="--no-unicode${FZF_COMPLETION_OPTS:+ $FZF_COMPLETION_OPTS}" + fi + + # Mask completion settings cached by fzf + local -a fzf_orig_completions + fzf_orig_completions=("${!_fzf_orig_completion_@}") + local "${fzf_orig_completions[@]/%/=}" # disable=#D1570 + + # Replace the programmable-completion setting + local completion_save + ble/util/assign completion_save 'complete -p' + complete -r + if ((_ble_bash>=40100)); then + complete -F "$handler" -D + complete -F "$handler" -E + else + complete -F "$handler" _DefaultCmD_ + complete -F "$handler" _EmptycmD_ + fi + if ((_ble_bash>=50000)); then + complete -F "$handler" -I + else + complete -F "$handler" _InitialWorD_ + fi + + # Disable completion auto-loader + ble/function#push _comp_load 'return 1' + + # Trigger fzf-completion without '**' + local FZF_COMPLETION_TRIGGER= + + ble/widget/complete; local ext=$? + + # restore the settings + ble/function#pop _comp_load + complete -r + builtin eval -- "$completion_save" + return "$ext" +} diff --git a/.local/share/blesh/contrib/fzf-git.bash b/.local/share/blesh/contrib/fzf-git.bash new file mode 100644 index 0000000..059b70d --- /dev/null +++ b/.local/share/blesh/contrib/fzf-git.bash @@ -0,0 +1,322 @@ +# Copyright (c) 2016, 2022 Junegunn Choi +# ble/contrib/integration/fzf-git.bash (C) 2020, 2023, akinomyoga +# +# 2020-04-16 https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 (Revision 2019-03-14) +# 2023-06-30 https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 (Revision 2022-08-16) +# 2023-06-30 https://github.com/junegunn/fzf-git.sh/commit/4bc0323b4822b3426989863996cc266c52c7f25a +# 2023-06-30 https://github.com/junegunn/fzf-git.sh/commit/b6192ec86609afea761c7d3954f9b539a512dc80 +# 2023-11-09 https://github.com/junegunn/fzf-git.sh/blob/aacab4ae557657e0f9de288d688f312a28b86d21/fzf-git.sh + +if [[ $- != *i* ]]; then + if (($# == 1)); then + function ble/contrib/integration:fzf-git/sub:branches { + git branch "$@" --sort=-committerdate --sort=-HEAD --format=$'%(HEAD) %(color:yellow)%(refname:short) %(color:green)(%(committerdate:relative))\t%(color:blue)%(subject)%(color:reset)' --color=always | column -ts$'\t' + } + function ble/contrib/integration:fzf-git/sub:refs { + git for-each-ref --sort=-creatordate --sort=-HEAD --color=always --format=$'%(refname) %(color:green)(%(creatordate:relative))\t%(color:blue)%(subject)%(color:reset)' | + builtin eval -- "$1" | + sed 's#^refs/remotes/#\x1b[95mremote-branch\t\x1b[33m#; s#^refs/heads/#\x1b[92mbranch\t\x1b[33m#; s#^refs/tags/#\x1b[96mtag\t\x1b[33m#; s#refs/stash#\x1b[91mstash\t\x1b[33mrefs/stash#' | + column -ts$'\t' + } + case $1 in + (branches) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-A (show all branches)\n' + ble/contrib/integration:fzf-git/sub:branches + ;; + (all-branches) + printf '%s\n' $'CTRL-O (open in browser)\n' + ble/contrib/integration:fzf-git/sub:branches -a + ;; + (refs) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-E (examine in editor) ╱ ALT-A (show all refs)\n' + ble/contrib/integration:fzf-git/sub:refs 'grep -v ^refs/remotes' + ;; + (all-refs) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-E (examine in editor)\n' + ble/contrib/integration:fzf-git/sub:refs 'cat' + ;; + (nobeep) ;; + (*) exit 1 ;; + esac + elif (($# > 1)); then + set -e + + branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + if [[ $branch = HEAD ]]; then + branch=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD) + fi + + # Only supports GitHub for now + case $1 in + (commit) + hash=$(grep -o "[a-f0-9]\{7,\}" <<< "$2") + path=/commit/$hash + ;; + (branch|remote-branch) + branch=$(sed 's/^[* ]*//' <<< "$2" | cut -d' ' -f1) + remote=$(git config branch."${branch}".remote || printf 'origin\n') + branch=${branch#$remote/} + path=/tree/$branch + ;; + (remote) + remote=$2 + path=/tree/$branch + ;; + (file) path=/blob/$branch/$(git rev-parse --show-prefix)$2 ;; + (tag) path=/releases/tag/$2 ;; + (*) exit 1 ;; + esac + + remote=${remote:-$(git config branch."${branch}".remote || printf 'origin\n')} + remote_url=$(git remote get-url "$remote" 2> /dev/null || printf '%s\n' "$remote") + + if [[ $remote_url =~ ^git@ ]]; then + url=${remote_url%.git} + url=${url#git@} + url=https://${url/://} + elif [[ $remote_url =~ ^http ]]; then + url=${remote_url%.git} + fi + + case $(uname -s) in + (Darwin) open "$url$path" ;; + (*) xdg-open "$url$path" ;; + esac + fi + exit 0 +fi + +#------------------------------------------------------------------------------ + +ble-import contrib/integration/fzf-initialize + +[[ $- == *i* ]] || return 0 + +## @fn ble/contrib/integration:fzf-git/initialize bash_source +## @param[in] bash_source +## @var[out] __fzf_git +function ble/contrib/integration:fzf-git/initialize { + local ret + ble/util/readlink "$1" + __fzf_git=$ret +} +ble/contrib/integration:fzf-git/initialize "${BASH_SOURCE[0]:-}" + +# GIT heart FZF +# ------------- + +#------------------------------------------------------------------------------ +# Redefine this function to change the options +_fzf_git_fzf() { + fzf-tmux -p80%,60% -- \ + --layout=reverse --multi --height=50% --min-height=20 --border \ + --border-label-pos=2 \ + --color='header:italic:underline,label:blue' \ + --preview-window='right,50%,border-left' \ + --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" +} + +function ble/contrib/integration:fzf-git/fzf { + [[ $_ble_term_state == internal ]] && ble/term/leave-for-widget + _fzf_git_fzf "$@" + local ext=$? + [[ $_ble_term_state == internal ]] && ble/term/enter-for-widget + return "$ext" +} + +_fzf_git_check() { + git rev-parse HEAD > /dev/null 2>&1 && return 0 + + [[ -n $TMUX ]] && tmux display-message "Not in a git repository" + return 1 +} + +if [[ -z $_fzf_git_cat ]]; then + # Sometimes bat is installed as batcat + export _fzf_git_cat="cat" + _fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=always --pager=never" + if command -v batcat > /dev/null; then + _fzf_git_cat="batcat $_fzf_git_bat_options" + elif command -v bat > /dev/null; then + _fzf_git_cat="bat $_fzf_git_bat_options" + fi +fi + +_fzf_git_files() { + _fzf_git_check || return "$?" + (git -c color.status=always status --short --no-branch + git ls-files | grep -vxFf <(git status -s | grep '^[^?]' | cut -c4-; ble/util/print :) | sed 's/^/ /') | + ble/contrib/integration:fzf-git/fzf -m --ansi --nth 2..,.. \ + --border-label '📁 Files' \ + --header $'CTRL-O (open in browser) ╱ ALT-E (open in editor)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \ + --bind "alt-e:execute:${EDITOR:-vim} {-1} > /dev/tty" \ + --preview "git diff --no-ext-diff --color=always -- {-1} | sed 1,4d; $_fzf_git_cat {-1}" "$@" | + cut -c4- | sed 's/.* -> //' +} + +_fzf_git_branches() { + _fzf_git_check || return "$?" + bash "$__fzf_git" branches | + ble/contrib/integration:fzf-git/fzf --ansi \ + --border-label '🌲 Branches' \ + --header-lines 2 \ + --tiebreak begin \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \ + --bind "alt-a:change-prompt(🌳 All branches> )+reload:bash \"$__fzf_git\" all-branches" \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' "$@" | + sed 's/^..//' | cut -d' ' -f1 +} + +_fzf_git_tags() { + _fzf_git_check || return "$?" + git tag --sort -version:refname | + ble/contrib/integration:fzf-git/fzf --preview-window right,70% \ + --border-label '📛 Tags' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \ + --preview 'git show --color=always {}' "$@" +} + +_fzf_git_hashes() { + _fzf_git_check || return "$?" + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | + ble/contrib/integration:fzf-git/fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \ + --border-label '🍡 Hashes' \ + --header $'CTRL-O (open in browser) ╱ CTRL-D (diff) ╱ CTRL-S (toggle sort)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ + --bind 'ctrl-d:execute:grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git diff > /dev/tty' \ + --color hl:underline,hl+:underline \ + --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git show --color=always' "$@" | + awk 'match($0, /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/) { print substr($0, RSTART, RLENGTH) }' +} + +_fzf_git_remotes() { + _fzf_git_check || return "$?" + git remote -v | awk '{print $1 "\t" $2}' | uniq | + ble/contrib/integration:fzf-git/fzf --tac \ + --border-label '📡 Remotes' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \ + --preview-window right,70% \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {1}/"$(git rev-parse --abbrev-ref HEAD)"' "$@" | + cut -d$'\t' -f1 +} + +_fzf_git_stashes() { + _fzf_git_check || return "$?" + git stash list | ble/contrib/integration:fzf-git/fzf \ + --border-label '🥡 Stashes' \ + --header $'CTRL-X (drop stash)\n\n' \ + --bind 'ctrl-x:execute-silent(git stash drop {1})+reload(git stash list)' \ + -d: --preview 'git show --color=always {1}' "$@" | + cut -d: -f1 +} + +_fzf_git_lreflogs() { + _fzf_git_check || return "$?" + git reflog --color=always --format="%C(blue)%gD %C(yellow)%h%C(auto)%d %gs" | ble/contrib/integration:fzf-git/fzf --ansi \ + --border-label '📒 Reflogs' \ + --preview 'git show --color=always {1}' "$@" | + awk '{print $1}' +} + +_fzf_git_each_ref() { + _fzf_git_check || return "$?" + bash "$__fzf_git" refs | ble/contrib/integration:fzf-git/fzf --ansi \ + --nth 2,2.. \ + --tiebreak begin \ + --border-label '☘️ Each ref' \ + --header-lines 2 \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git {1} {2}" \ + --bind "alt-e:execute:${EDITOR:-vim} <(git show {2}) > /dev/tty" \ + --bind "alt-a:change-prompt(🍀 Every ref> )+reload:bash \"$__fzf_git\" all-refs" \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {2}' "$@" | + awk '{print $2}' +} +#------------------------------------------------------------------------------ + +# export FZF_DEFAULT_OPTS=--no-unicode + +: "${_ble_contrib_fzf_git_config=key-binding}" + +# original +function ble/contrib:integration/fzf-git/type:original/init { + ble/builtin/bind '"\er": redraw-current-line' +} +function ble/contrib:integration/fzf-git/type:original { + local binding='"\C-g\C-'$1'": "$(_fzf_git_'$2')\e\C-e\er"' + ble/builtin/bind "$binding" +} +# function ble/contrib:integration/fzf-git/type:original { +# local binding='"\C-g\C-'$1'": "$(_fzf_git_'$2')\M-\C-e\M-\C-l"' +# bind "$binding" +# } + +function ble/widget/fzf-git { + ble/widget/insert-string "$(_fzf_git_$1)" + ble/textarea#invalidate +} + +# key-binding +function ble/contrib:integration/fzf-git/type:key-binding { + ble-bind -f "C-g C-$1" "fzf-git $2" +} + +# sabbrev +function ble/contrib:integration/fzf-git/type:sabbrev/init { + function fzf-git.sabbrev { + COMPREPLY=$(_fzf_git_$1) + ble/textarea#invalidate + } +} +function ble/contrib:integration/fzf-git/type:sabbrev { + ble-sabbrev -m "g$1"="fzf-git.sabbrev $2" +} + +# arpeggio +function ble/contrib:integration/fzf-git/type:arpeggio/init { + ble-import 'lib/vim-arpeggio.sh' +} +function ble/contrib:integration/fzf-git/type:arpeggio { + ble/lib/vim-arpeggio.sh/bind -f "g$1" "fzf-git $2" +} + +# old-functions +function ble/contrib:integration/fzf-git/type:old-functions/init { + function is_in_git_repo { _fzf_git_check "$@"; } + function fzf-down { ble/contrib/integration:fzf-git/fzf "$@"; } +} +function ble/contrib:integration/fzf-git/type:old-functions { + # Note: To suppress duplicate adjustment of the terminal states, we override + # "_ble_term_state" with the temporary environment. I.e., when fzf is called + # through these old function names, we never adjust the terminal states. + builtin eval "function g$1 { _ble_term_state= _fzf_git_$2 \"\$@\"; }" +} + +function ble/contrib:integration/fzf-git/initialize { + local type + for type in original key-binding sabbrev arpeggio old-functions; do + [[ :$_ble_contrib_fzf_git_config: == *:"$type":* ]] || continue + + ble/function#try ble/contrib:integration/fzf-git/type:"$type"/init + ble/contrib:integration/fzf-git/type:"$type" f files + ble/contrib:integration/fzf-git/type:"$type" b branches + ble/contrib:integration/fzf-git/type:"$type" t tags + ble/contrib:integration/fzf-git/type:"$type" h hashes + ble/contrib:integration/fzf-git/type:"$type" r remotes + ble/contrib:integration/fzf-git/type:"$type" s stashes + ble/contrib:integration/fzf-git/type:"$type" l lreflogs + ble/contrib:integration/fzf-git/type:"$type" e each_ref + done + builtin unset -f "$FUNCNAME" +} +ble/contrib:integration/fzf-git/initialize diff --git a/.local/share/blesh/contrib/fzf-initialize.bash b/.local/share/blesh/contrib/fzf-initialize.bash new file mode 100644 index 0000000..5344a22 --- /dev/null +++ b/.local/share/blesh/contrib/fzf-initialize.bash @@ -0,0 +1,11 @@ +# ble/contrib/integration/fzf-initialize.bash (C) 2020-2024, akinomyoga + +# Usage: Please write the following lines in blerc +# +# ```bash +# _ble_contrib_fzf_base=/path/to/fzf-base-directory +# ble-import -d integration/fzf-initialize +# ``` + +ble-import contrib/integration/fzf.common +ble/contrib/integration:fzf/locate-shell-settings _ble_contrib_fzf fzf fzf || return 1 diff --git a/.local/share/blesh/contrib/fzf-key-bindings.bash b/.local/share/blesh/contrib/fzf-key-bindings.bash new file mode 100644 index 0000000..8e723fa --- /dev/null +++ b/.local/share/blesh/contrib/fzf-key-bindings.bash @@ -0,0 +1,44 @@ +# ble/contrib/integration/fzf-key-bindings.bash (C) 2020-2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +if ! ble/is-function __fzf_history__; then + ble-import contrib/integration/fzf-initialize || return 1 + ble/function#push bind : + if [[ -f $_ble_contrib_fzf_base/key-bindings.bash ]]; then + source -- "$_ble_contrib_fzf_base/key-bindings.bash" + elif [[ -f $_ble_contrib_fzf_base/shell/key-bindings.bash ]]; then + source -- "$_ble_contrib_fzf_base/shell/key-bindings.bash" + elif [[ $_ble_contrib_fzf_base == __eval_fzf_bash__ ]]; then + ble/util/eval-stdout '"$_ble_contrib_fzf_path" --bash | sed -n "/### key-bindings/,/### end/p"' + fi + ble/function#pop bind +fi + +function ble/contrib/integration:fzf-key-bindings/is-fzf-above-7c447bbd { + local def; ble/function#getdef __fzf_history__ + [[ $def == *READLINE_LINE=* ]] +} + +# CTRL-T - Paste the selected file path into the command line +ble-bind -m emacs -x C-t fzf-file-widget +ble-bind -m vi_imap -x C-t fzf-file-widget +ble-bind -m vi_nmap -s C-t 'i\C-t' + +# CTRL-R - Paste the selected command from history into the command line +ble-bind -m emacs -x C-r fzf-history-widget +ble-bind -m vi_imap -x C-r fzf-history-widget +ble-bind -m vi_nmap -s C-r 'i\C-r' +function fzf-history-widget { + ble/util/assign READLINE_LINE '__fzf_history__' + ble/util/assign READLINE_LINE 'history -p "$READLINE_LINE"' + READLINE_POINT=${#READLINE_LINE} +} +((_ble_bash>=40000)) && + ble/contrib/integration:fzf-key-bindings/is-fzf-above-7c447bbd && + function fzf-history-widget { __fzf_history__; } + +# ALT-C - cd into the selected directory +ble-bind -m emacs -c M-c 'ble/util/eval-stdout "__fzf_cd__"' +ble-bind -m vi_imap -c M-c 'ble/util/eval-stdout "__fzf_cd__"' +ble-bind -m vi_nmap -c M-c 'ble/util/eval-stdout "__fzf_cd__"' diff --git a/.local/share/blesh/contrib/histdb.bash b/.local/share/blesh/contrib/histdb.bash new file mode 100644 index 0000000..262ca89 --- /dev/null +++ b/.local/share/blesh/contrib/histdb.bash @@ -0,0 +1,1607 @@ +# blesh/contrib/histdb (C) 2023, Koichi Murase + +ble/util/assign _ble_histdb_sqlite3 'builtin type -P sqlite3 2>/dev/null' +if [[ ! -x $_ble_histdb_sqlite3 ]]; then + ble/util/print 'contrib/histdb: "sqlite3" is required for this module.' >&2 + return 1 +fi + +ble-import util.bgproc + +_ble_histdb_version=3 + +#------------------------------------------------------------------------------ +# histdb_remarks + +bleopt/declare -v histdb_remarks 'git: \q{contrib/histdb-remarks-git}' + +_ble_histdb_remarks_data=() +function ble/prompt/unit:_ble_histdb_remarks/update { + ble/prompt/unit/add-hash '$bleopt_histdb_remarks' + ble/prompt/unit:{section}/update _ble_histdb_remarks "$bleopt_histdb_remarks" no-trace +} + +## @fn ble/histdb/.get-remarks +## @var[out] remarks +function ble/histdb/.get-remarks { + remarks= + if [[ $bleopt_histdb_remarks ]]; then + local ret + ble/prompt/unit#update _ble_histdb_remarks "$bleopt_histdb_remarks" + ble/prompt/unit:{section}/get _ble_histdb_remarks + remarks=$ret + fi +} + +function ble/prompt/backslash:contrib/histdb-remarks-git { + ble-import prompt-git + + function ble/prompt/backslash:contrib/histdb-remarks-git { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + ble/contrib/prompt-git/initialize || return 0 + ble/contrib/prompt-git/update-head-information + local state; ble/contrib/prompt-git/get-state + local dirty_mark; ble/contrib/prompt-git/get-dirty-mark + + local path=${git_base%.git} + path=${path%/} + path=${path##*?/} + [[ $PWD == "$git_base"/?* ]] && + path="$path/${PWD#$git_base/}" + + ble/prompt/print "git: ${branch:-(detached)} ${hash:-(orphan)}$dirty_mark${state:+ $state} @ ${path:-/}" + } && "$FUNCNAME" +} + +#------------------------------------------------------------------------------ +# background sqlite3 process + +bleopt/declare -v histdb_ignore '' +bleopt/declare -v histdb_file '' + +function ble/histdb/.get-filename { + local basename=${bleopt_histdb_file%.sqlite3} + local hostname=${HOSTNAME:-$_ble_base_env_HOSTNAME} + hostname=${hostname//'/'/'%'} # filename cannot contian / + ret=${basename:-$_ble_base_state/history}${hostname:+@$hostname}.sqlite3 +} + +## @var _ble_histdb_file +_ble_histdb_file= + +## @arr _ble_histdb_bgproc=(fd_response fd_request - bgpid) +## +_ble_histdb_bgproc=() +_ble_histdb_bgproc_fname=() +_ble_histdb_timeout=5000 +_ble_histdb_keepalive=1800 # sec + +function ble/histdb/escape-for-sqlite-glob { + ret=$1 + if [[ $ret == *["[*?"]* ]]; then + local a b + for a in '[' '*' '?'; do + b=[$a] ret=${ret//"$a"/"$b"} + done + fi +} + +function ble/histdb/sqlite3.flush { + if [[ ${_ble_histdb_bgproc[0]} && _ble_bash -ge 40000 ]]; then + local line IFS= + ble/bash/read-timeout 0.001 -r -d '' line <&"${_ble_histdb_bgproc[0]}" + fi +} +function ble/histdb/sqlite3.request { + ble/histdb/sqlite3.open + if [[ ${_ble_histdb_bgproc[1]} ]]; then + ble/histdb/sqlite3.flush + ble/util/print "$1" >&"${_ble_histdb_bgproc[1]}" + else + [[ $1 == .exit ]] && return 0 + "$_ble_histdb_sqlite3" -quote "$_ble_histdb_file" ".timeout $_ble_histdb_timeout" "$1" + fi +} + +function ble/histdb/read-single-value { + local line nl=$'\n' q=\' qq=\'\' Q="'\''" + local IFS= + if ble/bash/read line && [[ $line == \'* ]]; then + local out=$line ext=0 + while ((ext==0)) && ! ble/string#match "$out" '^'"$q"'([^'\'']|'"$qq"')*'"$q"'$'; do + ble/bash/read line; ext=$? + out=$out$nl$line + done + line=$out + fi + line=${line#$q} + line=${line%$q} + line=${line//$qq/$q} + line=$q${line//$q/$Q}$q + ble/util/print "ret=$line" +} + +function ble/histdb/sqlite3.request-single-value { + local query=$1 opts=$2 + ble/histdb/sqlite3.open + if [[ ${_ble_histdb_bgproc[1]} && _ble_bash -ge 40000 ]]; then + ble/histdb/sqlite3.flush + ble/util/print "$query" >&"${_ble_histdb_bgproc[1]}" + + local sync_command='ble/histdb/read-single-value <&"${_ble_histdb_bgproc[0]}"' + local sync_condition='((sync_elapsed<200)) || ! ble/complete/check-cancel' + local sync_opts=progressive-weight + [[ :$opts: == *:auto:* && $bleopt_complete_timeout_auto ]] && + sync_opts=$sync_opts:timeout=$((bleopt_complete_timeout_auto)) + ble/util/assign ret 'ble/util/conditional-sync "$sync_command" "$sync_condition" "" "$sync_opts"' &>/dev/null; local ext=$? + builtin eval -- "$ret" + ((ext==142)) && ext=148 + return "$ext" + else + local out q=\' qq=\'\' + ble/util/assign out '"$_ble_histdb_sqlite3" -quote "$_ble_histdb_file" ".timeout $_ble_histdb_timeout" "$query"' + out=${out#$q} + out=${out%$q} + ret=${out//$qq/$q} + fi +} + +function ble/histdb/sqlite3.proc { + exec "$_ble_histdb_sqlite3" -quote -cmd "-- [ble: $BLE_SESSION_ID]" "$_ble_histdb_file" +} + +_ble_histdb_keepalive_enabled= +ble/is-function ble/util/idle.push && + _ble_histdb_keepalive_enabled=1 + +## @fn ble/histdb/sqlite3.open +## @var[ref] _ble_histdb_file +## @arr[out] _ble_histdb_bgproc +## @arr[out] _ble_histdb_bgproc_fname +function ble/histdb/sqlite3.open { + if [[ $_ble_histdb_file ]]; then + # background process に依らないモードの時は OK + ble/util/bgproc#opened _ble_histdb || return 0 + + ble/util/bgproc#alive _ble_histdb; local state=$? + if ((state==0)); then + ble/util/bgproc#keepalive _ble_histdb + return 0 + else + if ((state==3)); then + # background process が死んでいる時は再度開き直す。 + ble/util/print 'histdb: background sqlite3 is inactive.' >&2 + fi + ble/util/bgproc#start _ble_histdb + return "$?" + fi + fi + + local ret; ble/histdb/.get-filename + _ble_histdb_file=$ret + + local session_id=$_ble_base_session + local start_time=${session_id%%/*} + + IFS=, builtin eval 'local groups="${GROUPS[*]}"' + local user=${USER:-$_ble_base_env_USER} + local hostname=${HOSTNAME:-$_ble_base_env_HOSTNAME} + + local screen_info= ssh_info= + [[ $STY ]] && screen_info="$STY $WINDOW" + [[ $SSH_TTY ]] && ssh_info="$SSH_TTY $SSH_CONNECTION" + + local bgproc_opts=owner-close-on-unload:kill-timeout=60000 + [[ $_ble_histdb_keepalive_enabled ]] && + bgproc_opts=$bgproc_opts:timeout=$((_ble_histdb_keepalive*1000)) + if ble/util/bgproc#open _ble_histdb ble/histdb/sqlite3.proc "$bgproc_opts"; (($?!=0&&$?!=3)); then + # Note: システムが元々サポートしていない場合 ($? == 3) はエラーメッセージは + # 出さない。 + local msg='[ble histdb: background sqlite3 failed to start]' + ble/util/print "${_ble_term_setaf[9]}$msg$_ble_term_sgr0" >&2 + fi + + local ret q=\' qq=\'\' + ble/histdb/sqlite3.request-single-value " + BEGIN IMMEDIATE TRANSACTION; + CREATE TABLE IF NOT EXISTS misc(key TEXT PRIMARY KEY, value INTEGER); + INSERT OR IGNORE INTO misc values('version', $_ble_histdb_version); + CREATE TABLE IF NOT EXISTS sessions( + session_id TEXT PRIMARY KEY, pid INTEGER, ppid INTEGER, + hostname TEXT, user TEXT, uid INTEGER, euid INTEGER, groups TEXT, + start_time INTEGER, start_wd TEXT, + bash_path TEXT, bash_version TEXT, shlvl INTEGER, + blesh_path TEXT, blesh_version TEXT, + term TEXT, lang TEXT, display TEXT, screen_info TEXT, ssh_info TEXT, + tty TEXT, last_time INTEGER, last_wd TEXT); + CREATE TABLE IF NOT EXISTS command_history( + session_id TEXT, command_id INTEGER, + lineno INTEGER, history_index INTEGER, + command TEXT, cwd TEXT, inode INTEGER, issue_time INTEGER, + status INTEGER, + pipestatus TEXT, + lastarg TEXT, + bgpid INTEGER, + exec_time INTEGER, + exec_time_beg INTEGER, + exec_time_end INTEGER, + exec_time_real INTEGER, + exec_time_usr INTEGER, + exec_time_sys INTEGER, + exec_time_cpu INTEGER, + exec_time_usr_self INTEGER, + exec_time_sys_self INTEGER, + exec_time_usr_chld INTEGER, + exec_time_sys_chld INTEGER, + remarks TEXT, + PRIMARY KEY (session_id, command_id)); + CREATE TABLE IF NOT EXISTS words( + word TEXT PRIMARY KEY, count INTEGER, ctime INTEGER, mtime INTEGER); + INSERT OR IGNORE INTO + sessions( + session_id, pid, ppid, + hostname, user, uid, euid, groups, + start_time, start_wd, + bash_path, bash_version, shlvl, + blesh_path, blesh_version, + term, lang, display, screen_info, ssh_info, + tty) + VALUES( + '${session_id//$q/$qq}', '${$//$q/$qq}', '${PPID//$q/$qq}', + '${hostname//$q/$q}', '${user//$q/$qq}', '${UID//$q/$qq}', '${EUID/$q/$qq}', '${groups//$q/$qq}', + '${start_time//$q/$qq}', '${PWD//$q/$qq}', + '${BASH//$q/$qq}', '${BASH_VERSION//$q/$qq}', '${SHLVL//$q/$qq}', + '${_ble_base_blesh//$q/$qq}', '${BLE_VERSION//$q/$qq}', + '${TERM//$q/$qq}', '${LANG//$q/$qq}', '${DISPLAY//$q/$qq}', '${screen_info//$q/$qq}', '${ssh_info//$q/$qq}', + '${_ble_prompt_const_l//$q/$qq}'); + COMMIT; + SELECT VALUE FROM misc WHERE key = 'version';" + local version=$ret + + if [[ $version ]] && ((version<_ble_histdb_version)); then + local query= + ((version<2)) && + query=$query$_ble_term_nl"ALTER TABLE command_history ADD COLUMN inode INTEGER;" + ((version<3)) && + query=$query$_ble_term_nl"ALTER TABLE command_history ADD COLUMN remarks TEXT;" + query=$query$_ble_term_nl"UPDATE misc SET value = $_ble_histdb_version WHERE key = 'version';" + ble/histdb/sqlite3.request "$query" + fi +} + +function ble/util/bgproc/onstart:_ble_histdb { + ble/util/bgproc#post _ble_histdb ".timeout $_ble_histdb_timeout" +} + +function ble/util/bgproc/onstop:_ble_histdb { + ble/util/bgproc#post _ble_histdb '.exit' +} + +function ble/histdb/sqlite3.close { + [[ $_ble_histdb_file ]] || return 0 + local session_id=$_ble_base_session ret + ble/util/time; local time=$ret + ble/histdb/sqlite3.request " + UPDATE sessions SET + last_time = '${time//$q/$qq}', + last_wd = '${PWD//$q/$qq}' + WHERE session_id = '${session_id//$q/$qq}';" + + ble/util/bgproc#close _ble_histdb + _ble_histdb_file= +} + +_ble_histdb_exec_ignore=() +_ble_histdb_exec_cwd= +_ble_histdb_exec_cwd_inode= + +function ble/histdb/update-cwd-inode { + [[ $PWD == "$_ble_histdb_exec_cwd" ]] && return 0 + + _ble_histdb_exec_cwd=$PWD + _ble_histdb_exec_cwd_inode= + if local ret; ble/file#inode "$PWD" && ble/string#match "$ret" '^[0-9]+$'; then + _ble_histdb_exec_cwd_inode=$ret + fi +} + +function ble/histdb/collect-words.proc { + [[ $wtype && ! ${wtype//[0-9]} ]] && + ble/array#push collect_words "${_ble_edit_str:wbeg:wlen}" +} +function ble/histdb/collect-words { + ble-edit/content/update-syntax + local -a collect_words=() + ble/syntax/tree-enumerate-in-range 0 "${#_ble_edit_str}" ble/histdb/collect-words.proc + ble/array#reverse collect_words + + ret=() + local word + "${_ble_util_set_declare[@]//NAME/mark}" # WA #D1570 checked + for word in "${collect_words[@]}"; do + # Note (#D1958): Even if the same words appeared in a single command, we + # only count 1 for one command. This is because the "words" table is + # used for the word completion, where the count is used as an importance + # measure. We count the number of commands where the word appears + # because the same word can easily appear in a single command multiple + # times. + ble/set#contains mark "$word" && return 0 + + ble/set#add mark "$word" + ble/array#push ret "$word" + done +} + +## @fn ble/histdb/exec_register.hook command +## @var[in] command_id +## @var[in] lineno +## これらの変数は exec_register の側で用意される。 +function ble/histdb/exec_register.hook { + local command=$1 + if [[ $bleopt_histdb_ignore ]]; then + local patterns pattern + ble/string#split patterns : "$bleopt_histdb_ignore" + for pattern in "${patterns[@]}"; do + if [[ $command == $pattern ]]; then + _ble_histdb_exec_ignore[command_id]=1 + return 0 + fi + done + fi + builtin unset -v '_ble_histdb_exec_ignore[command_id]' + + local q=\' qq=\'\' + local session_id=$_ble_base_session ret + ble/util/time; local issue_time=$ret + + # @var history_index ... history index: The current command might not be + # registered to the command history, but we always pick up the index of the + # last entry because there is no way to check it reliably. We could compare + # the top element with BASH_COMMAND, but the history entry might be + # transformed by HISTCONTROL=strip, etc. + local history_index; ble/history/get-count -v history_index + ((history_index++)) + + # Expand "bleopt histdb_remarks" + local remarks + ble/histdb/.get-remarks + + local ret word extra_query= + ble/histdb/collect-words + for word in "${ret[@]}"; do + extra_query=$extra_query"INSERT OR REPLACE INTO words(word, count, ctime, mtime) + VALUES('${word//$q/$qq}', + coalesce((SELECT count FROM words WHERE word = '${word//$q/$qq}'), 0) + 1, + coalesce((SELECT ctime FROM words WHERE word = '${word//$q/$qq}'), $issue_time), + $issue_time);" + done + + ble/histdb/update-cwd-inode + local inode=$_ble_histdb_exec_cwd_inode + + ble/histdb/sqlite3.request " + BEGIN IMMEDIATE TRANSACTION; + UPDATE sessions SET + last_time = '${issue_time//$q/$qq}', + last_wd = '${PWD//$q/$qq}' + WHERE session_id = '${session_id//$q/$qq}'; + -- Update duplicate command_id + UPDATE command_history SET + command_id = min(0, (SELECT command_id FROM command_history WHERE session_id = '${session_id//$q/$qq}')) - 1 + WHERE session_id = '${session_id//$q/$qq}' AND command_id = $command_id; + -- Add command_history entry + INSERT INTO command_history( + session_id, command_id, + lineno, history_index, + command, cwd, inode, issue_time, remarks) + VALUES( + '${session_id//$q/$qq}', '${command_id//$q/$qq}', + '${lineno//$q/$qq}', '${history_index//$q/$qq}', + '${command//$q/$qq}', '${PWD//$q/$qq}', ${inode:-NULL}, '${issue_time//$q/$qq}', '${remarks//$q/$qq}'); + $extra_query + COMMIT;" +} + +function ble/histdb/postexec.hook { + local session_id=$_ble_base_session + local command_id=$_ble_edit_exec_command_id + if [[ ${_ble_histdb_exec_ignore[command_id]+set} ]]; then + builtin unset -v '_ble_histdb_exec_ignore[command_id]' + return 0 + fi + + local ret + ble/util/time; local last_time=$ret + + IFS=, builtin eval 'local pipestatus="${_ble_edit_exec_PIPESTATUS[*]}"' + local lastarg=$_ble_edit_exec_lastarg + ((${#lastarg}>=1000)) && lastarg=${lastarg::997}... + + local real=$_ble_exec_time_tot + local usr=$_ble_exec_time_usr + local sys=$_ble_exec_time_sys + local cpu=0; ((real>0)) && cpu=$(((usr+sys)/real)) + local usr_chld=$((usr-_ble_exec_time_usr_self)) + local sys_chld=$((sys-_ble_exec_time_sys_self)) + + local q=\' qq=\'\' + ble/histdb/sqlite3.request " + UPDATE sessions SET + last_time = '${last_time//$q/$qq}', + last_wd = '${PWD//$q/$qq}' + WHERE session_id = '${session_id//$q/$qq}'; + UPDATE command_history SET + status = '${_ble_edit_exec_lastexit//$q/$qq}', + pipestatus = '${pipestatus//$q/$qq}', + lastarg = '${lastarg//$q/$qq}', + bgpid = '${!//$q/$qq}', + exec_time = '${_ble_exec_time_ata//$q/$qq}', + exec_time_beg = '${_ble_exec_time_beg//$q/$qq}', + exec_time_end = '${_ble_exec_time_end//$q/$qq}', + exec_time_real = '${real//$q/$qq}', + exec_time_usr = '${usr//$q/$qq}', + exec_time_sys = '${sys//$q/$qq}', + exec_time_cpu = '${cpu//$q/$qq}', + exec_time_usr_self = '${_ble_exec_time_usr_self//$q/$qq}', + exec_time_sys_self = '${_ble_exec_time_sys_self//$q/$qq}', + exec_time_usr_chld = '${usr_chld//$q/$qq}', + exec_time_sys_chld = '${sys_chld//$q/$qq}' + WHERE session_id = '${session_id//$q/$qq}' AND command_id = $command_id;" +} + +function ble/histdb/backup { + local file=$1 + ble/bin#freeze-utility-path -n gzip || return 1 + + local backup=${file%.sqlite3}.backup.sqlite3 q=\' qq=\'\' + if [[ -s $backup.gz ]]; then + # If there is already an up-to-date backup file, we skip the backup. + local ret now + ble/util/time; now=$ret + ble/file#mtime "$backup.gz" || return 1 + ((now>ret+24*3600)) || return 1 + fi + + "$_ble_histdb_sqlite3" "$file" \ + ".timeout $_ble_histdb_timeout" \ + "PRAGMA quick_check;" \ + ".backup '${backup//$q/$qq}'" \ + "ATTACH DATABASE '${backup//$q/$qq}' AS backup; + PRAGMA backup.quick_check;" >/dev/null && + ble/bin/gzip -c "$backup" >| "$backup.gz.part" && + [[ -s $backup.gz.part ]] && + ble/bin/mv -f "$backup.gz.part" "$backup.gz" && + ble/bin/rm -f "$backup" +} + +function ble/histdb/unload.hook { + if [[ $_ble_histdb_file ]]; then + local file=$_ble_histdb_file + ble/histdb/sqlite3.close + ble/histdb/backup "$file" + fi +} + +# 設定が変化して記録先の history.sqlite3 のパスが変わったら現在のファイルは閉じ +# る。必要になった時に初めて新しいファイルを開く。 +function ble/histdb/exec_end.hook { + local ret; ble/histdb/.get-filename + [[ $ret == "$_ble_histdb_file" ]] || + ((${#_ble_edit_exec_lines[@]})) || + ble/histdb/sqlite3.close +} + +blehook exec_register!=ble/histdb/exec_register.hook +blehook POSTEXEC!=ble/histdb/postexec.hook +blehook exec_end!=ble/histdb/exec_end.hook +blehook unload!=ble/histdb/unload.hook + +#------------------------------------------------------------------------------ +# auto-complete + +function ble/complete/auto-complete/source:histdb-history { + [[ $_ble_history_prefix ]] && return 1 + + local limit=$((bleopt_line_limit_length)) limit_condition= + if ((limit)); then + ((limit-=${#_ble_edit_str},limit>0)) || return 1 + limit_condition=" AND length(command) <= $limit" + fi + + local ret + ble/histdb/escape-for-sqlite-glob "$_ble_edit_str"; local pat=$ret?* + + ble/histdb/update-cwd-inode + local inode=$_ble_histdb_exec_cwd_inode + + local q=\' qq=\'\' + ble/histdb/sqlite3.request-single-value " + SELECT coalesce( + (SELECT command FROM (SELECT command, max(issue_time) FROM command_history WHERE command GLOB '${pat//$q/$qq}' AND cwd = '${PWD//$q/$qq}$limit_condition')), + ${inode:+(SELECT command FROM (SELECT command, max(issue_time) FROM command_history WHERE command GLOB '${pat//$q/$qq}' AND inode = $inode$limit_condition)),} + '');" + [[ $ret == "$_ble_edit_str"?* ]] || return 1 + ble/complete/auto-complete/enter h 0 "${ret:${#_ble_edit_str}}" '' "$ret" +} + +function ble/complete/auto-complete/source:histdb-word { + [[ $_ble_history_prefix ]] && return 1 + + local iN=${#_ble_edit_str} + ((_ble_edit_ind>0)) || return 1 + + local limit=$((bleopt_line_limit_length)) limit_condition= + if ((limit)); then + ((limit-=iN,limit>0)) || return 1 + limit_condition=" AND length(word) <= $limit" + fi + + local -a wbegins=() + if ((_ble_edit_ind=0)); then + ble/array#push wbegins "$((istat-wlen))" + elif [[ ${_ble_syntax_bash_command_EndWtype[stat[0]]:-} ]]; then + # 単語の始まりの時 (_ble_syntax_bash_command_EndWtype で判定できるのかは実は非自明) + ble/array#push wbegins "$istat" + fi + fi + + else + # 閉じていない入れ子に対する列挙 + + local -a stat nest tree + ble/string#split-words stat "${_ble_syntax_stat[iN]}" + local wlen tclen + if (((wlen=stat[1])>=0)); then + ble/array#push wbegins "$((iN-wlen))" + elif (((tclen=stat[4])>=0)); then + local wend=$((iN-tclen)) + ble/string#split-words tree "${_ble_syntax_tree[wend-1]}" + local wtype=${tree[0]} wlen=${tree[1]} + [[ $wtype && ! ${wtype//[0-9]} && wlen -ge 0 ]] && + ble/array#push wbegins "$((wend-wlen))" + fi + + local inest=$iN nlen=${stat[3]} + while ((nlen>0)); do + ((inest-=nlen)) + ble/string#split-words nest "${_ble_syntax_nest[inest]}" + (((wlen=nest[1])>=0)) && + ble/array#push wbegins "$((inest-wlen))" + nlen=${nest[3]} + done + fi + ((${#wbegins[@]})) || return 1 + + local -a sqls=() + + local i q=\' qq=\'\' + for i in "${wbegins[@]}"; do + local word=${_ble_edit_str:i:_ble_edit_ind-i} + [[ $word ]] || continue + local ret; ble/histdb/escape-for-sqlite-glob "$word" + local pat=$ret?* + ble/array#push sqls "SELECT '$i:' || word FROM (SELECT word, max(mtime) FROM words WHERE word GLOB '${pat//$q/$qq}'$limit_condition)" + done + ((${#sqls[@]})) || return 1 + + ble/array#reverse sqls + sqls=("${sqls[@]/#/(}") # WA #D1570 checked + sqls=("${sqls[@]/%/)}") # WA #D1570 checked + ble/array#push sqls "''" + IFS=, builtin eval 'local query="select coalesce(${sqls[*]});"' + + local ret + ble/histdb/sqlite3.request-single-value "$query" auto || return 1 + [[ $ret == *:* ]] || return 1 + + local index=${ret%%:*} insert=${ret#*:} + if local comps=${_ble_edit_str:index:_ble_edit_ind-index}; [[ $insert == "$comps"* ]]; then + local ins=${insert:_ble_edit_ind-index} + ble/complete/auto-complete/enter c "$_ble_edit_ind" "$ins" "$insert" "$ins" "$ins" ' ' + else + ble/complete/auto-complete/enter r "$index" " [$insert] " "$insert" "$insert" "$insert" ' ' + fi +} +ble/util/import/eval-after-load core-complete ' + ble/array#insert-before _ble_complete_auto_source history histdb-history + ble/array#push _ble_complete_auto_source histdb-word' +[[ $_ble_histdb_keepalive_enabled ]] && + ble/util/idle.push ble/histdb/sqlite3.open + +#------------------------------------------------------------------------------ +# ble histdb command + +function ble-histdb { + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_adjust" + local set shopt ext + ble/base/.adjust-bash-options set shopt + if (($#==0)); then + ble/histdb/sub:query 'select command from command_history;' + ext=$? + elif ble/is-function ble/histdb/sub:"$1"; then + ble/histdb/sub:"$@" + ext=$? + else + builtin printf 'ble-histdb: unknown command "%s"\n' "$1" + ext=2 + fi + ble/base/.restore-bash-options set shopt + ble/util/setexit "$ext" + builtin eval -- "$_ble_bash_POSIXLY_CORRECT_local_return" +} + +# 一般的な補完のフレームワークを作っても良いのではないかという気がしてきたが、 +# それは後で。 +function ble/cmdinfo/complete:ble-histdb { + if ((comp_cword==1)); then + local ret sub + ble/util/compgen ret -A function -- 'ble/histdb/sub:' + ((${#ret[@]})) || return 0 + + local cands + for sub in "${ret[@]#ble/histdb/sub:}"; do # disable=#D2352 + if [[ $sub != */* && $sub == "$COMPV"* ]]; then + ble/array#push cands "$sub" + fi + done + + if ((${#cands[@]})); then + local "${_ble_complete_yield_varnames[@]/%/=}" # disable=#D1570 + ble/complete/cand/yield.initialize word + ble/complete/cand/yield.batch word + fi + fi +} + +function ble/histdb/sub:query { + local ret + ble/histdb/.get-filename; local histdb_file=$ret + "$_ble_histdb_sqlite3" "$histdb_file" '.timeout 1000' "$@" +} + +#------------------------------------------------------------------------------ + +function ble/histdb/count2si { + local si + si=('' k M G T P E Z Y R Q) + + local count=$1 i + for ((i=0;i<${#si[@]}-1;i++,count/=1000)); do + if ((count<1000)); then + ret=$count${si[i]} + return 0 + elif ((count<100000)); then + count=${count%???}.${count:${#count}-3} + ret=${count::4}${si[i+1]} + return 0 + fi + done + ret=$count${si[${#si[@]}-1]} +} + +# modified ble/contrib/prompt-elapsed/output-sec.ps +function ble/histdb/usec2s { + local usec=${1:-0} + if ((usec<1000)); then + ret=${usec}us + elif ((usec<100000)); then + usec=${usec%???}.${usec:${#usec}-3} + ret=${usec::4}ms + else + ble/histdb/msec2s "$((usec/1000))" + fi +} + +function ble/histdb/msec2s { + local msec=${1:-0} + if ((msec<1000)); then + ret=${msec}ms + elif ((msec<100000)); then + msec=${msec%???}.${msec:${#msec}-3} + ret=${msec::4}s + else + ble/histdb/sec2s "$((msec/1000))" + fi +} + +function ble/histdb/sec2s { + local sec=${1:-0} min + ((min=sec/60,sec%=60)) + if ((min<100)); then + ret=${min}m${sec}s + return 0 + fi + + local hour; ((hour=min/60,min%=60)) + if ((hour<100)); then + ret="${hour}h:${min}m:${sec}s" + return 0 + fi + + local day; ((day=hour/24,hour%=24)) + if ((day<365)); then + ret="${day}d-${hour}h:${min}m" + return 0 + fi + + local year; ((year=day/365,day%=365)) + ret="${year}y-${day}d-${hour}h" + return 0 +} + +#------------------------------------------------------------------------------ +# usage: ble histdb stats + +bleopt/declare -v histdb_stats_items 'commands unique-commands successful-commands exec-time exec-cpu-time words sessions directories' + +function ble/histdb/sub:stats/get-user-name { + ble/bin#has git && ble/util/assign ret ' + git config user.name 2>/dev/null + ' && [[ $ret ]] && return 0 + + ble/bin#has getenv && ble/util/assign ret ' + getent passwd 2>/dev/null | ble/bin/awk -F : -v UID="$UID" '\'' + $3==UID { + sub(/[[:blank:]]*[<>].*$/, "", $5); + print $5; + } + '\'' + ' && [[ $ret ]] && return 0 + + ret=${USER:-$_ble_base_env_USER}@${HOSTNAME:-$_ble_base_env_HOSTNAME} +} + +## @fn ble/histdb/sub:stats/where.check condition +## @param[in] condition +## @var[ref] where +function ble/histdb/sub:stats/where.check { + where="${where:- WHERE}${where:+ AND} $1" +} +## @fn ble/histdb/sub:stats/where.check-datetime column +## @param[in] column +## @var[in] time_beg time_end +## @var[ref] where +function ble/histdb/sub:stats/where.check-datetime { + [[ $time_beg ]] && ble/histdb/sub:stats/where.check "$1 >= $time_beg" + [[ $time_end ]] && ble/histdb/sub:stats/where.check "$1 < $time_end" +} + +function ble/histdb/sub:stats/item:commands { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT count(*) FROM command_history$where;" ;; + (get) + ble/array#push names 'Total commands' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:unique-commands { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT count(*) FROM (SELECT DISTINCT command FROM command_history$where);" ;; + (get) + ble/array#push names 'Total unique commands' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:successful-commands { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check 'status == 0' + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT count(*) FROM (SELECT command FROM command_history$where);" ;; + (get) + ble/array#push names 'Total successful commands' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:sessions { + case $1 in + (init) + local where= + if [[ $time_end ]]; then + ble/histdb/sub:stats/where.check-datetime start_time + else + ble/histdb/sub:stats/where.check-datetime last_time + fi + ble/array#push queries "SELECT count(*) FROM sessions$where;" ;; + (get) + ble/array#push names 'Total sessions' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:words { + case $1 in + (init) + local where= + if [[ $time_end ]]; then + ble/histdb/sub:stats/where.check-datetime ctime + else + ble/histdb/sub:stats/where.check-datetime mtime + fi + ble/array#push queries "SELECT count(*) FROM words$where;" ;; + (get) + ble/array#push names 'Total distinct words' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:directories { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT count(*) FROM (SELECT DISTINCT cwd FROM command_history$where);" ;; + (get) + ble/array#push names 'Total directories' + local ret + ble/histdb/count2si "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:exec-time { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT sum(exec_time) FROM command_history$where;" ;; + (get) + ble/array#push names 'Total execution time' + local ret + ble/histdb/usec2s "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats/item:exec-cpu-time { + case $1 in + (init) + local where= + ble/histdb/sub:stats/where.check-datetime issue_time + ble/array#push queries "SELECT sum(exec_time_usr + exec_time_sys) FROM command_history$where;" ;; + (get) + ble/array#push names 'Total CPU time' + local ret + ble/histdb/msec2s "$2" + ble/array#push values "$ret" ;; + esac +} + +function ble/histdb/sub:stats { + local period=${1-} + + local time_beg= time_end= + + if [[ $period ]]; then + local ret + if ble/string#match "$period" '^([0-9]+)([smhdMy])$'; then + local delta=${BASH_REMATCH[1]} + case ${BASH_REMATCH[2]} in + (m) ((delta*=60)) ;; + (h) ((delta*=3600)) ;; + (d) ((delta*=3600*24)) ;; + (M) ((delta*=3600*24*30)) ;; + (y) ((delta*=3600*24*365)) ;; + esac + ble/util/time + ((time_beg=ret-delta)) + elif ble/string#match "$period" '^2[0-9]{3}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01]))?)?$'; then + local y=${period::4} m=${BASH_REMATCH[2]-} d=${BASH_REMATCH[4]-} + if [[ $d ]]; then + m=${m#0} d=${d#0} + ble/util/mktime "$y-$m-$d 00:00:00" + time_beg=$ret + # Note: we here assume that 01-32 is equivalent to 02-01, etc. + ble/util/mktime "$y-$m-$((d+1)) 00:00:00" + time_end=$ret + elif [[ $m ]]; then + m=${m#0} + ble/util/mktime "$y-$m-01 00:00:00" + time_beg=$ret + ble/util/mktime "$((y+m/12))-$((m%12+1))-01 00:00:00" + time_end=$ret + else + ble/util/mktime "$y-01-01 00:00:00" + time_beg=$ret + ble/util/mktime "$((y+1))-01-01 00:00:00" + time_end=$ret + fi + else + ble/util/print "ble-histdb-stats: unrecognized argument '$period'" 2>/dev/null + return 2 + fi + fi + + local -a queries=() + local items item + ble/string#split-words items "$bleopt_histdb_stats_items" + for item in "${items[@]}"; do + ble/histdb/sub:stats/item:"$item" init + done + + local IFS=$_ble_term_IFS + ble/histdb/sub:query -separator ' ' "${queries[*]}" | { + local result + ble/util/mapfile result + + local ret sgr0=$_ble_term_sgr0 + ble/color/gspec2sgr 'fg=27,bold'; local sgr1=$ret + ble/histdb/sub:stats/get-user-name + ble/util/print "$sgr1$ret's Shell Stats${period:+ ($period)}$sgr0" + + local -a names=() values=() + local i=0 + for item in "${items[@]}"; do + ble/histdb/sub:stats/item:"$item" get "${result[i++]}" + done + + local name max_name_width=0 + for name in "${names[@]}"; do + local w=$((${#name}+1)) + ((max_name_width&2 + elif [[ $opt == -? ]]; then + opt=${opt:1} + getopts_short_options=$getopts_short_options'('\'${opt//$q/$Q}\'') + if [[ ${arg:1} ]]; then + '$var'=${arg:1} arg= + elif (($#)); then + '$var'=$1 + shift + else + ble/util/print "$_getopts_label: missing option argument for '\''-$arg'\''" >&2 + flags=E$flags + fi ;; + ' + fi +} +function ble/getopts/scan-definition:parser/arguments { + local var=${1:-args} + getopts_arguments=$getopts_arguments' + ble/array#push '$var' "$arg" + ' +} + +function ble/getopts/generate-parser { + local getopts_finalize= + local getopts_initialize= + local getopts_label= + local getopts_long_options= + local getopts_short_options= + local getopts_arguments= + + ble/getopts/scan-definition parser "$2" + + if [[ ! $getopts_arguments ]]; then + getopts_arguments=' + ble/util/print "$_getopt_label: unrecognized argument '\''$arg'\''" >&2 + flags=E$flags + ' + fi + + local getopts_script=' + local _ble_local_set _ble_local_shopt + ble/base/.adjust-bash-options _ble_local_set _ble_local_shopt + local LC_ALL= LC_COLLATE=C 2>/dev/null + + local _getopts_label='$q${getopts_label//$q/$Q}$q' + + flags= + '$getopts_initialize' + while (($#)); do + local arg=$1; shift + if [[ $arg == -?* && $flags != *-* ]]; then + if [[ $arg == --* ]]; then + case $arg in + (--) flags=-$flags ;; + '$getopts_long_options' + (*) + ble/util/print "$_getopts_label: unrecognized long option '\''$arg'\''" >&2 + flags=E$flags ;; + esac + else + arg=${arg:1} + while [[ $arg ]]; do + case ${arg::1} in + '$getopts_short_options' + (*) + ble/util/print "$_getopts_label: unrecognized option '\''-${arg::1}'\''" >&2 + flags=E$flags ;; + esac + arg=${arg:1} + done + fi + continue + fi + + '$getopts_arguments' + done + '$getopts_finalize' + + ble/util/unlocal LC_ALL LC_COLLATE 2>/dev/null + ble/base/.restore-bash-options _ble_local_set _ble_local_shopt + [[ $flags != *E* ]] + ' + + builtin eval -- "function $1 { $getopts_script }" +} + +#------------------------------------------------------------------------------ +# lib: ble/histdb/graph + +## @fn ble/histdb/graph/board/initialize +## @arr[out] grboard_export +function ble/histdb/graph/board/initialize { + local -a colors + ble/histdb/graph/palette "$2" + + local mark=$1 + if [[ ! $mark ]]; then + if ble/util/is-unicode-output; then + mark='■' + else + mark='##' + fi + fi + + grboard_export=() + ble/array#push grboard_export "grboard_nlevel=${#colors[@]}" + + local i ret + for i in "${!colors[@]}"; do + ble/color/gspec2sgr "fg=${colors[i]}" + ble/array#push grboard_export "grboard_unit$i=$ret$mark$_ble_term_sgr0" + done + + local ret + ble/util/s2w "$mark"; local w=$ret + ble/string#reserve-prototype "$w" + ble/array#push grboard_export "grboard_unit_white=${_ble_string_prototype::w}" +} +_ble_histdb_grboard_awk_lib=' + function grboard_initialize(_, i) { + grboard_nlevel = ENVIRON["grboard_nlevel"]; + grboard_unit[-1] = ENVIRON["grboard_unit_white"]; + for (i = 0; i < grboard_nlevel; i++) + grboard_unit[i] = ENVIRON["grboard_unit" i]; + } + function grboard__score2unit(score, score_max) { + if (score == "" || score < 0) + return grboard_unit[-1]; + else if (score == 0) + return grboard_unit[0]; + else + return grboard_unit[1 + int((grboard_nlevel - 1) * score / (score_max + 1))]; + } + function grboard_render(lines, table, w, h, _, x, y, maxv, v, line) { + maxv = 0; + for (y = 0; y < h; y++) + for (x = 0; x < w; x++) + if (table[y, x] > maxv) + maxv = table[y, x]; + + for (y = 0; y < h; y++) { + line = ""; + for (x = 0; x < w; x++) { + v = table[y, x]; + line = line grboard__score2unit(v, maxv); + } + lines[y] = line; + } + } +' + +## @fn ble/histdb/graph/vbar/initialize [palette] +## @var[out] grvbar_declare +function ble/histdb/graph/vbar/initialize { + local -a colors + ble/histdb/graph/palette "$1" + local gspec=${colors[0]} + + grvbar_declare=() + + local ret sgr1= sgr0= + if ble/util/is-unicode-output; then + local nlevel=8 + if [[ $gspec ]]; then + ble/color/gspec2sgr "fg=$gspec" + sgr1=$ret sgr0=$_ble_term_sgr0 + fi + ble/util/c2w "$((0x2581))"; local w=$ret + ble/array#push grvbar_declare grvbar_nlevel="$nlevel" grvbar_unit0=' ' + local i + for ((i=1;i<=nlevel;i++)); do + ble/util/c2s "$((0x2580+i))" + ((w==1)) && ret=$ret$ret + ble/array#push grvbar_declare "grvbar_unit$i=$sgr1$ret$sgr0" + done + else + if [[ $gspec ]]; then + ble/color/gspec2sgr "bg=$gspec" + sgr1=$ret sgr0=$_ble_term_sgr0 + fi + ble/array#push grvbar_declare grvbar_nlevel=1 grvbar_unit0=' ' grvbar_unit1="$sgr1 $sgr0" + fi +} +_ble_histdb_grvbar_awk_lib=' + function grvbar_initialize(_, i) { + grvbar_nlevel = ENVIRON["grvbar_nlevel"]; + grvbar_unit[-1] = ENVIRON["grvbar_unit_white"]; + for (i = 0; i <= grvbar_nlevel; i++) + grvbar_unit[i] = ENVIRON["grvbar_unit" i]; + } + function grvbar__score2unit(score, score_max) { + if (score <= 0) + return grvbar_unit[0]; + else + return grvbar_unit[1 + int((grvbar_nlevel - 1) * score / (score_max + 1))]; + } + function grvbar__clamp(x, l, u) { + return x < l ? l : x > u ? u : x; + } + function grvbar_render(lines, list, w, h, _, x, y, maxv, line, s) { + maxv = 0; + for (x = 0; x < w; x++) + if (list[x] > maxv) + maxv = list[x]; + for (y = 0; y < h; y++) { + line = "" + for (x = 0; x < w; x++) { + s = int((grvbar_nlevel * h + 1) * list[x] / (maxv + 1)); + line = line grvbar_unit[grvbar__clamp(s - y * grvbar_nlevel, 0, grvbar_nlevel)]; + } + lines[h - 1 - y] = line; + } + } +' + +function ble/histdb/graph/palette { + local palette=$1 + + local index= + if ble/string#match "$palette" '\[([0-9]+)\]$'; then + index=${BASH_REMATCH[1]} + palette=${palette::${#palette}-${#BASH_REMATCH}} + fi + if [[ ! $palette ]]; then + local ret + ble/util/strftime -v ret '%m' + case ${ret#0} in + (10) palette=halloween-light ;; + (12) palette=winter-light ;; + (*) palette=github-light ;; + esac + fi + + # https://github.com/orgs/community/discussions/7078 + case $palette in + (github-light24) colors=('#ebedf0' '#9be9a8' '#30c463' '#30a14e' '#216e39') ;; + (github-dark24) colors=('#161b22' '#0e4429' '#006d32' '#26a641' '#39d353') ;; + (halloween-light24) colors=('#ebedf0' '#ffee4a' '#ffc501' '#fe9600' '#03001c') ;; + (halloween-dark24) colors=('#161b22' '#631c03' '#bd561d' '#fa7a18' '#fddf68') ;; + (winter-light24) colors=('#ebedf0' '#b6e3ff' '#54aeff' '#0969da' '#0a3069') ;; + (winter-dark24) colors=('#161b22' '#0a3069' '#0969da' '#54aeff' '#b6e3ff') ;; + (github-light) colors=(255 151 77 71 23) ;; + (github-dark) colors=(234 22 23 35 77) ;; + (halloween-light) colors=(255 227 220 208 232) ;; + (halloween-dark) colors=(234 52 130 208 221) ;; + (winter-light) colors=(255 153 75 26 23) ;; + (winter-dark) colors=(234 23 26 75 153) ;; + (rainbow) + colors=({196..220..6} {190..46..36}) ;; + (rainbow2) + colors=({16..21} {21..45..6} {51..46} {82..190..36} {220..196..6}) ;; + (*) + ble/string#split colors , "$z1" + esac + + # specify one color + if [[ $index ]]; then + colors=("${colors[index<${#colors[@]}?index:0]}") + fi +} + +## @fn ble/histdb/graph/hbar/initialize [palette] +## @var[out] grhbar_declare +function ble/histdb/graph/hbar/initialize { + local -a colors + ble/histdb/graph/palette "$1" + + grhbar_declare=() + + local -a sgr=() + local ret + if ble/util/is-unicode-output; then + local nlevel=8 + if ((${#colors[@]})); then + sgr[0]=$_ble_term_sgr0 + local color + for color in "${colors[@]}"; do + ble/color/gspec2sgr "fg=$color" + ble/array#push sgr "$ret" + done + fi + + ble/util/c2w "$((0x2588))"; local w=$ret + ble/array#push grhbar_declare grhbar_wfactor="$((w==1?2:1))" + + local i unit + unit[0]=' ' + for ((i=1;i<=nlevel;i++)); do + ble/util/c2s "$((0x2590-i))" + ble/array#push unit "$ret" + done + + ble/array#push grhbar_declare grhbar_unit0=' ' + for ((i=1;i<=nlevel;i++)); do + ble/array#push grhbar_declare "grhbar_unit$i=${unit[i]}" + done + ble/array#push grhbar_declare grhbar_nlevel="$nlevel" + else + if ((${#colors[@]})); then + sgr[0]=$_ble_term_sgr0 + local color + for color in "${colors[@]}"; do + ble/color/gspec2sgr "bg=$color" + ble/array#push sgr "$ret" + done + fi + ble/array#push grhbar_declare grhbar_nlevel=1 grhbar_unit0=' ' grhbar_unit1=' ' + ble/array#push grhbar_declare grhbar_wfactor=2 + fi + + local glevel=$((${#sgr[@]}-1)) + ble/array#push grhbar_declare grhbar_glevel="$glevel" + for ((i=0;i<=glevel;i++)); do + ble/array#push grhbar_declare "grhbar_sgr$i=${sgr[i]}" + done +} +_ble_histdb_grhbar_awk_lib=' + function grhbar_initialize(_, i) { + grhbar_wfactor = ENVIRON["grhbar_wfactor"]; + + grhbar_nlevel = ENVIRON["grhbar_nlevel"]; + for (i = 0; i <= grhbar_nlevel; i++) + grhbar_unit[i] = ENVIRON["grhbar_unit" i]; + + grhbar_glevel = ENVIRON["grhbar_glevel"]; + if (grhbar_glevel > 0) { + for (i = 0; i <= grhbar_glevel; i++) + grhbar_sgr[i] = ENVIRON["grhbar_sgr" i]; + } else { + grhbar_glevel = 0; + grhbar_sgr[0] = ""; + grhbar_sgr[1] = ""; + } + } + function grhbar__score2unit(score, score_max) { + if (score <= 0) + return grhbar_unit[0]; + else + return grhbar_unit[1 + int((grhbar_nlevel - 1) * score / (score_max + 1))]; + } + function grhbar__clamp(x, l, u) { + return x < l ? l : x > u ? u : x; + } + function grhbar_render(lines, list, w, h, _, x, y, maxv, line, s, sunit, color) { + w *= grhbar_wfactor; + maxv = 0; + for (y = 0; y < w; y++) + if (list[y] > maxv) + maxv = list[y]; + for (y = 0; y < h; y++) { + line = "" + s = int((grhbar_nlevel * w + 1) * list[y] / (maxv + 1)); + for (x = 0; x < w; x++) { + sunit = grhbar__clamp(s - x * grhbar_nlevel, 0, grhbar_nlevel); + color = grhbar_sgr[sunit ? grhbar__clamp(1 + int(grhbar_glevel * x / (w - 1)), 1, grhbar_glevel): 0]; + line = line color grhbar_unit[sunit]; + } + lines[y] = line grhbar_sgr[0]; + } + } +' + +#------------------------------------------------------------------------------ +# usage: ble-histdb top [-x regex|-s regex] + +function ble/histdb/sub:top/define { + label 'ble-histdb-top' + option exclude -x + option has_subcommand -s + option count -c +} +ble/getopts/generate-parser ble/histdb/sub:top/read-arguments ble/histdb/sub:top/define + +function ble/histdb/sub:top { + local flags= + local -x exclude= has_subcommand= count=20 + ble/histdb/sub:top/read-arguments "$@" || return 2 + + local grhbar_declare + ble/histdb/graph/hbar/initialize rainbow + local -x "${grhbar_declare[@]}" # disable=#D1566 + + local ret + ble/color/gspec2sgr 'bold' + local -x sgr_cmd=$ret + local -x sgr0=$_ble_term_sgr0 + + ble-histdb | ble/bin/awk ' + BEGIN { + has_subcommand = "^(" ENVIRON["has_subcommand"] ")$"; + to_exclude = "^(" ENVIRON["exclude"] ")$"; + } + { + sub(/^[[:blank:]]+/, ""); + sub(/^\(\(?/, "& "); + if ($1 ~ to_exclude) next; + + subcommand = ""; + if ($1 ~ has_subcommand) { + for (i = 2; i <= NF; i++) { + if ($i ~ /^-.+/) continue; + subcommand = $i + break; + } + } + + if (subcommand != "") { + print $1 " " subcommand; + } else { + print $1; + } + } + ' | ble/bin/sort | uniq -c | ble/bin/sort -nr | ble/bin/awk -v count="$count" ' + '"$_ble_histdb_grhbar_awk_lib"' + BEGIN { + grhbar_initialize(); + g_entry_count = 0; + sgr_cmd = ENVIRON["sgr_cmd"]; + sgr0 = ENVIRON["sgr0"]; + } + { + i = g_entry_count++; + g_score[i] = $1; + g_command[i] = $0; + if (g_entry_count >= count) exit; + } + END { + grhbar_render(lines_hbar, g_score, 6, g_entry_count); + for (i = 0; i < g_entry_count; i++) { + sub(/[0-9]+ /, "&[" lines_hbar[i] "] " sgr_cmd, g_command[i]); + print g_command[i] sgr0; + } + } + ' +} + +#------------------------------------------------------------------------------ +# usage: ble-histdb calendar +# usage: ble-histdb week + +function ble/histdb/sub:calendar { + local palette=$1 + + local grboard_export + ble/histdb/graph/board/initialize '' "$palette" + local -x "${grboard_export[@]}" # disable=#D1566 + + local grvbar_declare + ble/histdb/graph/vbar/initialize "$palette[2]" + local -x "${grvbar_declare[@]}" # disable=#D1566 + + local awk + if ble/is-function ble/bin/mawk; then + awk=ble/bin/mawk + elif ble/is-function ble/bin/gawk; then + awk=ble/bin/mawk + else + printf 'ble-histdb-calendar: gawk or mawk is needed.' >&2 + return 1 + fi + + ble/histdb/sub:query -separator ' ' "SELECT strftime('%Y %j %w', issue_time, 'unixepoch', 'localtime') AS date FROM command_history;" | + sort | uniq -c | "$awk" ' + '"$_ble_histdb_grboard_awk_lib"' + '"$_ble_histdb_grvbar_awk_lib"' + + BEGIN { + grboard_initialize(); + grvbar_initialize(); + + split("Sun,Mon,Tue,Wed,Thu,Fri,Sat, ", c_weekday, ","); + split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", c_month, ","); + } + function initialize_year(year, _, i) { + g_year = year; + g_year_nday = 0 + strftime("%j", mktime(year " 12 31 01 00 00")); + g_year_wday_offset = 0 + strftime("%w", mktime(year " 01 01 01 00 00")); + g_score_max = 0; + g_score_total = 0; + for (i = -g_year_wday_offset; i < g_year_nday; i++) + g_score[i] = 0; + } + function flush_year(_, line, i, x, y, w, m, iday, iweek, lines, score_table, score_weekly) { + if (g_year == "" || g_year == 1970) return; + + print "\x1b[1m# " g_year " (total = " g_score_total ", max = " g_score_max ")\x1b[m"; + print ""; + + line = c_weekday[8]; + x = 0; + for (m = 1; m <= 12; m++) { + iday = strftime("%j", mktime(g_year sprintf(" %02d 01 01 00 00", m))) - 1; + iweek = int((iday + g_year_wday_offset) / 7); + line = line sprintf("%*s", iweek * 2 - x, "") c_month[m]; + x = iweek * 2 + length(c_month[m]); + } + print line; + + # Fill score_table and score_weekly + w = 0; + for (i = -g_year_wday_offset; i < g_year_nday; i++) { + y = (i + g_year_wday_offset) % 7; + x = int((i + g_year_wday_offset) / 7); + if (x >= w) w = x + 1; + + score_table[y, x] = i < 0 ? -1 : g_score[i]; + score_weekly[x] += g_score[i]; + } + + grboard_render(lines, score_table, w, 7); + for (y = 0; y < 7; y++) print c_weekday[1 + y] lines[y]; + + grvbar_render(lines, score_weekly, w, 3); + for (y = 0; y < 3; y++) print c_weekday[8] lines[y]; + + print ""; + } + + $2 != g_year { + flush_year(); + initialize_year($2); + } + { + yday = $3 - 1; + g_score[yday] = $1; + g_score_total += $1; + if ($1 > g_score_max) + g_score_max = $1; + } + + END { + flush_year(); + } + ' +} + +function ble/histdb/sub:week { + local palette=$1 + + local grboard_export + ble/histdb/graph/board/initialize '●' "$palette" + local -x "${grboard_export[@]}" # disable=#D1566 + + local grvbar_declare + ble/histdb/graph/vbar/initialize "$palette[2]" + local -x "${grvbar_declare[@]}" # disable=#D1566 + + local grhbar_declare + ble/histdb/graph/hbar/initialize "$palette[2]" + local -x "${grhbar_declare[@]}" # disable=#D1566 + + ble/histdb/sub:query -separator ' ' "SELECT strftime('%w %H', issue_time, 'unixepoch', 'localtime') AS date FROM command_history;" | + sort | uniq -c | ble/bin/awk ' + '"$_ble_histdb_grboard_awk_lib"' + '"$_ble_histdb_grvbar_awk_lib"' + '"$_ble_histdb_grhbar_awk_lib"' + + BEGIN { + grboard_initialize(); + grvbar_initialize(); + grhbar_initialize(); + split("Sun,Mon,Tue,Wed,Thu,Fri,Sat, ", c_weekday, ","); + } + { + y = $2 + 0; + x = $3 + 0; + g_score[y, x] += $1; + g_score[x] += $1; + g_score_wday[y] += $1; + } + END { + line = c_weekday[8]; + for (h = 0; h < 24; h++) + line = line sprintf(h % 3 == 0 ? "%02d" : " ", h); + print line; + + grboard_render(lines, g_score, 24, 7); + grhbar_render(lines_hbar, g_score_wday, 4, 7); + for (y = 0; y < 7; y++) print c_weekday[1 + y] lines[y] lines_hbar[y]; + + grvbar_render(lines, g_score, 24, 3); + for (y = 0; y < 3; y++) print c_weekday[8] lines[y]; + } + ' +} diff --git a/.local/share/blesh/contrib/integration/bash-completion.bash b/.local/share/blesh/contrib/integration/bash-completion.bash new file mode 100644 index 0000000..f657164 --- /dev/null +++ b/.local/share/blesh/contrib/integration/bash-completion.bash @@ -0,0 +1,334 @@ +# ble/contrib/integration/bash-completion.bash (C) 2024, akinomyoga + +## @fn ble/string#hash-pjw text [size shift] +## @var[out] ret +function ble/string#hash-pjw { + local size=${2:-32} + local S=${3:-$(((size+7)/8))} # shift 4 + local C=$((size-2*S)) # co-shift 24 + local M=$(((1<>C&N)&M)) + done + ret=$h +} + +#------------------------------------------------------------------------------ +# Hooks for completion loaders + +## @fn ble/contrib/integration:bash-completion/loader/.adjust-progcomp cmd +## @param[in] cmd +## The command name whose completion setting should be parsed and adjusted. +function ble/contrib/integration:bash-completion/loader/.adjust-progcomp { + local ret + ble/syntax:bash/simple-word/safe-eval "$1" nonull || return 0 + local cmd=$ret + + local compdef + ble/util/assign compdef 'builtin complete -p -- "$cmd"' 2>/dev/null || + { cmd=${cmd##*/}; ble/util/assign compdef 'builtin complete -p -- "$cmd"' 2>/dev/null; } || + return 0 + compdef=${compdef%"${cmd:-''}"} + compdef=${compdef%' '}' ' + + local comp_opts=$comp_opts comp_prog comp_func compoptions flag_noquote + ble/complete/progcomp/parse-complete "$compdef" + + # Call adjustments based on the values of "comp_prog" and "comp_func" + ble/complete/progcomp/adjust-third-party-completions +} + +function ble/contrib/integration:bash-completion/loader/_comp_load.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + ((ADVICE_EXIT==0)) || return 0 + + # command-line argument parsing taken from _comp_load (bash_completion). + local flag_fallback_default="" IFS=$' \t\n' + local OPTIND=1 OPTARG="" OPTERR=0 opt + set -- "${ADVICE_WORDS[@]:1}" + while getopts ':D' opt "$@"; do + case $opt in + D) flag_fallback_default=set ;; + *) return 2 ;; + esac + done + shift "$((OPTIND - 1))" + + ble/contrib/integration:bash-completion/loader/.adjust-progcomp "$@" +} + +function ble/contrib/integration:bash-completion/loader/__load_completion.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + ((ADVICE_EXIT==0)) || return 0 + ble/contrib/integration:bash-completion/loader/.adjust-progcomp "$@" +} + +function ble/contrib/integration:bash-completion/loader/adjust { + if ble/is-function _comp_load; then + ble/function#advice after _comp_load ble/contrib/integration:bash-completion/loader/_comp_load.advice + elif ble/is-function __load_completion; then + ble/function#advice after __load_completion ble/contrib/integration:bash-completion/loader/__load_completion.advice + fi +} + +#------------------------------------------------------------------------------ +# Hooks for mandb + +## @fn ble/contrib/integration:bash-completion/mandb/.alloc-subcache command hash [opts] +## @var[out] ret +function ble/contrib/integration:bash-completion/mandb/.alloc-subcache { + ret= + [[ $_ble_attached ]] || return 1 + + local command=$1 hash=$2 opts=$3 + if [[ :$opts: == *:dequote:* ]]; then + ble/syntax:bash/simple-word/safe-eval "$command" noglob:nonull && + command=$ret + fi + [[ $command ]] || return 1 + + [[ $command == ble*/* ]] || command=${1##*/} + ble/string#hash-pjw "$args" 64; local hash=$ret + local lc_messages=${LC_ALL:-${LC_MESSAGES:-${LANG:-C}}} + local mandb_cache_dir=$_ble_base_cache/complete.mandb/${lc_messages//'/'/%} + ble/util/sprintf ret '%s.%014x' "$mandb_cache_dir/_parse_help.d/$command" "$hash" + + [[ -s $ret && $ret -nt $_ble_base/lib/core-complete.sh ]] && return 1 + + ble/util/mkd "${ret%/*}" +} + +## @fn ble/contrib/integration:bash-completion/mandb/_parse_help.advice command args +function ble/contrib/integration:bash-completion/mandb/_parse_help.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + local cmd=$1 args=$2 func=$ADVICE_FUNCNAME + # 現在のコマンド名。 Note: ADVICE_WORDS には実際に現在補完しようとしているコ + # マンドとは異なるものが指定される場合があるので (例えば help や - 等) 信用で + # きない。 + local command=${COMP_WORDS[0]-} hash="${ADVICE_WORDS[*]}" ret + ble/contrib/integration:bash-completion/mandb/.alloc-subcache "$command" "$hash" dequote || return 0 + local subcache=$ret + + local default_option=--help help_opts= + [[ $func == _parse_usage ]] && + default_option=--usage help_opts=mandb-usage + + if [[ ( $func == _parse_help || $func == _parse_usage ) && $cmd == - ]]; then + # 標準入力からの読み取り + ble/complete/mandb:help/generate-cache "$help_opts" >| "$subcache" + + # Note: _parse_help が読み取る筈だった内容を横取りしたので抽出した内容を標 + # 準出力に出力する。但し、対応する long option がある short option は除外す + # る。 + LC_ALL= LC_COLLATE=C ble/bin/awk -F "$_ble_term_FS" ' + BEGIN { entry_count = 0; } + { + entries[entry_count++] = $1; + + # Assumption: the descriptions of long options have the form + # "[short_opt] desc". The format is defined by + # ble/complete/mandb:help/generate-cache. + desc = $4; + gsub(/\033\[[ -?]*[@-~]/, "", desc); # disable=#D1440 (LC_COLLATE=C is set) + if (match(desc, /^\[[^]'"$_ble_term_blank"'[]*\] /) > 0) { # #D1709 safe + short_opt = substr(desc, 2, RLENGTH - 3); + excludes[short_opt] =1; + } + } + END { + for (i = 0; i < entry_count; i++) + if (!excludes[entries[i]]) + print entries[i]; + } + ' "$subcache" 2>/dev/null # suppress locale error #D1440 + else + local cmd_args + ble/string#split-words cmd_args "${args:-$default_option}" + "$cmd" "${cmd_args[@]}" 2>&1 | ble/complete/mandb:help/generate-cache "$help_opts" >| "$subcache" + fi +} + +function ble/contrib/integration:bash-completion/mandb/_get_help_lines.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + ((${#_lines[@]})) || return 0 + + # @var cmd + # 現在のコマンド名。Note: _comp_command_offset 等によって別のコマンドの補完 + # を呼び出している場合があるので ble.sh の用意する comp_words は信用できな + # い。bash-completion の使っている _comp_args[0] または bash-completion が + # 上書きしている COMP_WORDS を参照する。 + local cmd=${_comp_args[0]-${COMP_WORDS[0]-}} hash="${ADVICE_WORDS[*]}" + ble/contrib/integration:bash-completion/mandb/.alloc-subcache "$cmd" "$hash" dequote || return 0 + local subcache=$ret + + local help_opts= + [[ ${ADVICE_FUNCNAME[1]} == *_usage ]] && help_opts=mandb-usage + printf '%s\n' "${_lines[@]}" | ble/complete/mandb:help/generate-cache "$help_opts" >| "$subcache" +} + +## @fn ble/contrib/integration:bash-completion/mandb/_comp_command_offset.yield +## process generated completions stored in COMPREPLY. +function ble/contrib/integration:bash-completion/mandb/_comp_command_offset.yield { + local word_offset=$1 + + # Other variables for ble/complete/progcomp/process-compgen-output + local comp_words comp_cword comp_line comp_point IFS=$' \t\n' + comp_cword=$((COMP_CWORD-word_offset)) + ((comp_cword==0)) && return 0 + comp_words=("${COMP_WORDS[@]:word_offset}") + comp_line="${comp_words[*]}" + comp_point="${comp_words[*]::comp_cword+1}" + comp_point=${#comp_point} + + if ((${#COMPREPLY[@]}==0)); then + ble/complete/source:argument/fallback reuse-comp_words; local ext=$? + compopt +o ble/default +o default +o dirnames + return "$ext" + fi + + # Input + local compgen parse_compgen_opts=array + compgen=("${COMPREPLY[@]}") + COMPREPLY=() + + # Arguments for ble/complete/progcomp/process-compgen-output + local cmd=${comp_words[0]} ret + ble/syntax:bash/simple-word/safe-eval "$cmd" nonull && cmd=$ret + [[ ${cmd##*/} == git ]] && parse_compgen_opts=work-around-git + + ble/complete/progcomp/process-compgen-output "$cmd" "$parse_compgen_opts" +} + +function ble/contrib/integration:bash-completion/mandb/_comp_command_offset.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + local REPLY + _comp__find_original_word "${ADVICE_WORDS[1]}" + ble/contrib/integration:bash-completion/mandb/_comp_command_offset.yield "$REPLY" +} + +function ble/contrib/integration:bash-completion/mandb/_command_offset.advice { + [[ ${BLE_ATTACHED-} ]] || return 0 + local word_offset=${ADVICE_WORDS[1]} i j + for ((i=0;i/dev/null # _parse_help が別の枠組みで定義されている事がある? #D1900 + +#------------------------------------------------------------------------------ + +function ble/contrib/integration:bash-completion/cmd-with-conditional-sync.advice { + if [[ ${BLE_ATTACHED-} ]]; then + ble/function#push "${ADVICE_WORDS[1]}" ' + local -a cmd_args; cmd_args=("${ADVICE_WORDS[1]}" "$@") + ble/util/conditional-sync \ + '\''command "${cmd_args[@]}"'\'' \ + '\''! ble/complete/check-cancel'\'' 128 progressive-weight:killall' + ble/function#advice/do + ble/function#pop "${ADVICE_WORDS[1]}" + else + ble/function#advice/do + fi +} + +function ble/contrib/integration:bash-completion/_do_dnf5_completion.advice { + ble/contrib/integration:bash-completion/cmd-with-conditional-sync.advice "$@" + [[ ${BLE_ATTACHED-} ]] || return 0 + if ((${#COMPREPLY[@]}>=2)); then + local i has_desc= + for i in "${!COMPREPLY[@]}"; do + if ble/string#match "${COMPREPLY[i]}" '[[:blank:]]+\((.*)\)$'; then + local cand=${COMPREPLY[i]%"$BASH_REMATCH"} desc=${BASH_REMATCH[1]} + if [[ $cand && $cand != "${COMPREPLY[i]}" ]]; then + ble/complete/cand/yield word "$cand" "$desc" + has_desc=1 + builtin unset -v 'COMPREPLY[i]' + continue + fi + fi + + if [[ ! -e ${COMPREPLY[i]} ]]; then + ble/complete/cand/yield word "$cand" + builtin unset -v 'COMPREPLY[i]' + fi + done + + COMPREPLY=("${COMPREPLY[@]}") + [[ $has_desc ]] && bleopt complete_menu_style=desc + fi +} + +function ble/contrib/integration:bash-completion/adjust { + ble/is-function _comp_initialize || ble/is-function _quote_readline_by_ref || return 0 + + ble/contrib/integration:bash-completion/loader/adjust + + _ble_contrib_integration_bash_completion_cmd_conditional_sync=(_comp_cmd_make _make _do_dnf5_completion) + + if [[ $comp_func == _comp_cmd_make || $comp_func == _make ]]; then + ble/is-function "$comp_func" && + ble/function#advice around "$comp_func" ble/contrib/integration:bash-completion/cmd-with-conditional-sync.advice + elif [[ $comp_func == _do_dnf5_completion ]]; then + ble/is-function "$comp_func" && + ble/function#advice around "$comp_func" ble/contrib/integration:bash-completion/_do_dnf5_completion.advice + fi + + if ((BASH_COMPLETION_VERSINFO[0]<2||BASH_COMPLETION_VERSINFO[0]==2&&BASH_COMPLETION_VERSINFO[1]<12)); then + # Fix issues with bash-completion <= 2.11 + + # https://github.com/scop/bash-completion/pull/492 (fixed in bash-completion 2.12) + function _quote_readline_by_ref { + if [[ $1 == \'* ]]; then + printf -v "$2" %s "${1:1}" + else + printf -v "$2" %q "$1" + [[ ${!2} == \$* ]] && builtin eval "$2=${!2}" + fi + } + ble/function#suppress-stderr _filedir 2>/dev/null + + # https://github.com/scop/bash-completion/issues/509 (fixed in bash-completion 2.12) + ble/function#suppress-stderr _find 2>/dev/null + + # https://github.com/scop/bash-completion/pull/556 (fixed in bash-completion 2.12) + ble/function#suppress-stderr _scp_remote_files 2>/dev/null + + # https://github.com/scop/bash-completion/pull/773 (fixed in bash-completion 2.12) + ble/function#suppress-stderr _function 2>/dev/null + fi + + ble/contrib/integration:bash-completion/mandb/adjust +} diff --git a/.local/share/blesh/contrib/integration/bash-preexec.bash b/.local/share/blesh/contrib/integration/bash-preexec.bash new file mode 100644 index 0000000..ac74c19 --- /dev/null +++ b/.local/share/blesh/contrib/integration/bash-preexec.bash @@ -0,0 +1,180 @@ +# ble/contrib/integration/bash-preexec.bash (C) 2022-2023, akinomyoga + +## @arr[in] precmd_functions +## @arr[in] preexec_functions +## The functions registered to these arrays are executed on PRECMD and +## PREEXEC hooks, respectively. +## +## @fn[in] precmd +## @fn[in] preexec +## If these functions are defined, they are executed on PRECMD and PREEXEC +## hooks, respectively, through "precmd_functions" and "preexec_functions". +## +## +## * Integration with bash-preexec.sh (https://github.com/rcaloras/bash-preexec) +## +## Although this script works without bash-preexec, it provides a better +## integration with bash-preexec when bash-preexec is loaded. The +## integration relies on the following public API of bash-preexec. +## +## @fn __bp_precmd_invoke_functions lastexit lastarg +## @fn __bp_preexec_invoke_functions lastexit lastarg this_command +## @fn __bp_uninstall +## @var __bp_trapdebug_string +## @var __bp_install_string + +function ble/contrib/integration:bash-preexec/add-convenience-functions { + ble/array#remove precmd_functions precmd + ble/array#remove preexec_functions preexec + ble/array#unshift precmd_functions precmd + ble/array#unshift preexec_functions preexec +} + +function ble/contrib/integration:bash-preexec/precmd.hook { + local _ble_local_lastexit=$? _ble_local_lastarg=$_ + + # Emulate bash-preexec variables + __bp_last_ret_value=$_ble_local_lastexit + __bp_last_argument_prev_command=$_ble_local_lastarg + BP_PIPESTATUS=("${BLE_PIPESTATUS[@]}") + local __bp_inside_precmd=1 + + # local __bp_blesh_invoking_through_blesh=1 # XXX + if ble/is-function __bp_precmd_invoke_functions; then + __bp_precmd_invoke_functions "$_ble_local_lastexit" "$_ble_local_lastarg" + else + # For older bash-preexec.sh / without bash-preexec.sh + local _ble_local_hook + for _ble_local_hook in "${precmd_functions[@]}"; do + if ble/bin#has "$_ble_local_hook"; then + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + "$_ble_local_hook" + fi + done + fi +} + +function ble/contrib/integration:bash-preexec/preexec.hook { + local _ble_local_lastexit=$? _ble_local_lastarg=$_ _ble_local_command=$1 + + # Emulate bash-preexec variables + local __bp_inside_preexec=1 + + # local __bp_blesh_invoking_through_blesh=1 # XXX + if ble/is-function __bp_preexec_invoke_functions; then + __bp_preexec_invoke_functions "$_ble_local_lastexit" "$_ble_local_lastarg" + else + # For older bash-preexec.sh / without bash-preexec.sh + local _ble_local_hook + for _ble_local_hook in "${preexec_functions[@]}"; do + if ble/bin#has "$_ble_local_hook"; then + ble/util/setexit "$_ble_local_lastexit" "$_ble_local_lastarg" + "$_ble_local_hook" "$_ble_local_command" + fi + done + fi +} + +## @fn ble/contrib/integration:bash-preexec/attach.hook +## Remove bash-preexec hooks +function ble/contrib/integration:bash-preexec/attach.hook { + local BP_TRAPDEBUG_STRING=${__bp_trapdebug_string:-'__bp_preexec_invoke_exec "$_"'} + + # Remove bash-preexec preexec hook in builtin DEBUG trap. + local trap_string q="'" Q="'\''" + ble/util/assign trap_string 'builtin trap -p DEBUG' + if [[ $trap_string == "trap -- '${BP_TRAPDEBUG_STRING//$q/$Q}' DEBUG" ]]; then + if [[ ${__bp_trap_string-} ]]; then + builtin eval -- "builtin $__bp_trap_string" + else + builtin trap - DEBUG + fi + fi + + if ble/is-function __bp_uninstall; then + __bp_uninstall + else + # For older bash-preexec.sh + + local BP_INSTALL_STRING=${__bp_install_string:-$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install'} + local BP_PROMPT_COMMAND_PREFIX=__bp_precmd_invoke_cmd + local BP_PROMPT_COMMAND_SUFFIX=__bp_interactive_mode + + # Remove __bp_install hook from PROMPT_COMMAND + if [[ ${PROMPT_COMMAND-} == *"$__bp_install_string"* ]]; then + PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING[;$'\n']}" # Edge case of appending to PROMPT_COMMAND + PROMPT_COMMAND="${PROMPT_COMMAND//$BP_INSTALL_STRING}" + fi + + # Remove precmd hook from PROMPT_COMMAND + local i prompt_command + for i in "${!PROMPT_COMMAND[@]}"; do + prompt_command=${PROMPT_COMMAND[i]} + case $prompt_command in + ("$BP_PROMPT_COMMAND_PREFIX"|"$BP_PROMPT_COMMAND_SUFFIX") + prompt_command= ;; + (*) + prompt_command=${prompt_command/#"$BP_PROMPT_COMMAND_PREFIX"$'\n'/$'\n'} + prompt_command=${prompt_command%$'\n'"$BP_PROMPT_COMMAND_SUFFIX"} + prompt_command=${prompt_command#$'\n'} + esac + PROMPT_COMMAND[i]=$prompt_command + done + + # Remove preexec hook in the DEBUG trap + local q="'" Q="'\''" trap_string + ble/util/assign trap_string 'trap -p DEBUG' + if [[ $trap_string == "trap -- '${BP_TRAPDEBUG_STRING//$q/$Q}' DEBUG" ]]; then + if [[ ${__bp_trap_string-} ]]; then + builtin eval -- "$__bp_trap_string" + else + trap - DEBUG + fi + fi + fi +} +ble/function#trace ble/contrib/integration:bash-preexec/attach.hook + +## @fn ble/contrib/integration:bash-preexec/detach.hook +function ble/contrib/integration:bash-preexec/detach.hook { + # Reinstall bash-preexec hooks + local BP_INSTALL_STRING=${__bp_install_string-} + [[ ! $BP_INSTALL_STRING ]] && ble/is-function __bp_install && + BP_INSTALL_STRING=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install' + + builtin eval -- "$__bp_install_string" + + # Note: 重複して登録される (古い bash-preexec.sh) かもしれないし、全 + # く登録されない (bash-preexec.sh をロードしていない時) かもしれない + # ので、ble.sh 側で末尾で一回呼び出す形に修正する。 + ble/contrib/integration:bash-preexec/add-convenience-functions +} + +ble/contrib/integration:bash-preexec/add-convenience-functions +blehook PRECMD!=ble/contrib/integration:bash-preexec/precmd.hook +blehook PREEXEC!=ble/contrib/integration:bash-preexec/preexec.hook +blehook ATTACH!=ble/contrib/integration:bash-preexec/attach.hook +blehook DETACH!=ble/contrib/integration:bash-preexec/detach.hook +if [[ ${bash_preexec_imported-${__bp_imported-}} ]]; then + ble/contrib/integration:bash-preexec/attach.hook +fi + +# prevent bash-preexec.sh to be loaded +blehook ATTACH-=ble/contrib/integration:bash-preexec/loader +blehook POSTEXEC-=ble/contrib/integration:bash-preexec/loader +bash_preexec_imported=defined +__bp_imported=defined + +# XXX: 以下は uninstall で削除しきれなかった時の為の保険。今の所不要に思われる。 +# __bp_blesh_check() { +# if [[ $BLE_ATTACHED && ! ${__bp_blesh_invoking_through_blesh-} ]]; then +# ble/contrib/integration:bash-preexec/attach.hook +# fi +# } +# precmd_function+=(__bp_blesh_check) +# preexec_function+=(__bp_blesh_check) + +# Some settings rely on the internal APIs of bash-preexec. For example, iTerm2 +# shell integration uses "__bp_set_ret_value" and +# "$__bp_last_argument_prev_command". +function __bp_set_ret_value { return ${1:+"$1"}; } diff --git a/.local/share/blesh/contrib/integration/fzf-completion.bash b/.local/share/blesh/contrib/integration/fzf-completion.bash new file mode 100644 index 0000000..3d430bf --- /dev/null +++ b/.local/share/blesh/contrib/integration/fzf-completion.bash @@ -0,0 +1,101 @@ +# ble/contrib/integration/fzf-completion.bash (C) 2020-2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +# fzf/shell/completion.bash を未ロードの時のみロードする +if ! ble/is-function _fzf_complete; then + ble-import contrib/integration/fzf-initialize || return 1 + if [[ -f $_ble_contrib_fzf_base/completion.bash ]]; then + source -- "$_ble_contrib_fzf_base/completion.bash" + elif [[ -f $_ble_contrib_fzf_base/shell/completion.bash ]]; then + source -- "$_ble_contrib_fzf_base/shell/completion.bash" + elif [[ $_ble_contrib_fzf_base == */share/fzf && -f /etc/bash_completion.d/fzf ]]; then + source /etc/bash_completion.d/fzf + elif [[ $_ble_contrib_fzf_base == __eval_fzf_bash__ ]]; then + ble/util/eval-stdout '"$_ble_contrib_fzf_path" --bash | sed -n "/### completion/,/### end/p"' + fi +fi + +# clear blesh completer for cd +blehook/eval-after-load complete 'builtin unset -f ble/cmdinfo/complete:cd' + +# patch fzf functions +ble-import contrib/integration/fzf.common +ble/function#advice -f around __fzf_generic_path_completion 'ble/contrib/integration:fzf/complete.advice' +ble/function#advice -f around _fzf_complete 'ble/contrib/integration:fzf/complete.advice keep-stdin' +ble/function#advice -f around _fzf_complete_kill 'ble/contrib/integration:fzf/complete.advice' +ble/function#advice -f around _fzf_handle_dynamic_completion 'ble/contrib/integration:fzf/handle_dynamic_completion.advice' + +if ble/is-function __fzf_orig_completion_get_orig_func; then + ## @fn ble/contrib/integration:fzf/orig_completion_get_orig_func.advice + ## @var[ref] comp_opts + function ble/contrib/integration:fzf/orig_completion_get_orig_func.advice { + if ((ADVICE_EXIT==0)); then + local comp_func=$REPLY comp_prog= + ble/complete/progcomp/adjust-third-party-completions + fi + } + ble/function#advice after __fzf_orig_completion_get_orig_func 'ble/contrib/integration:fzf/orig_completion_get_orig_func.advice' +elif ble/is-function _fzf_handle_dynamic_completion; then + _ble_contrib_fzf_adjust_dynamic_completion=1 +fi + +#------------------------------------------------------------------------------ +# Extensions + +# This widget can be used to trigger fzf's '**' completion from a keybinding. +function ble/widget/fzf-complete { + local handler=_fzf_${1:-path}_completion + if ! ble/is-function "$handler"; then + ble/widget/.bell "unrecognized fzf-complete type '$1' (function '$handler' not found)" + return 1 + fi + + ((_ble_edit_ind==0)) && return 0 + + # If the width of the box-drawing characters in the current terminal is not + # 1, we specify --no-unicode to fzf to suppress the use of the box-drawing + # characters. + if [[ " ${FZF_COMPLETION_OPTS-} " != *' --no-unicode '* ]]; then + local ret + ble/util/c2w 0x2500 + ((ret==1)) || + local FZF_COMPLETION_OPTS="--no-unicode${FZF_COMPLETION_OPTS:+ $FZF_COMPLETION_OPTS}" + fi + + # Mask completion settings cached by fzf + local -a fzf_orig_completions + fzf_orig_completions=("${!_fzf_orig_completion_@}") + local "${fzf_orig_completions[@]/%/=}" # disable=#D1570 + + # Replace the programmable-completion setting + local completion_save + ble/util/assign completion_save 'complete -p' + complete -r + if ((_ble_bash>=40100)); then + complete -F "$handler" -D + complete -F "$handler" -E + else + complete -F "$handler" _DefaultCmD_ + complete -F "$handler" _EmptycmD_ + fi + if ((_ble_bash>=50000)); then + complete -F "$handler" -I + else + complete -F "$handler" _InitialWorD_ + fi + + # Disable completion auto-loader + ble/function#push _comp_load 'return 1' + + # Trigger fzf-completion without '**' + local FZF_COMPLETION_TRIGGER= + + ble/widget/complete; local ext=$? + + # restore the settings + ble/function#pop _comp_load + complete -r + builtin eval -- "$completion_save" + return "$ext" +} diff --git a/.local/share/blesh/contrib/integration/fzf-git.bash b/.local/share/blesh/contrib/integration/fzf-git.bash new file mode 100644 index 0000000..059b70d --- /dev/null +++ b/.local/share/blesh/contrib/integration/fzf-git.bash @@ -0,0 +1,322 @@ +# Copyright (c) 2016, 2022 Junegunn Choi +# ble/contrib/integration/fzf-git.bash (C) 2020, 2023, akinomyoga +# +# 2020-04-16 https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 (Revision 2019-03-14) +# 2023-06-30 https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236 (Revision 2022-08-16) +# 2023-06-30 https://github.com/junegunn/fzf-git.sh/commit/4bc0323b4822b3426989863996cc266c52c7f25a +# 2023-06-30 https://github.com/junegunn/fzf-git.sh/commit/b6192ec86609afea761c7d3954f9b539a512dc80 +# 2023-11-09 https://github.com/junegunn/fzf-git.sh/blob/aacab4ae557657e0f9de288d688f312a28b86d21/fzf-git.sh + +if [[ $- != *i* ]]; then + if (($# == 1)); then + function ble/contrib/integration:fzf-git/sub:branches { + git branch "$@" --sort=-committerdate --sort=-HEAD --format=$'%(HEAD) %(color:yellow)%(refname:short) %(color:green)(%(committerdate:relative))\t%(color:blue)%(subject)%(color:reset)' --color=always | column -ts$'\t' + } + function ble/contrib/integration:fzf-git/sub:refs { + git for-each-ref --sort=-creatordate --sort=-HEAD --color=always --format=$'%(refname) %(color:green)(%(creatordate:relative))\t%(color:blue)%(subject)%(color:reset)' | + builtin eval -- "$1" | + sed 's#^refs/remotes/#\x1b[95mremote-branch\t\x1b[33m#; s#^refs/heads/#\x1b[92mbranch\t\x1b[33m#; s#^refs/tags/#\x1b[96mtag\t\x1b[33m#; s#refs/stash#\x1b[91mstash\t\x1b[33mrefs/stash#' | + column -ts$'\t' + } + case $1 in + (branches) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-A (show all branches)\n' + ble/contrib/integration:fzf-git/sub:branches + ;; + (all-branches) + printf '%s\n' $'CTRL-O (open in browser)\n' + ble/contrib/integration:fzf-git/sub:branches -a + ;; + (refs) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-E (examine in editor) ╱ ALT-A (show all refs)\n' + ble/contrib/integration:fzf-git/sub:refs 'grep -v ^refs/remotes' + ;; + (all-refs) + printf '%s\n' $'CTRL-O (open in browser) ╱ ALT-E (examine in editor)\n' + ble/contrib/integration:fzf-git/sub:refs 'cat' + ;; + (nobeep) ;; + (*) exit 1 ;; + esac + elif (($# > 1)); then + set -e + + branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + if [[ $branch = HEAD ]]; then + branch=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD) + fi + + # Only supports GitHub for now + case $1 in + (commit) + hash=$(grep -o "[a-f0-9]\{7,\}" <<< "$2") + path=/commit/$hash + ;; + (branch|remote-branch) + branch=$(sed 's/^[* ]*//' <<< "$2" | cut -d' ' -f1) + remote=$(git config branch."${branch}".remote || printf 'origin\n') + branch=${branch#$remote/} + path=/tree/$branch + ;; + (remote) + remote=$2 + path=/tree/$branch + ;; + (file) path=/blob/$branch/$(git rev-parse --show-prefix)$2 ;; + (tag) path=/releases/tag/$2 ;; + (*) exit 1 ;; + esac + + remote=${remote:-$(git config branch."${branch}".remote || printf 'origin\n')} + remote_url=$(git remote get-url "$remote" 2> /dev/null || printf '%s\n' "$remote") + + if [[ $remote_url =~ ^git@ ]]; then + url=${remote_url%.git} + url=${url#git@} + url=https://${url/://} + elif [[ $remote_url =~ ^http ]]; then + url=${remote_url%.git} + fi + + case $(uname -s) in + (Darwin) open "$url$path" ;; + (*) xdg-open "$url$path" ;; + esac + fi + exit 0 +fi + +#------------------------------------------------------------------------------ + +ble-import contrib/integration/fzf-initialize + +[[ $- == *i* ]] || return 0 + +## @fn ble/contrib/integration:fzf-git/initialize bash_source +## @param[in] bash_source +## @var[out] __fzf_git +function ble/contrib/integration:fzf-git/initialize { + local ret + ble/util/readlink "$1" + __fzf_git=$ret +} +ble/contrib/integration:fzf-git/initialize "${BASH_SOURCE[0]:-}" + +# GIT heart FZF +# ------------- + +#------------------------------------------------------------------------------ +# Redefine this function to change the options +_fzf_git_fzf() { + fzf-tmux -p80%,60% -- \ + --layout=reverse --multi --height=50% --min-height=20 --border \ + --border-label-pos=2 \ + --color='header:italic:underline,label:blue' \ + --preview-window='right,50%,border-left' \ + --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" +} + +function ble/contrib/integration:fzf-git/fzf { + [[ $_ble_term_state == internal ]] && ble/term/leave-for-widget + _fzf_git_fzf "$@" + local ext=$? + [[ $_ble_term_state == internal ]] && ble/term/enter-for-widget + return "$ext" +} + +_fzf_git_check() { + git rev-parse HEAD > /dev/null 2>&1 && return 0 + + [[ -n $TMUX ]] && tmux display-message "Not in a git repository" + return 1 +} + +if [[ -z $_fzf_git_cat ]]; then + # Sometimes bat is installed as batcat + export _fzf_git_cat="cat" + _fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=always --pager=never" + if command -v batcat > /dev/null; then + _fzf_git_cat="batcat $_fzf_git_bat_options" + elif command -v bat > /dev/null; then + _fzf_git_cat="bat $_fzf_git_bat_options" + fi +fi + +_fzf_git_files() { + _fzf_git_check || return "$?" + (git -c color.status=always status --short --no-branch + git ls-files | grep -vxFf <(git status -s | grep '^[^?]' | cut -c4-; ble/util/print :) | sed 's/^/ /') | + ble/contrib/integration:fzf-git/fzf -m --ansi --nth 2..,.. \ + --border-label '📁 Files' \ + --header $'CTRL-O (open in browser) ╱ ALT-E (open in editor)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \ + --bind "alt-e:execute:${EDITOR:-vim} {-1} > /dev/tty" \ + --preview "git diff --no-ext-diff --color=always -- {-1} | sed 1,4d; $_fzf_git_cat {-1}" "$@" | + cut -c4- | sed 's/.* -> //' +} + +_fzf_git_branches() { + _fzf_git_check || return "$?" + bash "$__fzf_git" branches | + ble/contrib/integration:fzf-git/fzf --ansi \ + --border-label '🌲 Branches' \ + --header-lines 2 \ + --tiebreak begin \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \ + --bind "alt-a:change-prompt(🌳 All branches> )+reload:bash \"$__fzf_git\" all-branches" \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' "$@" | + sed 's/^..//' | cut -d' ' -f1 +} + +_fzf_git_tags() { + _fzf_git_check || return "$?" + git tag --sort -version:refname | + ble/contrib/integration:fzf-git/fzf --preview-window right,70% \ + --border-label '📛 Tags' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \ + --preview 'git show --color=always {}' "$@" +} + +_fzf_git_hashes() { + _fzf_git_check || return "$?" + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | + ble/contrib/integration:fzf-git/fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \ + --border-label '🍡 Hashes' \ + --header $'CTRL-O (open in browser) ╱ CTRL-D (diff) ╱ CTRL-S (toggle sort)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ + --bind 'ctrl-d:execute:grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git diff > /dev/tty' \ + --color hl:underline,hl+:underline \ + --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | head -n 1 | xargs git show --color=always' "$@" | + awk 'match($0, /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/) { print substr($0, RSTART, RLENGTH) }' +} + +_fzf_git_remotes() { + _fzf_git_check || return "$?" + git remote -v | awk '{print $1 "\t" $2}' | uniq | + ble/contrib/integration:fzf-git/fzf --tac \ + --border-label '📡 Remotes' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \ + --preview-window right,70% \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {1}/"$(git rev-parse --abbrev-ref HEAD)"' "$@" | + cut -d$'\t' -f1 +} + +_fzf_git_stashes() { + _fzf_git_check || return "$?" + git stash list | ble/contrib/integration:fzf-git/fzf \ + --border-label '🥡 Stashes' \ + --header $'CTRL-X (drop stash)\n\n' \ + --bind 'ctrl-x:execute-silent(git stash drop {1})+reload(git stash list)' \ + -d: --preview 'git show --color=always {1}' "$@" | + cut -d: -f1 +} + +_fzf_git_lreflogs() { + _fzf_git_check || return "$?" + git reflog --color=always --format="%C(blue)%gD %C(yellow)%h%C(auto)%d %gs" | ble/contrib/integration:fzf-git/fzf --ansi \ + --border-label '📒 Reflogs' \ + --preview 'git show --color=always {1}' "$@" | + awk '{print $1}' +} + +_fzf_git_each_ref() { + _fzf_git_check || return "$?" + bash "$__fzf_git" refs | ble/contrib/integration:fzf-git/fzf --ansi \ + --nth 2,2.. \ + --tiebreak begin \ + --border-label '☘️ Each ref' \ + --header-lines 2 \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git {1} {2}" \ + --bind "alt-e:execute:${EDITOR:-vim} <(git show {2}) > /dev/tty" \ + --bind "alt-a:change-prompt(🍀 Every ref> )+reload:bash \"$__fzf_git\" all-refs" \ + --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {2}' "$@" | + awk '{print $2}' +} +#------------------------------------------------------------------------------ + +# export FZF_DEFAULT_OPTS=--no-unicode + +: "${_ble_contrib_fzf_git_config=key-binding}" + +# original +function ble/contrib:integration/fzf-git/type:original/init { + ble/builtin/bind '"\er": redraw-current-line' +} +function ble/contrib:integration/fzf-git/type:original { + local binding='"\C-g\C-'$1'": "$(_fzf_git_'$2')\e\C-e\er"' + ble/builtin/bind "$binding" +} +# function ble/contrib:integration/fzf-git/type:original { +# local binding='"\C-g\C-'$1'": "$(_fzf_git_'$2')\M-\C-e\M-\C-l"' +# bind "$binding" +# } + +function ble/widget/fzf-git { + ble/widget/insert-string "$(_fzf_git_$1)" + ble/textarea#invalidate +} + +# key-binding +function ble/contrib:integration/fzf-git/type:key-binding { + ble-bind -f "C-g C-$1" "fzf-git $2" +} + +# sabbrev +function ble/contrib:integration/fzf-git/type:sabbrev/init { + function fzf-git.sabbrev { + COMPREPLY=$(_fzf_git_$1) + ble/textarea#invalidate + } +} +function ble/contrib:integration/fzf-git/type:sabbrev { + ble-sabbrev -m "g$1"="fzf-git.sabbrev $2" +} + +# arpeggio +function ble/contrib:integration/fzf-git/type:arpeggio/init { + ble-import 'lib/vim-arpeggio.sh' +} +function ble/contrib:integration/fzf-git/type:arpeggio { + ble/lib/vim-arpeggio.sh/bind -f "g$1" "fzf-git $2" +} + +# old-functions +function ble/contrib:integration/fzf-git/type:old-functions/init { + function is_in_git_repo { _fzf_git_check "$@"; } + function fzf-down { ble/contrib/integration:fzf-git/fzf "$@"; } +} +function ble/contrib:integration/fzf-git/type:old-functions { + # Note: To suppress duplicate adjustment of the terminal states, we override + # "_ble_term_state" with the temporary environment. I.e., when fzf is called + # through these old function names, we never adjust the terminal states. + builtin eval "function g$1 { _ble_term_state= _fzf_git_$2 \"\$@\"; }" +} + +function ble/contrib:integration/fzf-git/initialize { + local type + for type in original key-binding sabbrev arpeggio old-functions; do + [[ :$_ble_contrib_fzf_git_config: == *:"$type":* ]] || continue + + ble/function#try ble/contrib:integration/fzf-git/type:"$type"/init + ble/contrib:integration/fzf-git/type:"$type" f files + ble/contrib:integration/fzf-git/type:"$type" b branches + ble/contrib:integration/fzf-git/type:"$type" t tags + ble/contrib:integration/fzf-git/type:"$type" h hashes + ble/contrib:integration/fzf-git/type:"$type" r remotes + ble/contrib:integration/fzf-git/type:"$type" s stashes + ble/contrib:integration/fzf-git/type:"$type" l lreflogs + ble/contrib:integration/fzf-git/type:"$type" e each_ref + done + builtin unset -f "$FUNCNAME" +} +ble/contrib:integration/fzf-git/initialize diff --git a/.local/share/blesh/contrib/integration/fzf-initialize.bash b/.local/share/blesh/contrib/integration/fzf-initialize.bash new file mode 100644 index 0000000..5344a22 --- /dev/null +++ b/.local/share/blesh/contrib/integration/fzf-initialize.bash @@ -0,0 +1,11 @@ +# ble/contrib/integration/fzf-initialize.bash (C) 2020-2024, akinomyoga + +# Usage: Please write the following lines in blerc +# +# ```bash +# _ble_contrib_fzf_base=/path/to/fzf-base-directory +# ble-import -d integration/fzf-initialize +# ``` + +ble-import contrib/integration/fzf.common +ble/contrib/integration:fzf/locate-shell-settings _ble_contrib_fzf fzf fzf || return 1 diff --git a/.local/share/blesh/contrib/integration/fzf-key-bindings.bash b/.local/share/blesh/contrib/integration/fzf-key-bindings.bash new file mode 100644 index 0000000..8e723fa --- /dev/null +++ b/.local/share/blesh/contrib/integration/fzf-key-bindings.bash @@ -0,0 +1,44 @@ +# ble/contrib/integration/fzf-key-bindings.bash (C) 2020-2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +if ! ble/is-function __fzf_history__; then + ble-import contrib/integration/fzf-initialize || return 1 + ble/function#push bind : + if [[ -f $_ble_contrib_fzf_base/key-bindings.bash ]]; then + source -- "$_ble_contrib_fzf_base/key-bindings.bash" + elif [[ -f $_ble_contrib_fzf_base/shell/key-bindings.bash ]]; then + source -- "$_ble_contrib_fzf_base/shell/key-bindings.bash" + elif [[ $_ble_contrib_fzf_base == __eval_fzf_bash__ ]]; then + ble/util/eval-stdout '"$_ble_contrib_fzf_path" --bash | sed -n "/### key-bindings/,/### end/p"' + fi + ble/function#pop bind +fi + +function ble/contrib/integration:fzf-key-bindings/is-fzf-above-7c447bbd { + local def; ble/function#getdef __fzf_history__ + [[ $def == *READLINE_LINE=* ]] +} + +# CTRL-T - Paste the selected file path into the command line +ble-bind -m emacs -x C-t fzf-file-widget +ble-bind -m vi_imap -x C-t fzf-file-widget +ble-bind -m vi_nmap -s C-t 'i\C-t' + +# CTRL-R - Paste the selected command from history into the command line +ble-bind -m emacs -x C-r fzf-history-widget +ble-bind -m vi_imap -x C-r fzf-history-widget +ble-bind -m vi_nmap -s C-r 'i\C-r' +function fzf-history-widget { + ble/util/assign READLINE_LINE '__fzf_history__' + ble/util/assign READLINE_LINE 'history -p "$READLINE_LINE"' + READLINE_POINT=${#READLINE_LINE} +} +((_ble_bash>=40000)) && + ble/contrib/integration:fzf-key-bindings/is-fzf-above-7c447bbd && + function fzf-history-widget { __fzf_history__; } + +# ALT-C - cd into the selected directory +ble-bind -m emacs -c M-c 'ble/util/eval-stdout "__fzf_cd__"' +ble-bind -m vi_imap -c M-c 'ble/util/eval-stdout "__fzf_cd__"' +ble-bind -m vi_nmap -c M-c 'ble/util/eval-stdout "__fzf_cd__"' diff --git a/.local/share/blesh/contrib/integration/fzf-menu.bash b/.local/share/blesh/contrib/integration/fzf-menu.bash new file mode 100644 index 0000000..651d03c --- /dev/null +++ b/.local/share/blesh/contrib/integration/fzf-menu.bash @@ -0,0 +1,125 @@ +# ble/contrib/integration/fzf-menu.bash (C) 2024, akinomyoga +# +# https://github.com/akinomyoga/ble.sh/issues/479 + +## @fn ble/contrib/integration:fzf-menu/SELECTOR args... +## Returns the index of the selected candidate. Users can override this +## function to adjust the detailed behavior. +## +## @param[in] args... +## The list of candidates. Each argument takes the form +## "". is specified by the shell +## variable sep. +## @var[in] common_prefix +## The common prefix of the filter target +## @var[in] sep +## The separator used to separate the index, word, and description in an +## argument +## @stdout +## Output the selected index. +function ble/contrib/integration:fzf-menu/SELECTOR { + local fzf_options + fzf_options=(--ansi --query "$common_prefix") + + # Use Unicode box-drawing characters only when the width of the box-drawing + # characters in the current terminal is 1. The width of the box-drawing + # characters is specified to be East_Asian_Width=A (Ambiguous), and the + # actual width depends on the terminal. However, fzf assumes the width of + # the box-drawing characters to be always 1. This breaks the layout of the + # terminal content in the terminals where the box-drawing characters have + # double width. We check the width of the box-drawing characters (U+2500 as + # a representative) and disable the use of the box-drawing characters by fzf + # when it is not 1. + local ret + ble/util/c2w 0x2500 + ((ret==1)) || ble/array#push fzf_options --no-unicode + + # When the current completion is performed by case-insensitive search (i.e., + # when the readline variable is set to "set completion-ignore-case on"), we + # let fzf filter items by case-insensitive matching. + [[ :$comp_type: == *:i:* ]] && + ble/array#push fzf_options --ignore-case + + local formatter="printf '%s\n' \"\$@\"" + ble/bin#has column && + formatter=$formatter' | column -ts "$sep" -o "$sep" -c unlimited' + ble/array#push fzf_options -d "$sep" --with-nth=2.. --nth=1 + + builtin eval -- "$formatter" | fzf "${fzf_options[@]}" | cut -d "$sep" -f 1 +} + +function ble/contrib/integration:fzf-menu/.get-common-prefix { + local cand_word ret + cand_word=("$@") + ble/complete/candidates/determine-common-prefix + common_prefix=$ret +} + +function ble/contrib/integration:fzf-menu/.select-and-insert { + if ((cand_count>1)); then + local common_prefix= + ble/contrib/integration:fzf-menu/.get-common-prefix "${cand_cand[@]}" + (($?==148)) && return 148 + + local desc_sgr0=$_ble_term_sgr0 + ble/color/face2sgr menu_desc_quote; local desc_sgrq=$ret + ble/color/face2sgr menu_desc_type; local desc_sgrt=$ret + + # Create a list of "^\^\- " where ^\ represents the ANSI + # control character FS (U+001C). + local sep=$_ble_term_FS + local -a list=() + local i + for ((i=0;i&2 + return 1 + fi + ble/util/set "$path_ref" "$path" + else + local path + if ! ble/bin#get-path "$cmd"; then + ble/util/print "ble/contrib/integration: '$cmd' not found." >&2 + return 1 + fi + + local base= ret + ble/util/readlink "$path" + ret=${ret%/*} # fzf, fzf-linux_amd64, etc. + ret=${ret%/bin} # repo/bin/ + ret=${ret%/target} # repo/target (compile directory) + ret=${ret%/target/debug} # repo/target/debug (cargo compile directory) + ret=${ret%/target/release} # repo/target/release (cargo compile directory) + if [[ -s $ret/shell/key-bindings.bash ]]; then + base=$ret + elif [[ -d $ret/share/$pkgname/shell ]]; then + base=$ret/share/$pkgname + elif [[ -s $ret/share/$pkgname/key-bindings.bash ]]; then + # NixOS package (https://github.com/akinomyoga/blesh-contrib/pull/5#issuecomment-1019394821) + base=$ret/share/$pkgname + elif [[ -s $ret/share/doc/$pkgname/examples/key-bindings.bash ]]; then + # Ubuntu $pkgname package (https://github.com/akinomyoga/blesh-contrib/pull/5#issuecomment-1019394821) + base=$ret/share/doc/$pkgname/examples + elif [[ -d /usr/share/$pkgname/shell ]]; then + base=/usr/share/$pkgname + elif [[ -d /usr/share/doc/$pkgname/examples/key-bindings.bash ]]; then + # Ubuntu fzf package (https://github.com/akinomyoga/blesh-contrib/pull/5#issuecomment-1019394821) + base=/usr/share/doc/$pkgname/examples + else + if [[ $cmd == fzf ]]; then + ble/util/assign version '"$path" --version 2>/dev/null' + ble/string#match "$version" '^[[:blank:]]*([0-9]+)\.([0-9]+)\.([0-9]+)?' && + ((version=10#0${BASH_REMATCH[1]}*10000+10#0${BASH_REMATCH[2]}*100+10#0${BASH_REMATCH[3]})) + + # fzf >= 0.48.0 has started to offer « eval "$(fzf --bash)" », so + # careless package maintainers may drop the shell integration files. It + # shouldn't actually be dropped, but we would suppress the error message + # because we can work around such a package using "fzf --bash". + ((version>=4800)) && base=__eval_fzf_bash__ + fi + fi + + if [[ ! $base ]]; then + ble/util/print "ble/contrib/integration: failed to find '$cmd' base directory" >&2 + return 1 + fi + ble/util/set "$base_ref" "$base" + fi + + ble/util/set "$path_ref" "$path" + ble/util/set "$version_ref" "$version" + return 0 +} + +function ble/contrib/integration:fzf/.is-bind-dsr0 { + [[ $1 == '"\e[0n"'* ]] && + ble/string#match "${FUNCNAME[2]#ble/function#advice/original:}" '^__?(fzf|skim)_' +} + +function ble/contrib/integration:fzf/.is-printf-dsr5 { + [[ $1 == '\e[5n' ]] && + ble/string#match "${FUNCNAME[2]#ble/function#advice/original:}" '^__?(fzf|skim)_' +} + +function ble/contrib/integration:fzf/complete.advice { + local opts=${1-} + + if [[ ! ${_ble_attached-} ]]; then + ble/function#push caller 'builtin caller ${1+"$(($1+6))"}' + ble/function#advice/do + ble/function#pop caller + return 0 + fi + + [[ :$comp_type: == *:auto:* || :$comp_type: == *:[maA]:* ]] && return 0 + + if [[ ! ${_ble_contrib_fzf_comp_words_raw-} ]]; then + local val_COMP_LINE val_COMP_POINT val_COMP_WORDS val_COMP_CWORD + ble/util/save-vars val_ COMP_LINE COMP_POINT COMP_WORDS COMP_CWORD + + compopt -o ble/syntax-raw + local _ble_contrib_fzf_comp_words_raw=1 + local COMP_WORDS; COMP_WORDS=("${comp_words[@]}") + local COMP_CWORD=$comp_cword + local COMP_LINE=$comp_line COMP_POINT=$comp_point + fi + + ble/function#push bind 'ble/contrib/integration:fzf/.is-bind-dsr0 "$@" || ble/builtin/bind "$@"' + ble/function#push printf 'ble/contrib/integration:fzf/.is-printf-dsr5 "$@" || builtin printf "$@"' + ble/function#push caller 'builtin caller ${1+"$(($1+6))"}' + ble/term/leave-for-widget + if [[ :$opts: == *:keep-stdin:* ]]; then + ble/function#advice/do >&"${_ble_util_fd_tty_stdout:-1}" 2>&"${_ble_util_fd_tty_stderr:-2}" + else + ble/function#advice/do >&"${_ble_util_fd_tty_stdout:-1}" 2>&"${_ble_util_fd_tty_stderr:-2}" <&"${_ble_util_fd_tty_stdin:-0}" + fi + ble/term/enter-for-widget + ble/function#pop caller + ble/function#pop printf + ble/function#pop bind + ble/textarea#invalidate + + # 単一候補生成の場合は他の候補 (sabbrev 等) を消去して単一確定させる + if ((ADVICE_EXIT==0&&${#COMPREPLY[@]}==1)); then + compopt -o ble/no-default + ble/complete/candidates/clear + [[ $old_cand_count ]] && + ! ble/variable#is-global old_cand_count && + old_cand_count=0 + fi +} + +_ble_contrib_fzf_adjust_dynamic_completion= +function ble/contrib/integration:fzf/handle_dynamic_completion.advice { + if [[ ${_ble_attached-} && ${_ble_contrib_fzf_comp_words_raw-} ]]; then + compopt +o ble/syntax-raw + local _ble_contrib_fzf_comp_words_raw= + local COMP_LINE COMP_POINT COMP_WORDS COMP_CWORD + ble/util/restore-vars val_ COMP_LINE COMP_POINT COMP_WORDS COMP_CWORD + fi + + if [[ ${_ble_attached-} && $_ble_contrib_fzf_adjust_dynamic_completion ]]; then + local comp_func=_fzf_orig_completion_${ADVICE_WORDS[1]} comp_prog= + local comp_func=${!comp_func} + local comp_func=${comp_func##*#} + if ble/bin#has "$comp_func"; then + ble/complete/progcomp/adjust-third-party-completions + fi + fi + + ble/function#advice/do + +} diff --git a/.local/share/blesh/contrib/integration/nix-completion.bash b/.local/share/blesh/contrib/integration/nix-completion.bash new file mode 100644 index 0000000..7e777cd --- /dev/null +++ b/.local/share/blesh/contrib/integration/nix-completion.bash @@ -0,0 +1,27 @@ +# ble/contrib/integration/nix-completion.bash (C) 2023, akinomyoga + +[[ $- == *i* ]] || return 0 + +function ble/contrib/integration:nix-completion/_complete_nix.advice { + if [[ ${_ble_attached-} && " ${FUNCNAME[*]} " == *" ble/complete/progcomp/.compgen "* && ${COMP_WORDS[0]-} != *[\'\"\\]* ]]; then + local _ble_nix_cmd=${COMP_WORDS[0]-nix} ret + ble/function#push "$_ble_nix_cmd" ' + local IFS=$_ble_term_IFS + local -a args; args=("$@") + ble/util/conditional-sync "exec $_ble_nix_cmd \"\${args[@]}\"" \ + '\''! ble/complete/check-cancel'\'' 128 progressive-weight:killall' + ble/function#advice/do + ble/function#pop "$_ble_nix_cmd" + else + ble/function#advice/do + return 0 + fi +} + +function ble/contrib/integration:nix-completion/adjust { + if ble/is-function _complete_nix; then + ble/function#advice around _complete_nix ble/contrib/integration:nix-completion/_complete_nix.advice + fi +} + +ble/contrib/integration:nix-completion/adjust diff --git a/.local/share/blesh/contrib/integration/skim-completion.bash b/.local/share/blesh/contrib/integration/skim-completion.bash new file mode 100644 index 0000000..449e97e --- /dev/null +++ b/.local/share/blesh/contrib/integration/skim-completion.bash @@ -0,0 +1,29 @@ +# ble/contrib/integration/skim-completion.bash (C) 2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +# skim/shell/completion.bash を未ロードの時のみロードする +if ! ble/is-function _skim_complete; then + ble-import contrib/integration/skim-initialize || return 1 + if [[ -f $_ble_contrib_skim_base/completion.bash ]]; then + source -- "$_ble_contrib_skim_base/completion.bash" + elif [[ -f $_ble_contrib_skim_base/shell/completion.bash ]]; then + source -- "$_ble_contrib_skim_base/shell/completion.bash" + elif [[ $_ble_contrib_skim_base == */share/skim && -f /etc/bash_completion.d/skim ]]; then + source /etc/bash_completion.d/skim + fi +fi + +# clear blesh completer for cd +blehook/eval-after-load complete 'builtin unset -f ble/cmdinfo/complete:cd' + +# Note: completion integration has been moved from "skim/shell/completion.bash" +# to "skim/shell/key-bindings.bash". See "skim-key-bindings.bash" for details. +if ble/is-function _skim_handle_dynamic_completion; then + ble-import contrib/integration/fzf.common + ble/function#advice -f around __skim_generic_path_completion 'ble/contrib/integration:fzf/complete.advice' + ble/function#advice -f around _skim_complete 'ble/contrib/integration:fzf/complete.advice keep-stdin' + ble/function#advice -f around _skim_complete_kill 'ble/contrib/integration:fzf/complete.advice' + ble/function#advice -f around _skim_handle_dynamic_completion 'ble/contrib/integration:fzf/handle_dynamic_completion.advice' + _ble_contrib_fzf_adjust_dynamic_completion=1 +fi diff --git a/.local/share/blesh/contrib/integration/skim-initialize.bash b/.local/share/blesh/contrib/integration/skim-initialize.bash new file mode 100644 index 0000000..e947b48 --- /dev/null +++ b/.local/share/blesh/contrib/integration/skim-initialize.bash @@ -0,0 +1,4 @@ +# ble/contrib/integration/skim-initialize.bash (C) 2024, akinomyoga + +ble-import contrib/integration/fzf.common +ble/contrib/integration:fzf/locate-shell-settings _ble_contrib_skim skim sk || return 1 diff --git a/.local/share/blesh/contrib/integration/skim-key-bindings.bash b/.local/share/blesh/contrib/integration/skim-key-bindings.bash new file mode 100644 index 0000000..a63de9d --- /dev/null +++ b/.local/share/blesh/contrib/integration/skim-key-bindings.bash @@ -0,0 +1,50 @@ +# ble/contrib/integration/skim-key-bindings.bash (C) 2024, akinomyoga + +[[ $- == *i* ]] || return 0 + +if ! ble/is-function __skim_history__; then + ble-import contrib/integration/skim-initialize || return 1 + ble/function#push bind : + if [[ -f $_ble_contrib_skim_base/key-bindings.bash ]]; then + source -- "$_ble_contrib_skim_base/key-bindings.bash" + elif [[ -f $_ble_contrib_skim_base/shell/key-bindings.bash ]]; then + source -- "$_ble_contrib_skim_base/shell/key-bindings.bash" + fi + ble/function#pop bind +fi + +# CTRL-T - Paste the selected file path into the command line +ble-bind -m emacs -x C-t skim-file-widget +ble-bind -m vi_imap -x C-t skim-file-widget +ble-bind -m vi_nmap -s C-t 'i\C-t' + +# CTRL-R - Paste the selected command from history into the command line +ble-bind -m emacs -x C-r skim-history-widget +ble-bind -m vi_imap -x C-r skim-history-widget +ble-bind -m vi_nmap -s C-r 'i\C-r' +function skim-history-widget { __skim_history__; } + +# ALT-C - cd into the selected directory +ble-bind -m emacs -c M-c 'ble/util/eval-stdout "__skim_cd__"' +ble-bind -m vi_imap -c M-c 'ble/util/eval-stdout "__skim_cd__"' +ble-bind -m vi_nmap -c M-c 'ble/util/eval-stdout "__skim_cd__"' + +# Note: completion integration has been moved from "skim/shell/completion.bash" +# to "skim/shell/key-bindings.bash". When the argument completion for "sk" is +# implemented using Clap in Ref. [1], somehow the completion integration (which +# is unrelated to the argument completion for "sk") was completely removed. +# Later, this was pointed out in Ref. [2], and the completion integration code +# was restored in "key-bindings.bash" instead of "completion.bash". +# +# [1] https://github.com/skim-rs/skim/pull/586 +# [2] https://github.com/skim-rs/skim/issues/726 +# [3] https://github.com/skim-rs/skim/commit/f87ff6740b20794eaf6288b901f85b7737a28bcf +if ble/is-function _skim_handle_dynamic_completion; then + # patch skim completion functions + ble-import contrib/integration/fzf.common + ble/function#advice -f around __skim_generic_path_completion 'ble/contrib/integration:fzf/complete.advice' + ble/function#advice -f around _skim_complete 'ble/contrib/integration:fzf/complete.advice keep-stdin' + ble/function#advice -f around _skim_complete_kill 'ble/contrib/integration:fzf/complete.advice' + ble/function#advice -f around _skim_handle_dynamic_completion 'ble/contrib/integration:fzf/handle_dynamic_completion.advice' + _ble_contrib_fzf_adjust_dynamic_completion=1 +fi diff --git a/.local/share/blesh/contrib/integration/zoxide.bash b/.local/share/blesh/contrib/integration/zoxide.bash new file mode 100644 index 0000000..7de1291 --- /dev/null +++ b/.local/share/blesh/contrib/integration/zoxide.bash @@ -0,0 +1,60 @@ +# ble/contrib/integration/zoxide.bash (C) 2022, akinomyoga + +function ble/contrib/integration:zoxide/completion.advice { + if [[ ! ${_ble_attached-} ]]; then + ble/function#advice/do + return 0 + fi + + [[ :$comp_type: == *:auto:* || :$comp_type: == *:[maA]:* ]] && return 0 + + ble/term/leave-for-widget + ble/function#advice/do >/dev/null + ble/term/enter-for-widget + ble/textarea#invalidate + + # 単一候補生成の場合は他の候補 (sabbrev 等) を消去して単一確定させる + if ((ADVICE_EXIT==0&&${#COMPREPLY[@]}==1)); then + ble/complete/candidates/clear + [[ $old_cand_count ]] && + ! ble/variable#is-global old_cand_count && + old_cand_count=0 + fi +} + +function ble/contrib/integration:zoxide/command.advice { + if [[ ${_ble_attached-} && ${READLINE_MARK+set} ]]; then + ble/bin/stty icanon + ble/function#advice/do + ble/bin/stty -icanon + else + ble/function#advice/do + fi +} + +function ble/contrib/integration:zoxide/adjust { + local found= + if ble/is-function _z; then + ble/function#advice around _z ble/contrib/integration:zoxide/completion.advice + found=1 + fi + if ble/is-function __zoxide_z_complete; then + ble/function#advice around __zoxide_z_complete ble/contrib/integration:zoxide/completion.advice + found=1 + fi + if ble/is-function __zoxide_z; then + ble/function#advice around __zoxide_z ble/contrib/integration:zoxide/command.advice + found=1 + fi + if ble/is-function __zoxide_zi; then + ble/function#advice around __zoxide_zi ble/contrib/integration:zoxide/command.advice + found=1 + fi + [[ $found ]] +} + +if ! ble/contrib/integration:zoxide/adjust; then + ble/bin#has zoxide || return 1 + ble/util/eval-stdout 'zoxide init bash' + ble/contrib/integration:zoxide/adjust +fi diff --git a/.local/share/blesh/contrib/layer/pattern.bash b/.local/share/blesh/contrib/layer/pattern.bash new file mode 100644 index 0000000..d74e505 --- /dev/null +++ b/.local/share/blesh/contrib/layer/pattern.bash @@ -0,0 +1,317 @@ +# ble/contrib/layer/pattern.bash (C) 2023, akinomyoga +# +# @fn ble/highlight/layer:{pattern}/declare name [type] +# Define a new layer named `name`. +# +# @param[in] name +# The name of the layer. +# @param[in,opt] type +# This specifies the type of the pattern of this layer. One of the +# following values. The default is `regexp`. +# +# regexp +# Regular expression +# glob +# Extended glob pattern +# glob-shortest +# Extended glob pattern. This tries to find the shortest match. +# +# @fn ble/highlight/layer:{pattern}/register name pattern gspec +# Register a pattern to the layer specified by `name`. +# +# @param[in] name +# The name of the layer. +# @param[in] pattern +# The pattern. The type of the pattern is specified by the argument `type` +# when the layer is created by `ble/highlight/layer:{pattern}/declare`. +# @param[in] gspec +# A string specifying the graphic style. See the description of +# ble/color/gspec2g. +# +# +# ```bash +# # blerc +# +# ble-import layer/pattern +# +# ble/highlight/layer:{pattern}/declare pattern1 +# ble/highlight/layer:{pattern}/register pattern1 'rm -rf [^;&|]*' 'fg=231,bg=196,bold' +# ble/array#insert-after _ble_highlight_layer_list syntax pattern1 +# +# ble/highlight/layer:{pattern}/declare pattern2 +# ble/highlight/layer:{pattern}/register pattern2 "$USER" 'fg=blue,bold' +# ble/highlight/layer:{pattern}/register pattern2 "$HOSTNAME" 'fg=green,bold' +# ble/highlight/layer:{pattern}/register pattern2 '[0-9]+' 'bg=216,fg=black' +# ble/array#insert-after _ble_highlight_layer_list pattern1 pattern2 +# ``` + +function ble/highlight/layer:{pattern}/declare { + local layer_name=$1 type=${2-regexp} + case $type in + (regexp | glob) ;; + (glob-shortest) type=sglob ;; + (*) + ble/util/print "$FUNCNAME: unrecognized pattern type '$type'." >&2 + return 2 ;; + esac + + # define dynamic variables + local layer_prefix=_ble_highlight_layer_${layer_name}_ + ble/highlight/layer:{selection}/declare "$layer_name" + ble/array#push "${layer_prefix}VARNAMES" "${layer_prefix}text" + ble/util/set "${layer_prefix}text" '' + + # define settings + local keys=${layer_prefix}keys + local dict=${layer_prefix}dict + builtin eval -- " + ${layer_prefix}type=$type + $keys=() + ${_ble_util_gdict_declare//NAME/$dict}" + + # define functions + local _ble_local_script=' + function ble/highlight/layer:LAYER/initialize-vars { + ble/highlight/layer:{pattern}/initialize-vars LAYER + } + function ble/highlight/layer:LAYER/update { + ble/highlight/layer:{pattern}/update LAYER "$@" + } + function ble/highlight/layer:LAYER/getg { + ble/highlight/layer:{pattern}/getg LAYER "$@" + }' + builtin eval -- "${_ble_local_script//LAYER/$layer_name}" +} + +function ble/highlight/layer:{pattern}/initialize-vars { + local layer_name=$1 + ble/highlight/layer:{selection}/initialize-vars "$layer_name" + ble/util/set "_ble_highlight_layer_${layer_name}_text" '' +} + +function ble/highlight/layer:{pattern}/register { + local layer_name=$1 pattern=$2 spec=${3-} + local keys=_ble_highlight_layer_${layer_name}_keys + local dict=_ble_highlight_layer_${layer_name}_dict + if [[ ${3+set} ]]; then + local ret + ble/color/gspec2g "$spec" + ble/gdict#has "$dict" "$pattern" || + ble/array#push "$keys" "$pattern" + ble/gdict#set "$dict" "$pattern" "$ret" + else + ble/array#remove "$keys" "$pattern" + ble/gdict#unset "$dict" "$pattern" + fi +} + +##----------------------------------------------------------------------------- +## Pattern types +## +## Each pattern layer instance is associated with a pattern type, and the +## pattern type defines how the pattern specified to layer:{pattern}/register +## should be treated. Currently, three types `regexp`, `glob`, and `sglob` are +## defined. To define a new pattern type, the following three functions should +## be prepared. +## +## @fn ble/highlight/layer:{pattern}/pattern:/create-gpat +## This function composes a pattern matching any of the registered patterns +## +## @arr[in] keys +## The list of patterns registered to the current layer. +## @var[out] gpat +## Stores a pattern that matches any of the registered pattern. +## +## @fn ble/highlight/layer:{pattern}/pattern:/match text pat +## This function tries to match PAT in TEXT and, if matching, stores the +## matched range in [MBEG, MEND) and returns the unmatched suffix in +## NEW_TAIL. +## +## @param[in] text +## The string where a matching substring is searched. +## @param[in] pat +## The pattern +## @var[out] mbeg mend +## Stores the matched range in TEXT. MBEG and MEND are the beginning and +## the end of the range, respectively. +## @var[out] new_tail +## Stores the unmatched remaining part of TEXT. In particular, the +## substring after MEND. +## @exit +## 0 if a matching is found, or otherwise 1. +## +## @fn ble/highlight/layer:{pattern}/pattern:regexp/match1 str pat +## This function tests if the specified string exactly matches the pattern. +## +## @param[in] str +## The string to be matched. +## @param[in] pat +## The pattern to matched STR. +## @exit +## 0 if the string matches the pattern, or otherwise 1 +## + +# pattern type: regexp + +function ble/highlight/layer:{pattern}/pattern:regexp/create-gpat { + IFS='|' builtin eval -- 'gpat="(${keys[*]})"' +} +function ble/highlight/layer:{pattern}/pattern:regexp/match { + ble/string#match "$1" "$2(.*)\$" || return 1 + new_tail=${BASH_REMATCH[${#BASH_REMATCH[@]}-1]} + mbeg=$((${#1}-${#BASH_REMATCH})) + mend=$((${#1}-${#new_tail})) + return 0 +} +function ble/highlight/layer:{pattern}/pattern:regexp/match1 { + [[ $1 =~ ^($2)$ ]] +} + +# pattern type: glob (longest extended glob matching) + +function ble/highlight/layer:{pattern}/pattern:glob/create-gpat { + IFS='|' builtin eval -- 'gpat="@(${keys[*]})"' +} +function ble/highlight/layer:{pattern}/pattern:glob/match { + local extglob= + shopt -q extglob && extglob=1 + shopt -s extglob + local prefix=${1%%$2*} ext=1 + if [[ $prefix != "$1" ]]; then + mbeg=${#prefix} + new_tail=${1:mbeg} + new_tail=${new_tail##$2} + ((mend=${#1}-${#new_tail})) + ext=0 + fi + [[ $extglob ]] || shopt -u extglob + return "$ext" +} +function ble/highlight/layer:{pattern}/pattern:glob/match1 { + [[ $1 == $2 ]] +} + +# pattern type: sglob (shortest extended glob matching) + +function ble/highlight/layer:{pattern}/pattern:sglob/create-gpat { + ble/highlight/layer:{pattern}/pattern:glob/create-gpat +} +function ble/highlight/layer:{pattern}/pattern:sglob/match { + local extglob= + shopt -q extglob && extglob=1 + shopt -s extglob + local prefix=${1%%$2*} ext=1 + if [[ $prefix != "$1" ]]; then + mbeg=${#prefix} + new_tail=${1:mbeg} + new_tail=${new_tail#$2} + ((mend=${#1}-${#new_tail})) + ext=0 + fi + [[ $extglob ]] || shopt -u extglob + return "$ext" +} +function ble/highlight/layer:{pattern}/pattern:sglob/match1 { + ble/highlight/layer:{pattern}/pattern:glob/match1 "$@" +} + +##----------------------------------------------------------------------------- + +function ble/highlight/layer:{pattern}/.match { + # If the text has the same content as the previous time, we skip the + # matching. + # + # Note: Initially, ((DMIN<0)) was used for the condition but turned out to be + # unusable for this purpose. DMIN only changes when the full content + # including the auto_complete insertion is changed. Even if the substantial + # part (excluding the auto_complete insertion) changes, DMIN can be negative + # when the full content does not change. + local rtext=_ble_highlight_layer_${1}_text + local text=$2 otext=${!rtext} + [[ $otext && $text == "$otext" ]] && return 0 + ble/util/set "$rtext" "$text" + + local ret + local dict=_ble_highlight_layer_${1}_dict + sel=() gflags=() + + # Retrieve regular expressions + local keys type + ble/util/restore-vars "_ble_highlight_layer_${1}_" keys type + ((${#keys[@]})) || return 0 + + local gpat + ble/highlight/layer:{pattern}/pattern:"$type"/create-gpat + local g0= + if ((${#keys[@]}==1)); then + ble/gdict#get "$dict" "${keys[0]}" && g0=$ret + fi + + local offset=0 tail=$text new_tail mbeg mend m + while [[ $tail ]] && ble/highlight/layer:{pattern}/pattern:"$type"/match "$tail" "$gpat"; do + ((mbeg+=offset,mend+=offset)) + if ((mbega||sel[i]==a&&i%2==0)) && ((sel[i]+=b-a)) + done + fi + + ble/highlight/layer:{selection}/update "$layer_name" "$text" +} + +function ble/highlight/layer:{pattern}/getg { + ble/highlight/layer:{selection}/getg "$@" +} diff --git a/.local/share/blesh/contrib/layer/sample.RandomColor.bash b/.local/share/blesh/contrib/layer/sample.RandomColor.bash new file mode 100644 index 0000000..b291fae --- /dev/null +++ b/.local/share/blesh/contrib/layer/sample.RandomColor.bash @@ -0,0 +1,35 @@ +# ble/contrib/layer/sample.RandomColor.bash (C) 2015, akinomyoga +# +# This is a sample implementation of a highlighting layer. This defines a +# random-color layer named `RandomColor'. To use the layer, the layer name can +# be inserted in the array `_ble_highlight_layer_list`: +# +# ```bash +# ble-import layer/sample.RandomColor +# ble/array#insert-before _ble_highlight_layer_list syntax RandomColor +# ``` +# +# Note: This code was first introduced in commit ec3f3661b@akinomyoga/ble.sh +# (2015-02-23) but later moved to contrib in refactoring on 2023-09-19. + +_ble_highlight_layer_RandomColor_buff=() + +function ble/highlight/layer:RandomColor/update { + local text=$1 ret i + _ble_highlight_layer_RandomColor_buff=() + for ((i=0;i<${#text};i++)); do + # _ble_highlight_layer_RandomColor_buff[i] に "<表示文字>" を設定する。 + # "<表示文字>" は ${_ble_highlight_layer_plain_buff[i]} でなければならない + # (或いはそれと文字幅が同じ物…ただそれが反映される保証はない)。 + ble/color/gspec2sgr "fg=$((RANDOM%256))" + _ble_highlight_layer_RandomColor_buff[i]=$ret${_ble_highlight_layer_plain_buff[i]} + done + PREV_BUFF=_ble_highlight_layer_RandomColor_buff + ((PREV_UMIN=0,PREV_UMAX=${#text})) +} +function ble/highlight/layer:RandomColor/getg { + # ここでは乱数を返しているが、実際は + # PREV_BUFF=_ble_highlight_layer_RandomColor_buff + # に設定した物に対応する物を指定しないと表示が変になる。 + local ret; ble/color/gspec2g "fg=$((RANDOM%256))"; g=$ret +} diff --git a/.local/share/blesh/contrib/layer/sample.RandomColor2.bash b/.local/share/blesh/contrib/layer/sample.RandomColor2.bash new file mode 100644 index 0000000..b9001e9 --- /dev/null +++ b/.local/share/blesh/contrib/layer/sample.RandomColor2.bash @@ -0,0 +1,34 @@ +# ble/contrib/layer/sample.RandomColor2.bash (C) 2015, akinomyoga +# +# This is a sample implementation of a highlighting layer. This defines a +# random-color layer named `RandomColor2'. To use the layer, the layer name can +# be inserted in the array `_ble_highlight_layer_list`: +# +# ```bash +# ble-import layer/sample.RandomColor2 +# ble/array#insert-before _ble_highlight_layer_list syntax RandomColor2 +# ``` +# +# Note: This code was first introduced in commit ec3f3661b@akinomyoga/ble.sh +# (2015-02-23) but later moved to contrib in refactoring on 2023-09-19. + +_ble_highlight_layer_RandomColor2_buff=() + +function ble/highlight/layer:RandomColor2/update { + local text=$1 ret i x + ble/highlight/layer/update/shift _ble_highlight_layer_RandomColor2_buff + for ((i=DMIN;i=0&&LAYER_UMIN>PREV_UMIN&&(LAYER_UMIN=PREV_UMIN), + PREV_UMAX>=0&&LAYER_UMAX=iN&&(i2=iN-1))) + + # update char buffer + ble/highlight/layer/update/shift _ble_highlight_layer_adapter_buff + local i g gprev=0 ctx=0 ret + ((i1>0)) && { ble/highlight/layer/getg "$((i1-1))"; gprev=$g; } + # ble/edit/info/show text "layer:adapter u = $i1-$i2" + for ((i=i1;i<=i2;i++)); do + local ch + if [[ ${_ble_region_highlight_table[i]} ]]; then + ch=${_ble_highlight_layer_plain_buff[i]} + ((g=_ble_region_highlight_table[i])) + if ((ctx!=0||g!=gprev)); then + ((ctx=0,gprev=g)) + ble/color/g2sgr "$g" + ch=$ret$ch + fi + else + builtin eval "ch=\${$PREV_BUFF[i]}" + if ((ctx!=1)); then + ((ctx=1,gprev=-1)) + ble/highlight/layer/update/getg + ble/color/g2sgr "$g" + ch=$ret$ch + fi + fi + + _ble_highlight_layer_adapter_buff[i]=$ch + done + + PREV_BUFF=_ble_highlight_layer_adapter_buff + if ((LAYER_UMIN_ble_edit_ind)); then + ble/syntax-highlight/append "$_ble_edit_ind $_ble_edit_mark bg=60,fg=231" + elif ((_ble_edit_mark<_ble_edit_ind)); then + ble/syntax-highlight/append "$_ble_edit_mark $_ble_edit_ind bg=60,fg=231" + fi + fi +} + +function ble/syntax-highlight+test { + local text=$1 + local i iN=${#text} w + local mode=cmd + for ((i=0;i/dev/null; then + type=jobs + else + type=error + fi ;; + (*) + type=error ;; + esac +} + +function ble/syntax-highlight+default { + local rex IFS=$_ble_term_IFS + local text=$1 + local i iN=${#text} w + local mode=cmd + for ((i=0;i'\''"\]|\\.)+' && [[ $tail =~ $rex ]]; then + # ■ time'hello' 等の場合に time だけが切り出されてしまう + + local word=${BASH_REMATCH[0]} + builtin eval "local cmd=${word}" + + # この部分の判定で fork を沢山する \if 等に対しては 4fork+2exec になる。 + # ■キャッシュ(accept-line 時に clear)するなどした方が良いかもしれない。 + local type; ble/util/type type "$cmd" + ble/syntax-highlight+default/type "$type" "$cmd" # -> type + if [[ $type = alias && $cmd != "$word" ]]; then + # alias を \ で無効化している場合 + # → unalias して再度 check (2fork) + type=$( + builtin unalias "$cmd" + ble/util/type type "$cmd" + ble/syntax-highlight+default/type "$type" "$cmd" # -> type + ble/util/put "$type") + elif [[ "$type" = keyword && "$cmd" != "$word" ]]; then + # keyword (time do if function else elif fi の類) を \ で無効化している場合 + # →file, function, builtin, jobs のどれかになる。以下 3fork+2exec + ble/util/joblist.check + if [[ ! ${cmd##%*} ]] && jobs "$cmd" &>/dev/null; then + # %() { :; } として 関数を定義できるが jobs の方が優先される。 + # (% という名の関数を呼び出す方法はない?) + # でも % で始まる物が keyword になる事はそもそも無いような。 + type=jobs + elif ble/is-function "$cmd"; then + type=function + elif enable -p | ble/bin/grep -q -F -x "enable $cmd" &>/dev/null; then + type=builtin + elif which "$cmd" &>/dev/null; then + type=file + else + type=error + fi + fi + + case $type in + (file) + ble/syntax-highlight/append "$i $((i+${#word})) fg=green" ;; + (alias) + ble/syntax-highlight/append "$i $((i+${#word})) fg=teal" ;; + (function) + ble/syntax-highlight/append "$i $((i+${#word})) fg=navy" ;; + (builtin) + ble/syntax-highlight/append "$i $((i+${#word})) fg=red" ;; + (builtin_bold) + ble/syntax-highlight/append "$i $((i+${#word})) fg=red,bold" ;; + (keyword) + ble/syntax-highlight/append "$i $((i+${#word})) fg=blue" ;; + (jobs) + ble/syntax-highlight/append "$i $((i+1)) fg=red" ;; + (error|*) + ble/syntax-highlight/append "$i $((i+${#word})) bg=224" ;; + esac + + ((i+=${#BASH_REMATCH})) + if rex='^keyword:([!{]|time|do|if|then|else|while|until)$|^builtin:eval$' && [[ $type:$cmd =~ $rex ]]; then + mode=cmd + else + mode=arg + fi + + continue + fi + elif [[ $mode == arg ]]; then + if rex='^([^"$'"$IFS"'|&;()<>'\''"`\]|\\.)+' && [[ $tail =~ $rex ]]; then + # ■ time'hello' 等の場合に time だけが切り出されてしまう + local arg=${BASH_REMATCH[0]} + + local file=$arg + [[ ( $file == '~' || $file = '~/'* ) && ! ( -e $file || -h $file ) ]] && file=$HOME${file:1} + if [[ -d $file ]]; then + ble/syntax-highlight/append "$i $((i+${#arg})) fg=navy,underline" + elif [[ -h $file ]]; then + ble/syntax-highlight/append "$i $((i+${#arg})) fg=teal,underline" + elif [[ -x $file ]]; then + ble/syntax-highlight/append "$i $((i+${#arg})) fg=green,underline" + elif [[ -f $file ]]; then + ble/syntax-highlight/append "$i $((i+${#arg})) underline" + fi + + ((i+=${#arg})) + continue + fi + fi + + # /^'([^'])*'|^\$'([^\']|\\.)*'|^`([^\`]|\\.)*`|^\\./ + if rex='^'\''([^'\''])*'\''|^\$'\''([^\'\'']|\\.)*'\''|^`([^\`]|\\.)*`|^\\.' && [[ $tail =~ $rex ]]; then + ble/syntax-highlight/append "$i $((i+${#BASH_REMATCH})) fg=green" + ((i+=${#BASH_REMATCH})) + mode=arg_ + continue + elif rex='^['"$IFS"']+' && [[ $tail =~ $rex ]]; then + ((i+=${#BASH_REMATCH})) + local spaces=${BASH_REMATCH[0]} + if [[ $spaces =~ $'\n' ]]; then + mode=cmd + else + [[ $mode = arg_ ]] && mode=arg + fi + continue + elif rex='^;;?|^;;&$|^&&?|^\|\|?' && [[ $tail =~ $rex ]]; then + if [[ $mode = cmd ]]; then + ble/syntax-highlight/append "$i $((i+${#BASH_REMATCH})) bg=224" + fi + ((i+=${#BASH_REMATCH})) + mode=cmd + continue + elif rex='^(&?>>?|<>?|[<>]&)' && [[ $tail =~ $rex ]]; then + ble/syntax-highlight/append "$i $((i+${#BASH_REMATCH})) bold" + ((i+=${#BASH_REMATCH})) + mode=arg + continue + elif rex='^(' && [[ $tail =~ $rex ]]; then + ((i+=${#BASH_REMATCH})) + mode=cmd + continue + fi + # 他 "...", ${}, $... arg と共通 + + ((i++)) + # a[]=... の引数は、${} や "" を考慮に入れるだけでなく [] の数を数える。 + done + + ble/syntax-highlight+region "$@" +} diff --git a/.local/share/blesh/contrib/prompt-defer.bash b/.local/share/blesh/contrib/prompt-defer.bash new file mode 100644 index 0000000..63161bd --- /dev/null +++ b/.local/share/blesh/contrib/prompt-defer.bash @@ -0,0 +1,150 @@ +# blesh/contrib/prompt-defer.bash (C) 2021, akinomyoga + +function ble/contrib/prompt-defer/.worker { + local prefix=$1 + local tmpfile=$_ble_base_run/$$.prompt.defer.$prefix + ble/contrib/prompt-defer:"$prefix"/worker + ble/util/put "$?" >| "$tmpfile" +} + +function ble/contrib/prompt-defer/.finalize { + local prefix=$1 + local tmpfile=$_ble_base_run/$$.prompt.defer.$prefix + ble/util/set "${prefix}_DEFER_bgpid" '' + + local ext + ble/util/readfile ext "$tmpfile" + ble/util/setexit "$ext" + ble/contrib/prompt-defer:"$prefix"/callback + + local ret; ble/util/clock + ble/util/set "${prefix}_DEFER_clock" "$ret" +} + +function ble/contrib/prompt-defer/clear { + local prefix=$1 script=' + [[ $PREFIX_DEFER_bgpid ]] && + builtin kill -9 "$PREFIX_DEFER_bgpid" &>/dev/null + PREFIX_DEFER_index= + PREFIX_DEFER_hash1= + PREFIX_DEFER_hash2= + PREFIX_DEFER_clock= + PREFIX_DEFER_bgpid=' + builtin eval -- "${script//PREFIX/$prefix}" +} + +## @fn ble/contrib/prompt-defer/submit prefix [hash1] [hash2] [opts] +## @param[in] prefix +## 関連変数の接頭辞を指定します。 +## +## @fn ble/comtrib/prompt-defer:$prefix/clear +## これまでに取得した情報を初期化します。後述の hash1 が前回の呼 +## び出しと異なる際に親シェルで呼び出されます。 +## +## @fn ble/comtrib/prompt-defer:$prefix/worker +## バックグラウンドの別プロセスで実行する処理を記述します。bash +## 4.0 以降ではサブシェルで呼び出されます。bash 4.0 未満では非同 +## 期に処理できない為、親シェルで実行されます。 +## +## @fn ble/comtrib/prompt-defer:$prefix/callback +## バックグラウンドの処理が完了した時に親シェルで呼び出される関 +## 数です。$? に worker の終了ステータスが設定された状態で呼び出 +## されます。 +## +## @var[internal] ${prefix}_DEFER_index +## @var[internal] ${prefix}_DEFER_hash1 +## @var[internal] ${prefix}_DEFER_hash2 +## @var[internal] ${prefix}_DEFER_clock +## @var[internal] ${prefix}_DEFER_bgpid +## 内部で使用する変数です。 +## +## @param[in] hash1 +## この値が前回の呼び出しと異なる時に強制的に情報の更新を行います。 +## +## @param[in] hash2 +## この値が前回の呼び出しと異なりかつ前回の呼び出しから十分時間が +## 経っている時に情報の更新を行います。 +## +## @param[in,opt] opts +## コロン区切りのオプションです。 +## +## cooling=NUM +## ミリ秒(整数)で情報のタイムアウトを指定します。プロンプト番号 +## または hash2 が前回と異なりかつ此処で指定した時間経過している +## 場合に再度情報更新を行います。 +## +## cooling-lines=NUM +## プロンプト更新回数を指定します。プロンプト番号が此処で指定し +## た回数以上変化している場合に再度情報更新を行います。 +## +## expires[=NUM] +## ミリ秒(整数)で情報のタイムアウトを指定します。プロンプト更新 +## の際に指定した時間経過している場合、強制的に情報更新を行いま +## す。既定値は 60000 (1分) です。 +## +## sync=NUM +## ミリ秒(整数)で同期的な情報取得のタイムアウトを指定します。 +## +function ble/contrib/prompt-defer/submit { + local prefix=$1 opts=$4 + local tmpfile=$_ble_base_run/$$.prompt.defer.$prefix + local rbgpid=${prefix}_DEFER_bgpid + + local opt_cooling=1000 opt_expires=none opt_nprompt=10 opt_sync=5 ret + ble/opts#extract-last-optarg "$opts" cooling && opt_cooling=$ret + ble/opts#extract-last-optarg "$opts" cooling-lines && opt_nprompt=$ret + ble/opts#extract-last-optarg "$opts" expires 60000 && opt_expires=$ret + ble/opts#extract-last-optarg "$opts" sync 60000 && opt_sync=$ret + + local oindex=${prefix}_DEFER_index; oindex=${!oindex-} + local ohash1=${prefix}_DEFER_hash1; ohash1=${!ohash1-} + local ohash2=${prefix}_DEFER_hash2; ohash2=${!ohash2-} + local oclock=${prefix}_DEFER_clock; oclock=${!oclock-} + + local nindex=$_ble_prompt_version + local nhash1=${2-done} # 強制 update を誘起する hashref + local nhash2=${3-done} # + + local update= + if [[ $nhash1 != "$ohash1" ]]; then + update=1 + ble/contrib/prompt-defer:"$prefix"/clear + elif [[ ! ${!rbgpid} ]]; then + if [[ $nindex:$nhash2 != "$oindex:$ohash2" ]]; then + if ((nindex<=oindex-opt_nprompt||oindex+opt_nprompt<=nindex)) || { local ret; ble/util/clock; ((ret>=oclock+opt_cooling)); }; then + update=1 + fi + elif [[ $opt_expires && $opt_expires != none ]]; then + if local ret; ble/util/clock; ((ret>=oclock+opt_expires)); then + update=1 + fi + fi + fi + + if [[ $update ]]; then + ble/util/set "${prefix}_DEFER_index" "$nindex" + ble/util/set "${prefix}_DEFER_hash1" "$nhash1" + ble/util/set "${prefix}_DEFER_hash2" "$nhash2" + + if ble/is-function ble/util/idle.push; then + if [[ ${!rbgpid} ]]; then + builtin kill -9 "${!rbgpid}" &>/dev/null + ble/util/idle.cancel "ble/contrib/prompt-defer/.finalize $prefix" + ble/util/set "$rbgpid" '' + fi + + >| "$tmpfile" + ble/util/set "$rbgpid" "$(ble/util/nohup 'ble/contrib/prompt-defer/.worker $prefix' print-bgpid)" + ((opt_sync>0)) && ble/util/msleep "$opt_sync" + if [[ -s $tmpfile ]]; then + ble/contrib/prompt-defer/.finalize "$prefix" + else + ble/util/idle.push -F "$tmpfile" "ble/contrib/prompt-defer/.finalize $prefix" + fi + + else + ble/contrib/prompt-defer:"$prefix"/worker + ble/contrib/prompt-defer:"$prefix"/callback + fi + fi +} diff --git a/.local/share/blesh/contrib/prompt-elapsed.bash b/.local/share/blesh/contrib/prompt-elapsed.bash new file mode 100644 index 0000000..38bcf26 --- /dev/null +++ b/.local/share/blesh/contrib/prompt-elapsed.bash @@ -0,0 +1,91 @@ +# blesh/contrib/prompt-elapsed.bash (C) 2022, Koichi Murase + +function ble/contrib/prompt-elapsed/output-sec.ps { + local sec=$1 min + ((min=sec/60,sec%=60)) + if ((min<100)); then + ble/prompt/print "${min}m${sec}s" + return 0 + fi + + local hour; ((hour=min/60,min%=60)) + if ((hour<100)); then + ble/prompt/print "${hour}h${min}m${sec}s" + return 0 + fi + + local day; ((day=hour/24,hour%=24)) + if ((day<365)); then + ble/prompt/print "${day}d${hour}h${min}m" + return 0 + fi + + local year; ((year=day/365,day%=365)) + ble/prompt/print "${year}y${day}d${hour}h" + return 0 +} + +function ble/contrib/prompt-elapsed/output-time-format.ps { + local msec=$1 + local d=${#msec} + if ((d<=3)); then + ble/prompt/print "${msec}msec" + return 0 + elif ((d<=5)); then + ble/prompt/print "${msec::d-3}.${msec:d-36-d}sec" + return 0 + fi + + local sec=$((msec/1000)) min + ((msec%=1000,min=sec/60,sec%=60)) + msec=000${msec}; msec=${msec:${#msec}-3} + if ((min<100)); then + ble/prompt/print "${min}m${sec}.${msec}s" + return 0 + fi + + ble/contrib/prompt-elapsed/output-sec.ps "$((min*60+sec))" +} + +function ble/prompt/backslash:contrib/elapsed { + [[ $_ble_exec_time_ata ]] || return 1 + + local ata=$_ble_exec_time_ata + local d=${#ata} + if ((d<=3)); then + ble/prompt/print "${ata}usec" + return 0 + elif ((d<=6)); then + if ((d<=5)); then + ble/prompt/print "${ata::d-3}.${ata:d-3:6-d}msec" + else + ble/prompt/print "${ata::3}msec" + fi + return 0 + elif ((d<=8)); then + ble/prompt/print "${ata::d-6}.${ata:d-6:3}sec" + return 0 + fi + + ble/contrib/prompt-elapsed/output-sec.ps "$((ata/1000000))" +} + +function ble/prompt/backslash:contrib/elapsed-real { + [[ $_ble_exec_time_ata ]] || return 1 + ble/contrib/prompt-elapsed/output-time-format.ps "$_ble_exec_time_tot" +} +function ble/prompt/backslash:contrib/elapsed-user { + [[ $_ble_exec_time_ata ]] || return 1 + ble/contrib/prompt-elapsed/output-time-format.ps "$_ble_exec_time_usr" +} +function ble/prompt/backslash:contrib/elapsed-sys { + [[ $_ble_exec_time_ata ]] || return 1 + ble/contrib/prompt-elapsed/output-time-format.ps "$_ble_exec_time_sys" +} +function ble/prompt/backslash:contrib/elapsed-cpu { + ((_ble_exec_time_tot)) || return 1 + + local pk=$(((_ble_exec_time_usr+_ble_exec_time_sys)*1000/_ble_exec_time_tot)) + ble/prompt/print "$((pk/10)).$((pk%10))%" + return 0 +} diff --git a/.local/share/blesh/contrib/prompt-git.bash b/.local/share/blesh/contrib/prompt-git.bash new file mode 100644 index 0000000..16a06a4 --- /dev/null +++ b/.local/share/blesh/contrib/prompt-git.bash @@ -0,0 +1,348 @@ +# blesh/contrib/prompt-git.bash (C) 2020-2021, akinomyoga + +# bleopt prompt_rps1='\q{contrib/git-info}' +# bleopt prompt_rps1='\q{contrib/git-name}' +# bleopt prompt_rps1='\q{contrib/git-hash}' +# bleopt prompt_rps1='\q{contrib/git-branch}' +# bleopt prompt_rps1='\q{contrib/git-path}' + +ble-import contrib/prompt-defer + +#------------------------------------------------------------------------------ + +_ble_contrib_prompt_git_data=() +_ble_contrib_prompt_git_base= +_ble_contrib_prompt_git_base_dir= +_ble_contrib_prompt_git_vars=(git_base git_base_dir hash branch) + +## @fn ble/contrib/prompt-git/.check-gitdir path +## @var[out] git_base git_base_dir +function ble/contrib/prompt-git/.check-gitdir { + local path=$1 + [[ -f $path/.git/HEAD ]] || return 1 + ble/prompt/unit/assign _ble_contrib_prompt_git_base "$path" + ble/prompt/unit/assign _ble_contrib_prompt_git_base_dir "$path/.git" + return 0 +} +## @fn ble/contrib/prompt-git/.check-submodule path +## @var[out] git_base git_base_dir +function ble/contrib/prompt-git/.check-submodule { + local path=$1 content + [[ -f $path/.git ]] || return 1 + ble/util/mapfile content < "$path/.git" + [[ $content == 'gitdir:'* ]] || return 1 + local git_base=$path + local git_base_dir=${content#'gitdir:'} + git_base_dir=${git_base_dir#' '} + [[ $git_base_dir == /* ]] || + git_base_dir=$path/$git_base_dir + [[ -f $git_base_dir/HEAD ]] + ble/prompt/unit/assign _ble_contrib_prompt_git_base "$git_base" + ble/prompt/unit/assign _ble_contrib_prompt_git_base_dir "$git_base_dir" + return 0 +} +function ble/prompt/unit:_ble_contrib_prompt_git/update { + ble/prompt/unit/add-hash '$PWD' + + ble/bin#has git || return 1 + # [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) ]] + local path=$PWD found= + while + if ble/contrib/prompt-git/.check-gitdir "$path"; then + [[ $prompt_unit_changed ]] + return "$?" + elif ble/contrib/prompt-git/.check-submodule "$path"; then + [[ $prompt_unit_changed ]] + return "$?" + fi + [[ $path == */* ]] + do path=${path%/*}; done + + ble/prompt/unit/assign _ble_contrib_prompt_git_base '' + [[ $prompt_unit_changed ]] +} + +## @fn ble/contrib/prompt-git/initialize +## @var[out] git_base git_base_dir +function ble/contrib/prompt-git/initialize { + ble/prompt/unit#update _ble_contrib_prompt_git + ble/util/restore-vars _ble_contrib_prompt_ git_base git_base_dir + [[ $git_base ]] +} + +## @fn ble/contrib/prompt-git/check-dirty +## 現在の working tree に編輯があるかどうかを非同期で取得します。 +## @var[in] git_base +_ble_contrib_prompt_git_dirty=0 +ble/contrib/prompt-defer/clear _ble_contrib_prompt_git_dirty +function ble/contrib/prompt-defer:_ble_contrib_prompt_git_dirty/clear { _ble_contrib_prompt_git_dirty=0; } +function ble/contrib/prompt-defer:_ble_contrib_prompt_git_dirty/worker { + # git 1.7.2 (2010-09) supports --ignore-submodules=untracked + git status --porcelain --ignore-submodules=untracked | ble/bin/awk ' + /^[^ ?]./ { staged = 1;} + /^.[^ ?]/ { unstaged = 1;} + /^\?\?/ { untracked = 1; } + END { + if (unstaged) exit 1; + if (staged) exit 2; + if (untracked) exit 3; + exit 0 + } + ' +} +function ble/contrib/prompt-defer:_ble_contrib_prompt_git_dirty/callback { _ble_contrib_prompt_git_dirty=$?; } +function ble/contrib/prompt-git/check-dirty { + [[ $_ble_contrib_prompt_git_base ]] || return 0 + ble/contrib/prompt-defer/submit _ble_contrib_prompt_git_dirty "$_ble_contrib_prompt_git_base" '' + ble/prompt/unit/add-hash '$_ble_contrib_prompt_git_dirty' + return "$_ble_contrib_prompt_git_dirty" +} +function ble/contrib/prompt-git/is-dirty { ble/contrib/prompt-git/check-dirty; (($?!=0&&$?!=3)); } +function ble/contrib/prompt-git/get-dirty-mark { + dirty_mark= + ble/contrib/prompt-git/check-dirty; local ext=$? + if [[ :$1: == *:colored:* ]]; then + case $ext in + (1) dirty_mark=$'\e[1;38:5:202m*\e[m' ;; + (2) dirty_mark=$'\e[1;32m*\e[m' ;; + (3) dirty_mark=$'\e[1;94m+\e[m' ;; + esac + else + case $ext in + (1) dirty_mark='*' ;; + (2) dirty_mark='^' ;; + (3) dirty_mark='+' ;; + esac + fi +} + +## @fn ble/contrib/prompt-git/update-head-information +## @var[out] hash branch +function ble/contrib/prompt-git/update-head-information { + [[ $hash || $branch ]] && return 0 + + local head_file=$git_base_dir/HEAD + [[ -s $head_file ]] || return 0 + local content; ble/util/mapfile content < "$head_file" + + if [[ $content == *'ref: refs/heads/'* ]]; then + branch=${content#*refs/heads/} + content= + + local branch_file=$git_base_dir/refs/heads/$branch + if [[ -s $branch_file ]]; then + ble/util/mapfile content < "$branch_file" + elif local refs_file=$git_base_dir/info/refs; [[ -s $refs_file ]]; then + local lines line + ble/util/mapfile lines < "$refs_file" + for line in "${lines[@]}"; do + if [[ $line == *["$_ble_term_IFS"]refs/heads/"$branch" ]]; then + content=${line%%[$_ble_term_IFS]*} + break + fi + done + fi + fi + + [[ $content && ! ${content//[0-9a-fA-F]} ]] && hash=$content + return 0 +} +## @fn ble/contrib/prompt-git/get-tag-name +## @var[out] tag +function ble/contrib/prompt-git/get-tag-name { + # ble/util/assign-array tag 'git describe --tags --exact-match 2>/dev/null' + tag= + ble/contrib/prompt-git/update-head-information # -> hash, branch + [[ $hash ]] || return 1 + + local file tagsdir=$git_base_dir/refs/tags hash1 + local files ret; ble/util/eval-pathname-expansion '"$tagsdir"/*'; files=("${ret[@]}") + for file in "${files[@]}"; do + local tag1=${file#$tagsdir/} + [[ -s $file ]] || continue + ble/util/mapfile hash1 < "$file" + if [[ $hash1 == "$hash" ]]; then + tag=$tag1 + return 0 + fi + done + + if local refs_file=$git_base_dir/info/refs; [[ -s $refs_file ]]; then + local lines line + ble/util/mapfile lines < "$refs_file" + for line in "${lines[@]}"; do + if [[ $line == "$hash"["$_ble_term_IFS"]refs/tags/* ]]; then + tag=${line##refs/tags/*} + return 0 + fi + done + fi +} + +## @fn ble/contrib/prompt-git/get-state opts +## @var[out] ret +function ble/contrib/prompt-git/get-state { + local opts=$1 + # https://github.com/git/git/blob/4fd6c5e44459e6444c2cd93383660134c95aabd1/contrib/completion/git-prompt.sh#L452-L475 + # https://github.com/git/git/blob/4fd6c5e44459e6444c2cd93383660134c95aabd1/contrib/completion/git-prompt.sh#L312-L333 + if [[ -d $git_base_dir/rebase-merge ]]; then + ret=REBASE + elif [[ -d $git_base_dir/rebase-apply ]]; then + if [[ -f $git_base_dir/rebase-apply/rebasing ]]; then + ret=REBASE + elif [[ -f $git_base_dir/rebase-apply/applying ]]; then + ret=AM + else + ret=AM/REBASE + fi + elif [[ -f $git_base_dir/MERGE_HEAD ]]; then + ret=MERGING + elif [[ -f $git_base_dir/CHERRY_PICK_HEAD ]]; then + ret=CHERRY-PICKING + elif [[ -f $git_base_dir/REVERT_HEAD ]]; then + ret=REVERTING + elif + local todo= rest IFS=$_ble_term_IFS + [[ -f $git_base_dir/sequencer/todo ]] && + ble/bash/read todo rest < "$git_base_dir/sequencer/todo" + [[ $todo == p || $todo == pick ]]; then + ret=CHERRY-PICKING + elif [[ $todo == revert ]]; then + ret=REVERTING + elif [[ -f $git_base_dir/BISECT_LOG ]]; then + ret=BISECTING + elif ble/contrib/prompt-git/update-head-information; [[ ! $branch ]]; then + ret=DETACHED + elif [[ $branch && ! $hash ]]; then + ret=ORPHAN + else + ret= + fi + + if [[ :$opts: == *:colored:* ]]; then + case $ret in + (REBASE) ret=$'\e[1;48;5;27;38;5;231m '$ret$' \e[m' ;; + (AM | AM/REBASE) ret=$'\e[1;48;5;34;38;5;231m '$ret$' \e[m' ;; + (MERGING) ret=$'\e[1;48;5;172;38;5;231m '$ret$' \e[m' ;; + (CHERRY-PICKING) ret=$'\e[1;48;5;200;38;5;231m '$ret$' \e[m' ;; + (REVERTING) ret=$'\e[1;48;5;124;38;5;231m '$ret$' \e[m' ;; + (BISECTING) ret=$'\e[1;48;5;93;38;5;231m '$ret$' \e[m' ;; + (DETACHED) ret=$'\e[91m'$ret$'\e[m' ;; + (ORPHAN) ret=$'\e[38;5;70m'$ret$'\e[m' ;; + (?*) ret=$'\e[1;48;5;242;38;5;231m '$ret$' \e[m' ;; + esac + fi + + [[ $ret ]] +} + +function ble/contrib/prompt-git/describe-head { + local opts=:$1: + ret= + + local dirty_mark= + [[ $opts == *:check-dirty:* ]] && + ble/contrib/prompt-git/get-dirty-mark colored + + ble/contrib/prompt-git/update-head-information # -> hash, branch + if [[ $branch ]]; then + local sgr=$'\e[1;34m' sgr0=$'\e[m' + local out=$sgr$branch$sgr0 + if [[ $opts == *:add-hash:* && $hash ]]; then + out="$out (${hash::7}$dirty_mark)" + else + out=$out$dirty_mark + fi + + [[ $opts == *:check-state:* ]] && + ble/contrib/prompt-git/get-state colored && + out="$ret $out" + ret=$out + return 0 + fi + + local tag + ble/contrib/prompt-git/get-tag-name + if [[ $tag ]]; then + local sgr=$'\e[1;32m' sgr0=$'\e[m' + local out=$sgr$tag$sgr0 + [[ $opts == *:add-hash:* && $hash ]] && + out="$out ${hash::7}" + out=$out$dirty_mark + [[ $opts == *:check-state:* ]] && + ble/contrib/prompt-git/get-state colored && + out="$ret ($out)" + ret=$out + return 0 + fi + + # "master~23" 等の分かりにくい説明なのでこれは使わない + # ble/util/assign-array ret 'git describe --contains --all 2>/dev/null' + # if [[ $ret ]]; then + # local label_detached=$'\e[91mDETACHED\e[m' + # local sgr=$'\e[32m' sgr0=$'\e[m' + # ret="($label_detached at $sgr$ret$sgr0)" + # return 0 + # fi + + if [[ $hash ]]; then + local out=${hash::7}$dirty_mark + [[ $opts == *:check-state:* ]] && + ble/contrib/prompt-git/get-state colored && + out="$ret ($out)" + ret=$out + return 0 + fi + + ret=$'\e[91mUNKNOWN\e[m' +} + +#------------------------------------------------------------------------------ + +function ble/prompt/backslash:contrib/git-info { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + if ble/contrib/prompt-git/initialize; then + local sgr=$'\e[1m' sgr0=$'\e[m' + local name=$sgr${git_base##*?/}$sgr0 + local ret; ble/contrib/prompt-git/describe-head add-hash:check-dirty:check-state; local branch=$ret + ble/prompt/print "$name $branch" + [[ $PWD == "$git_base"/?* ]] && + ble/prompt/print " /${PWD#$git_base/}" + return 0 + else + return 1 + fi +} +function ble/prompt/backslash:contrib/git-name { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + if ble/contrib/prompt-git/initialize; then + local name=${git_base%.git} + name=${name%/} + name=${name##*?/} + ble/prompt/print "${git_base##*?/}" + fi +} +function ble/prompt/backslash:contrib/git-hash { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + if ble/contrib/prompt-git/initialize; then + ble/contrib/prompt-git/update-head-information + ble/prompt/print "${hash::${1:-7}}" + fi +} +function ble/prompt/backslash:contrib/git-branch { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + if ble/contrib/prompt-git/initialize; then + local ret; ble/contrib/prompt-git/describe-head check-dirty + ble/prompt/print "$ret" + fi +} +function ble/prompt/backslash:contrib/git-path { + local "${_ble_contrib_prompt_git_vars[@]/%/=}" # WA #D1570 checked + if ble/contrib/prompt-git/initialize; then + if [[ $PWD == "$git_base"/?* ]]; then + ble/prompt/print "/${PWD#$git_base/}" + elif [[ $PWD == "$git_base" ]]; then + ble/prompt/print / + fi + fi +} diff --git a/.local/share/blesh/contrib/prompt-vim-mode.bash b/.local/share/blesh/contrib/prompt-vim-mode.bash new file mode 100644 index 0000000..f1574f3 --- /dev/null +++ b/.local/share/blesh/contrib/prompt-vim-mode.bash @@ -0,0 +1,20 @@ +# ble/contrib/prompt-vim-mode.bash (C) 2020-2021, akinomyoga + +# \q{contrib/vim-mode} (Prompt escape sequence) +# +# Example: +# +# ble-import contrib/prompt-vim-mode +# PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' +# bleopt keymap_vi_mode_show:= +# + +function ble/prompt/backslash:contrib/vim-mode { + local mode; ble/keymap:vi/script/get-mode + case $mode in + ([iR]*) ble/prompt/print '(ins)' ;; + (*n) ble/prompt/print '(cmd)' ;; + (*x) ble/prompt/print '(vis)' ;; + (*s) ble/prompt/print '(sel)' ;; + esac +} diff --git a/.local/share/blesh/contrib/scheme/base16.bash b/.local/share/blesh/contrib/scheme/base16.bash new file mode 100644 index 0000000..212ec74 --- /dev/null +++ b/.local/share/blesh/contrib/scheme/base16.bash @@ -0,0 +1,53 @@ +# bash +# Copyright 2024, akinomyoga + +# Color scheme "base16" for ble.sh + +ble-import contrib/scheme/default + +function ble/contrib/scheme:base16/initialize { + ble/contrib/scheme:default/initialize + + ble-face -s argument_error 'fg=red,underline' + ble-face -s auto_complete 'fg=black,bg=silver' + ble-face -s cmdinfo_cd_cdpath 'fg=navy,bg=yellow' + ble-face -s command_directory 'fg=blue,underline' + ble-face -s command_function 'fg=magenta' + ble-face -s disabled 'fg=silver' + ble-face -s filename_directory 'fg=blue,underline' + ble-face -s filename_directory_sticky 'fg=white,bg=blue,underline' + ble-face -s filename_orphan 'fg=cyan,bg=brown,underline' + ble-face -s filename_setgid 'fg=black,bg=lime,underline' + ble-face -s filename_setuid 'fg=black,bg=yellow,underline' + ble-face -s menu_filter_input 'fg=black,bg=yellow' + ble-face -s overwrite_mode 'fg=black,bg=cyan' + ble-face -s prompt_status_line 'fg=white,bg=gray' + ble-face -s region 'fg=white,bg=navy' + ble-face -s region_insert 'fg=blue,bg=silver' + ble-face -s region_match 'fg=white,bg=navy' + ble-face -s region_target 'fg=black,bg=cyan' + ble-face -s syntax_brace 'fg=teal,bold' + ble-face -s syntax_comment 'fg=silver' + ble-face -s syntax_document 'fg=olive' + ble-face -s syntax_document_begin 'fg=olive,bold' + ble-face -s syntax_error 'fg=white,bg=red' + ble-face -s syntax_expr 'fg=blue' + ble-face -s syntax_function_name 'fg=magenta,bold' + ble-face -s syntax_glob 'fg=magenta,bold' + ble-face -s syntax_history_expansion 'fg=white,bg=brown' + ble-face -s syntax_param_expansion 'fg=magenta' + ble-face -s syntax_tilde 'fg=blue,bold' + ble-face -s syntax_varname 'fg=olive' + ble-face -s varname_array 'fg=olive,bold' + ble-face -s varname_empty 'fg=teal' + ble-face -s varname_export 'fg=megenta,bold' + ble-face -s varname_expr 'fg=blue,bold' + ble-face -s varname_hash 'fg=green,bold' + ble-face -s varname_new 'fg=green' + ble-face -s varname_number 'fg=olive' + ble-face -s varname_readonly 'fg=magenta' + ble-face -s varname_transform 'fg=teal,bold' + ble-face -s varname_unset 'fg=silver' + ble-face -s vbell_erase 'bg=silver' + return 0 +} diff --git a/.local/share/blesh/contrib/scheme/catppuccin_mocha.bash b/.local/share/blesh/contrib/scheme/catppuccin_mocha.bash new file mode 100644 index 0000000..57ccef5 --- /dev/null +++ b/.local/share/blesh/contrib/scheme/catppuccin_mocha.bash @@ -0,0 +1,63 @@ +# Scheme Inspired by catppuccin mocha +# https://github.com/catppuccin/catppuccin +# initial idea/work by @abhijeeth-babu +# https://github.com/akinomyoga/ble.sh/discussions/411#discussioncomment-10088978 + +ble-import contrib/scheme/default + +function ble/contrib/scheme:catppuccin_mocha/initialize { + ble/contrib/scheme:default/initialize + + ble-face -s argument_error 'bg=#f38ba8,fg=#11111b' # Red background, Crust foreground for better contrast + ble-face -s argument_option 'fg=#f2cdcd,italic' # Flamingo + ble-face -s auto_complete 'fg=#45475a,italic' # Surface1 + ble-face -s cmdinfo_cd_cdpath 'fg=#89b4fa,bg=#11111b,italic' # Blue, Crust + ble-face -s command_alias 'fg=#74c7ec' # Sapphire + ble-face -s command_builtin 'fg=#fab387' # Peach + ble-face -s command_directory 'fg=#89b4fa' # Blue + ble-face -s command_file 'fg=#74c7ec' # Sapphire + ble-face -s command_function 'fg=#74c7ec' # Sapphire + ble-face -s command_keyword 'fg=#cba6f7' # Mauve + ble-face -s disabled 'fg=#313244' # Surface0 + ble-face -s filename_directory 'fg=#89b4fa' # Blue + ble-face -s filename_directory_sticky 'fg=#11111b,bg=#a6e3a1' # Crust, Green + ble-face -s filename_executable 'fg=#a6e3a1,bold' # Green + ble-face -s filename_ls_colors 'none' + ble-face -s filename_orphan 'fg=#89dceb,bold' # Sky + ble-face -s filename_other 'none' + ble-face -s filename_setgid 'fg=#11111b,bg=#f9e2af,underline' # Crust, Yellow + ble-face -s filename_setuid 'fg=#11111b,bg=#fab387,underline' # Crust, Peach + ble-face -s menu_filter_input 'fg=#11111b,bg=#f9e2af' # Crust, Yellow + ble-face -s overwrite_mode 'fg=#11111b,bg=#89dceb' # Crust, Sky + ble-face -s prompt_status_line 'bg=#9399b2' # Overlay2 + ble-face -s region 'bg=#45475a' # Surface1 + ble-face -s region_insert 'bg=#45475a' # Surface1 + ble-face -s region_match 'fg=#11111b,bg=#f9e2af' # Crust, Yellow + ble-face -s region_target 'fg=#11111b,bg=#cba6f7' # Crust, Mauve + ble-face -s syntax_brace 'fg=#6c7086' # Overlay0 + ble-face -s syntax_command 'fg=#74c7ec' # Sapphire + ble-face -s syntax_comment 'fg=#f9e2af' # Yellow + ble-face -s syntax_delimiter 'fg=#6c7086' # Overlay0 + ble-face -s syntax_document 'fg=#f5e0dc,bold' # Rosewater + ble-face -s syntax_document_begin 'fg=#f5e0dc,bold' # Rosewater + ble-face -s syntax_error 'bg=#f38ba8,fg=#11111b' # Red background, Crust foreground for better contrast + ble-face -s syntax_escape 'fg=#f2cdcd' # Flamingo + ble-face -s syntax_expr 'fg=#cba6f7' # Mauve + ble-face -s syntax_function_name 'fg=#b4befe' # Lavender + ble-face -s syntax_glob 'fg=#fab387' # Peach + ble-face -s syntax_history_expansion 'fg=#b4befe,italic' # Lavender + ble-face -s syntax_param_expansion 'fg=#f38ba8' # Red + ble-face -s syntax_quotation 'fg=#a6e3a1' # Green + ble-face -s syntax_tilde 'fg=#cba6f7' # Mauve + ble-face -s syntax_varname 'fg=#f5e0dc' # Rosewater + ble-face -s varname_array 'fg=#fab387' # Peach + ble-face -s varname_empty 'fg=#fab387' # Peach + ble-face -s varname_export 'fg=#fab387' # Peach + ble-face -s varname_expr 'fg=#fab387' # Peach + ble-face -s varname_hash 'fg=#fab387' # Peach + ble-face -s varname_number 'fg=#f5e0dc' # Rosewater + ble-face -s varname_readonly 'fg=#fab387' # Peach + ble-face -s varname_transform 'fg=#fab387' # Peach + ble-face -s varname_unset 'bg=#f38ba8,fg=#11111b' # Red background, Crust foreground for better contrast + ble-face -s vbell_erase 'bg=#45475a' # Surface1 +} diff --git a/.local/share/blesh/contrib/scheme/default.bash b/.local/share/blesh/contrib/scheme/default.bash new file mode 100644 index 0000000..f128cb1 --- /dev/null +++ b/.local/share/blesh/contrib/scheme/default.bash @@ -0,0 +1,25 @@ +# bash +# Copyright 2024, akinomyoga + +# Default color scheme for ble.sh + +function ble/contrib/scheme:default/initialize { + ble-face -r region region_@ + ble-face -r disabled + ble-face -r overwrite_mode + ble-face -r vbell vbell_@ + ble-face -r syntax_@ + ble-face -r command_@ + ble-face -r filename_@ + ble-face -r varname_@ + ble-face -r argument_@ + ble-face -r prompt_status_line + ble-face -r cmdinfo_cd_cdpath + ble-face -r auto_complete + ble-face -r menu_filter_fixed + ble-face -r menu_filter_input + ble-face -r menu_desc_default + ble-face -r menu_desc_type + ble-face -r menu_desc_quote + return 0 +} diff --git a/.local/share/blesh/contrib/syntax/edit.named-command.bash b/.local/share/blesh/contrib/syntax/edit.named-command.bash new file mode 100644 index 0000000..fc1f96e --- /dev/null +++ b/.local/share/blesh/contrib/syntax/edit.named-command.bash @@ -0,0 +1,106 @@ +# blesh/contrib/syntax/edit.named-command.bash +# (C) 2024, Koichi Murase + +ble-import core-syntax + +#------------------------------------------------------------------------------ +# syntax + +function ble/syntax:edit.named-command/initialize-ctx { + ctx=$_ble_ctx_EDIT_NamedCommand +} +function ble/syntax:edit.named-command/initialize-vars { return 0; } + +_ble_syntax_context_proc[_ble_ctx_EDIT_NamedCommand]=ble/syntax:edit.named-command/ctx-rlfunc + +function ble/syntax:edit.named-command/ctx-rlfunc { + if ble/string#match "$tail" $'^[[:blank:]]+'; then + ((_ble_syntax_attr[i]=_ble_ctx_UNSPECIFIED,i+=${#BASH_REMATCH})) + return 0 + elif ble/string#match "$tail" $'^[^[:blank:]]+'; then + local name=$BASH_REMATCH + + # determine the color + local ret + ble/builtin/bind/rlfunc2widget/type "$name" + case $ret in + (rlfunc) _ble_syntax_attr[i]=$_ble_attr_KEYWORD ;; + (widget) _ble_syntax_attr[i]=$_ble_attr_CMD_FUNCTION ;; + (*) _ble_syntax_attr[i]=$_ble_attr_FILE_WARN ;; + esac + + # register a word + ble/syntax/parse/word-push "$ctx" "$i" + ((i+=${#name})) + ble/syntax/parse/word-pop + ((ctx=_ble_ctx_UNSPECIFIED)) + return 0 + else + ((ctx=_ble_ctx_UNSPECIFIED)) + ble/syntax:text/ctx-unspecified + fi +} + +#------------------------------------------------------------------------------ +# completion + +function ble/complete/action:edit.named-command/initialize { return 0; } +function ble/complete/action:edit.named-command/initialize.batch { inserts=("${cands[@]}"); } +function ble/complete/action:edit.named-command/complete { ble/complete/action/complete.addtail ' '; } +function ble/complete/action:edit.named-command/get-desc { + case $DATA in + (rlfunc) desc='(readline bindable function)' ;; + (widget) desc='(ble.sh widget)' ;; + (*) desc='(unknown)' ;; + esac + desc=$desc_sgrt$desc$desc_sgr0 +} +function ble/complete/action:edit.named-command/init-menu-item { + local ret + case $DATA in + (rlfunc) ble/color/face2g command_keyword; g=$ret ;; + (widget) ble/color/face2g command_function; g=$ret ;; + (*) ble/color/face2g argument_error; g=$ret ;; + esac +} + +function ble/complete/source:edit.named-command { + # ToDo: これで良いのか? 外側も書き換えないと挿入時や menu-filter で問題になるのでは + local COMPS=$COMPS COMPV=$COMPS comps_flags= comps_fixed= + ble/complete/source/reduce-compv-for-ambiguous-match + + "${_ble_util_set_declare[@]//NAME/mark}" # disable=#D1570 + + local dict entry + if ble/builtin/bind/rlfunc2widget/load-dict; then + for entry in "${dict[@]}"; do + ((cand_iloop++%bleopt_complete_polling_cycle==0)) && ble/complete/check-cancel && return 148 + local rl= widget= + ble/bash/read rl widget <<< "$entry" + if [[ $rl == "$COMPS"* && $widget != - ]]; then + ble/set#add mark "$rl" + ble/complete/cand/yield edit.named-command "$rl" rlfunc + fi + done + fi + + local widgets widget + ble/util/assign-array widgets 'compgen -A function -X "ble/widget/*.*" -- "ble/widget/$COMPS"' + for widget in "${widgets[@]}"; do + ((cand_iloop++%bleopt_complete_polling_cycle==0)) && ble/complete/check-cancel && return 148 + widget=${widget#ble/widget/} + ble/set#contains mark "$widget" || + ble/complete/cand/yield edit.named-command "$widget" widget + done + + return 0 +} + +_ble_syntax_completion_context_check_prefix[_ble_ctx_EDIT_NamedCommand]=edit.named-command/rlfunc +function ble/syntax/completion-context/prefix:edit.named-command/rlfunc { + local word=${text:istat:index-istat} + ble/string#match "$word" $'^[[:blank:]]*' + ble/syntax/completion-context/add edit.named-command "$((istat+${#BASH_REMATCH}))" +} + +_ble_syntax_completion_context_check_here[_ble_ctx_EDIT_NamedCommand]='add edit.named-command' diff --git a/.local/share/blesh/licenses/LICENSE.md b/.local/share/blesh/licenses/LICENSE.md new file mode 100644 index 0000000..60789a4 --- /dev/null +++ b/.local/share/blesh/licenses/LICENSE.md @@ -0,0 +1,12 @@ +Copyright (c) 2013, 2015-2023, K. Murase @akinomyoga , +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.local/share/blesh/licenses/contrib/LICENSE b/.local/share/blesh/licenses/contrib/LICENSE new file mode 100644 index 0000000..074fea0 --- /dev/null +++ b/.local/share/blesh/licenses/contrib/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2020-2021, K. Murase @akinomyoga , +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/.local/share/doc/blesh/CONTRIBUTING.md b/.local/share/doc/blesh/CONTRIBUTING.md new file mode 100644 index 0000000..dd09ed1 --- /dev/null +++ b/.local/share/doc/blesh/CONTRIBUTING.md @@ -0,0 +1,348 @@ +# Contribution Guide + +## How to contribute + +### Issues + +You can freely create an issue using the following links: + +- Report and fixes for bugs and performance issues [[Here]](https://github.com/akinomyoga/ble.sh/issues/new?template=00_T1-bug_report.md) +- Questions on usage [[Here]](https://github.com/akinomyoga/ble.sh/issues/new?template=00_T2-feature_request.md) +- Feature request [[Here]](https://github.com/akinomyoga/ble.sh/issues/new?template=00_T3-help.md) +- Others (suggestions, projects, discussion, complaints, news, information or anything) [[Here]](https://github.com/akinomyoga/ble.sh/issues/new?template=00_T4-free_style.md) + +### Pull requests + +We always welcome the following types of pull requests. Any changes will be considered to be provided under the BSD 3-Clause License. +If you do not know whether your changes would be appropriate for merge, please feel free to create a pull request and let us talk with each other! + +- Better translation to English, typo fixes +- Fixes, optimization, test cases +- New features +- New color themes ... We accept new themes in [`contrib`](https://github.com/akinomyoga/blesh-contrib/pulls) repository. +- Others + +### Wiki + +You can freely edit [wiki pages](https://github.com/akinomyoga/ble.sh/wiki). + +- Translations +- Typo fixes +- Create new pages + +## For package maintainers + +If you are a package maintainer for a repository of Linux distribution, etc. +you may provide a package-specific setting by preparing +a file `/path/to/blesh/lib/_package.sh` (e.g. `/usr/share/blesh/lib/_package.sh`) +which will be sourced after the load of `ble.sh` just before sourcing user's configuration (`~/.blerc`). + +- In the file, the shell variable `_ble_base_package_type=TYPE` should be + set up to have a repository-specific name (such as `AUR`). + +- The function named `ble/base/package:TYPE/update` (where `TYPE` + matches with a value assigned to `_ble_base_package_type`) may be + provided to define a custom updating procedure. The exit status of the function can be + - `0` ... when the update succeeded + - `6` ... when the update was skipped because the package was up to date. + - `125` ... when it wants to fall back to the built-in updating procedure of `ble.sh`. + - Other ... when the update failed + +An example `lib/_package.sh` might be + +```bash +_ble_base_package_type=apt + +function ble/base/package:apt/update { + sudo apt upgrade blesh +} +``` + +You can also find a real example for AUR (Arch User Repository) [here](https://aur.archlinux.org/cgit/aur.git/tree/blesh-update.sh?h=blesh-git). + +## Summary of codebase + +The core script file `ble.sh` is generated by combining the following files: + +- `ble.pp` ... Basic initialiation +- `src/def.sh` ... Prototype definitions +- `src/util.sh` ... Basic utility functions +- `src/decode.sh` ... User-input decoder and keybindings +- `src/color.sh` ... Terminal graphic attributes +- `src/canvas.sh` ... Terminal layout engine + - `src/canvas.emoji.sh` ... Emoji database +- `src/history.sh` ... Command history management +- `src/edit.sh` ... Line editor +- `src/benchmark.sh` ... Measure processing time +- `lib/core-completion.sh` ... Prototype definition for completions +- `lib/core-syntax.sh` ... Prototype definitions for syntax analyzer + +Useful features are implemented in separate modules: + +- `lib/keymap.vi.sh` ... Vim mode + - `lib/vim-arpeggio.sh` ... `vim-arpeggio`-like plugin + - `lib/vim-surround.sh` ... `vim-surround`-like plugin +- `lib/keymap.emacs.sh` ... Emacs mode +- `lib/core-syntax.sh` ... Shell parser and syntax highlighting + - `lib/core-syntax-ctx.def` ... Definition of parser states +- `lib/core-complete.sh` ... Completions including `menu-complete`, `auto-complete`, `menu-filter`, `dabbrev`, `sabbrev`, etc. + +The following files are initialization scripts: + +- `lib/init-term.sh` ... Initialize terminal escape sequences (host-to-terminal, i.e. control sequences) +- `lib/init-cmap.sh` ... Initialize terminal escape sequences (terminal-to-host, i.e. key sequences) +- `lib/init-bind.sh` ... Initialize readline attacher +- `lib/init-msys1.sh` ... Workaround for MSYS1 with broken pipes + - `lib/init-msys1-helper.c` ... Helper C program for the workaround of broken pipes + +The contrib repository contains configurations built on top of the `ble.sh` framework + +- `contrib/config/*.bash` are specific configurations whose details may depend on the user's preferences. These are expected to work just by `ble-import` but at the same time serve as examples for the user's personal versions. +- `contrib/sample/*.bash` are examples to explain interfaces for configurations. These are just explanation of the interface so would not actually function. +- `contrib/airline/*.bash` are the themes for `vim-airline`. +- `contrib/integration/*.bash` are codes needed for the adjustments with other framework. +- `contrib/*.bash` are other miscellaneous configurations. Usually one needs additional configuration after `ble-import`. These files may be moved to another directory in the future. + +## Tests + +Tests can be run by one of the following commands: + +```bash +$ make check +$ make check-all +$ bash out/ble.sh --test + +``` + +Currently, test coverage is very small +partly because the testing for interactive behavior and terminal rendering results is hard. +Nevertheless, the tests are defined in the following files: + +- `lib/core-test.sh` ... Library for tests +- `lib/test-bash.sh` +- `lib/test-main.sh` +- `lib/test-util.sh` +- `lib/test-canvas.sh` +- `lib/test-edit.sh` +- `lib/test-complete.sh` +- `lib/test-syntax.sh` + +## Coding styles + +These styles are not required for the initial PR as these are too complicated. +The maintainer(s) will apply the styles before merging. +Nevertheless, it would be useful to follow the styles when you are going to submit PRs many times. + +### Naming convention for functions + +The function names roughly have the following structure, but the rule is ambiguous to some extent, and there are also many exceptions in the codebase. + +```ebnf +function_name = (namespace '/')* function_basename ; + +namespace = function_basename ; + +function_basename = name ext? (* namespace function *) + | class '.' name ext? (* class method *) + | class '#' name ext? (* instance method *) + | class '#' class '::' name ext? (* instance method (override) *) + | type ':' name ext? ; (* customization point *) + +name = hyphenated_name (* public *) + | '.' hyphenated_name ; (* private *) + +ext = '.hook' (* hook functions for blehook *) + | '.draw' (* function operating on DRAW_BUFF *) + | '.fib' (* worker for ble/util/fiberchain *) + | '.proc' (* callback functions *) + | '.impl' ; (* internal implementation *) + (* ... (and more extensions) *) + +class = name ; + +type = hyphenated_name ; + +hyphenated_name = (word '-')* word ; + +word = /[_a-zA-Z0-9]+/ ; +``` + +The function names are basically hyphenated words (such as `foo-bar-baz` instead of `foo_bar_baz`, `fooBarBaz`, or `FooBarBaz`). + +**Namespace**--The function names can be prefixed by namespaces of the form `/`. +Except for the functions intended to be called from the command line or the user configuration, all the functions should be defined in a namespace. +The interface of the functions defined in a namespace is subject to change in the future. +A function name can also be used as the namespace name for the helper functions to implement the function. +For the functions defined in external modules, the following namespace should be used to avoid conflicts: + +| Types | Namespace | +|:----------------------------------------------------|----------------------------------------| +| `contrib/*.bash` | `ble/contrib/` | +| `contrib/config/*.bash` | `ble/contrib/config:` | +| `contrib/integration/*.bash` | `ble/contrib/integration:` | +| User's public config | e.g. `` | +| User's private config | e.g. `` or `my` | +| User's private config in Bash initialization file | e.g. ``, `my` or `bashrc` | +| User's private config in ble.sh initialization file | e.g. ``, `my` or `blerc` | + +**Private**--The function basename started with `.` is considered private within the namespace. All the other functions are public. + +**Method**--The function basename of the form `#` is considered an instance method. +The function basename of the form `.` is considered a class method. +The difference between the two is the latter assumes a single global state while the former assumes that an instance is specified by the first argument or by other means. +The way to specify the instance depends on the class. +For example, `ble/array#*` receives the variable name as the first argument while `ble/string#*` directly receives the string value as the first argument. +For `ble/textarea#*`, the target instance is selected by the shell variable `_ble_textarea_panel`. +The function basename of the form `#::` is used to define a virtual function called by the base class `` at the side of the derived class ``. + +**Customization point**--The function basename of the form `:` is used to provide the customization point for dynamic values. +This function is typically called as `:"$var"` with `var` contains a value that depends on the context including the currently selected class, user configuration, etc. + +**Extension**--The extension `` can be used to mark the specific types of functions. + +### Naming convention for variables + +The variable names roughly have the following structure. + +```ebnf +local_variable_name = varname + | '__ble_' varname + | '_ble_local_' varname ; + +global_variable_name = ('_' namespace)* '_' varname ; + +namespace = word ; +varname = (word '_')* word ; +word = /[a-zA-Z0-9]+/ ; +``` + +The variable names are basically lowercase underscored words such as `foo_bar_baz` (instead of `fooBarBaz` or `FooBarBaz`). +Some global constants and the exported variables have all-uppercase names, but the lowercase should be basically used. + +**Local variables**--The local variables that are only used in the declared function should be basically unprefixed by an underscore. +When the function reads/returns a value through an arbitrary name of in/out variables, +the local variable declared within the function should be prefixed by `__ble_` or `_ble_local_` to avoid the name conflicts between the local and in/out variables. + +**Global variables**--All the global variables, except for the variables that are intended to be directly modified from the command line, should be prefixed by `_`. +Currently, there are no variables intended to be directly modified from the command line[Note 1]. +The variables defined in external modules should be namespaced by the module name. +The variables in modules in the `contrib` repository should have the prefix `_ble_contrib__` + +- [Note 1] In the initial implementation of ble.sh, the ble.sh options are provided as shell variables `bleopt_*`. +As remnant or for backward compatibility, the values of ble.sh options are still stored in the variables of the name `bleopt_*`, +but these variables for the ble.sh options will be renamed in the future. + +### Function interface + +The success/failure states should be returned by the exit status. + +**`ret`**--All the other values should be basically returned through shell variables. +This is because, if a function returned its result through the standard output, +the caller would need to capture the results by a command substitution which involves a fork of a subshell and thus is slow. +Here, efficiency is the primary interest, so there are exceptions where the standard output can be more efficient: +For example, when the output needs to be saved to a file for later use or to be passed to a different process, +or when the output needs to be processed by the external commands that read the standard input. +The variable name to return a value should be basically `ret` unless the purpose of the function is to store values. +When the function basename has the form `get-`, one should consider returning the result through the shell variable named ``. +When a function returning multiple values is called from many places, the function may receive an array name as the first argument and store the result in the specified array. +When the out variable names are specified in the arguments, they should come first in the list of the arguments. + +**`opts`**--The argument position should be basically fixed (e.g., never shifted by optional arguments like `-f` or `-o name`). +The optional arguments can be specified by colon-separated fields (like `SHELLOPTS` or `BASHOPTS`) +instead of the Unix-style flags and options like `-f` and `-o optarg`. +This is because the parsing of the Unix-style arguments (with or without `getopts`) is usually slow. +The local variable that receives the colon-separated option typically has the name `opts` or `*opts` (e.g. `local opts=$2`). +A single option has the form `name` or `name=value`, +where `name` should be hyphenated words like `foo-bar-baz`. +The former form without the value is called a flag option. +One can test a flag option by `[[ :$opts: == *:flag-name:* ]]`. +An option of the form `name=value` can be matched by `ble/opts#extract-first-optarg`, `ble/opts#extract-last-optarg`, or `ble/opts#extract-all-optargs`. +The function `ble/opts#has` can be used to test if either `name` or `name=value` is contained + +**`$*`**--The functions that receive a string should not allow a variable number of arguments that are joined inside the function. +A variable number of arguments should be used only when each argument is really processed separately. +If necessary, the joining should be performed at the caller side. +This is because `IFS` in the caller context affects the joining `$*`, so the handling of `IFS` should be properly done at the caller side. +Another reason is for the future extension, e.g., to add another optional argument. + +### Variable declarations + +Local variables should be declared by `local` (instead of `declare` or `typeset`). +Variables should be always initialized before referencing their values. This is because uninitialized variables can have random values when `shopt -s localvar_inherit` is turned on. + +The declaration and the initialization of an array variable should be separated as far as the initializer values contain any expansions or spaces. +There is a bug in Bash 3.0 that the values are separated by whitespaces even when the values are quoted. +When the declaration and the initialization of an array variable are made in a single command, the option `-a` needs to be specified. +Without `-a`, the entire list `(...)` including the surrounding parens will be treated as a scalar string in Bash 3.0. + +```bash +local v; v=("$var") +local -a v=() + +# The following may not work as expected +# local v=() # Bash 3.0 will initialize a scalar with the value v='()' #D0184 +# local -a v=("a b") # Bash 3.0 will split it into the two elements "a" and "b" #D0525 +``` + +Defining local readonly variables should be avoided +because they will hide global variables from the utilities `ble/variable#is-global`, `ble/util/print-global-definitions`, etc. +Global readonly variables should never be defined. +The background is described in the Limitation section of README. + +### Conditional commands `[[ ... ]]` + +Do not use `[ ... ]` or `test` unless it is intended to be a POSIX script. Always use `[[ ... ]]`. + +Use `[[ word ]]` and `[[ ! word ]]` instead of `[[ -n word ]]` and `[[ -z word ]]`. + +Use `==` instead of the operator `=` inside conditional commands. + +**Quoting**--The right-hand sides of `==` and `!=` inside conditional commands `[[ ... ]]` should be properly quoted. +The right-hand sides of `=~` inside the conditional commands `[[ ... ]]` should be specified by a single parameter expansion +as `[[ word =~ $rex ]]`, or one can use `ble/string#match 'word' "$rex"` instead. +In other contexts, the arguments of the conditional command should not be quoted +unless raw special characters ``[[:blank:]|&;<>\`"$]`` are contained in the argument. + +**No `-eq` etc**--Basically use arithmetic commands `((expr))` +instead of the operators `-eq`, `-ne`, `-gt`, `-ge`, `-lt`, and `-le` of the conditional command. +They might be used when the test is used as a part of complicated conditions in the conditional commands. +For example, `[[ -f $file || $word && word -eq 0 ]]` can be used instead of `[[ -f $file ]] || { [[ $word ]] && ((word == 0)); }` because sticking with the arithmetic command would unnecessarily complicate the code in this case. + +### Other styles + +**Function definition**--There are two forms of function definitions, the POSIX style `func()` and the ksh style `function func`, as well as the mixed form. +We always use the ksh style of the function definition. +The reasons are that it is easier to search by the keyword `function ` and that it is protected by the aliases of the same name as the function (unless the user defines an alias with the same name as the keyword `function`). +The function body is always the compound command `{ ... }` (instead of any other compound commands such as `( ... )`, `for`, `if`, etc.), and the opening brace `{` is placed on the first line. + +```bash +function function-name { + : do_something +} +``` + +**`ble/util/print`**--Use `ble/util/print` instead of `echo`. Use `ble/util/put` instead of `echo -n`. +The control characters should be directly specified by the escape string literal `$'...'` instead of relying on the conversion by `echo -e`. +This is because the builtin `echo` can change its behavior depending on the shell option `shopt -s xpg_echo`, where the backslashes in the arguments might have special meaning. +`ble.sh` is intended to work under any possible user options. + +**Quote/unquote**--The arguments where the word splitting and pathname expansions can take place need to be always quoted. +When the subject word of the `case` statement and the right-hand sides of variable assignments +(including those specified to assignment builtins `declare`, `typeset`, `local`, `export`, and `readonly`) +contains `$*`, `${arr[*]}`, or raw special characters ``[[:blank:]|&;<>\`"$]``, they need to be quoted. +In other contexts, the subject word of `case` and the right-hand sides of variable assignments should not be quoted. +In these contexts, the word splitting and pathname expansions will never happen, so the quoting is unnecessary. + + +Array subscripts are arithmetic context, so the arithmetic expansions `$((expr))` inside the array subscripts are redundant. One should simply write it as `arr[expr]` instead of `arr[$((expr))]`. + +**`ble/util/assign`**--Use `ble/util/assign`, `ble/util/assign-array`, and `ble/util/assign-words` instead of `var=$(cmd)`, `mapfile -t var <<< "$(cmd)"`, and `var=($(cmd))`, respectively. +The command substitutions `$(...)` are slow because they involve the forks of subshells. + +**External commands**--Implement it using built-in Bash features as much as possible. +If the same result can be obtained by built-in Bash features efficiently, do not use the external commands. +When the external command is used, first freeze the path by calling `ble/bin#freeze-utility-path ''` and call the commands through `ble/bin/`. +Or save the path of the external command in a variable, and call the command through the variable as `"$_saved_cmd" args...`. +The POSIX commands should be basically used. If non-POSIX commands are used, a POSIX fallback should be always prepared. +Please combine multiple calls of external commands into a single call of the command as much as possible. +Usually, a single call of `sed` and `awk` is preferred over the chain of simple commands. diff --git a/.local/share/doc/blesh/ChangeLog.md b/.local/share/doc/blesh/ChangeLog.md new file mode 100644 index 0000000..e143e7a --- /dev/null +++ b/.local/share/doc/blesh/ChangeLog.md @@ -0,0 +1,3347 @@ + +# ble-0.4.0-devel4 + +2023-04-03... (`#D2030`...) 1a5c451c... + +## New features + +- Bash 5.3 support + - syntax: support bash-5.3 function subst `${ list; }` `#2045` 0906fd95 71272a4b + - decode(bind): support the colonless form of `bind -x` of bash-5.3 `#D2106` 78d7d2e3 + - util(joblist): fix job detection in Bash 5.3 `#D2157` 6d835818 + - util(joblist): exclude more foreground dead jobs in Bash 5.3 `#D2174` 8a321424 + - global: work around function names with slashes in Bash 5.3 POSIX mode `#D2221` 48c7bbee + - main: fix workaround for the posix vi-insert C-i binding in `bash <= 5.0` (reported by vasi786) `#D2243` 8e7ed824 + - main: update the startup message for debug versions of Bash `#D2222` afb29073 + - main: shorten the startup message for debug versions `#D2241` 0bc8610a + - main: suppress `--bash-debug-version` in `ble-reload` `#D2275` ec422115 + - main (`ble/base/check-bash-debug-version`): print messages to stderr `#D2239` 8904d588 + - decode(read-user-settings): read the colonless form of `bind -x` of Bash 5.3 `#D2233` 62b23b69 + - progcomp: use Bash 5.3 `compgen -V` for completions with newlines (motivated by RBT22) `#D2253` 0e8c388a + - progcomp: fix a bug that `x` at the end of the last completion is trimmed `#D2308` d9faeb37 + - main: fix attach failure with `--attach=prompt` in Bash 5.3 POSIX mode `#D2267` 49845707 + - syntax: fix a problem that `$_` is not preserved `#D2269` e053690d + - keymap/vi: support bash-5.3 readline bindable function `bash-vi-complete` in `vi_nmap` `#D2305` 55e0ee71 + - syntax: parse function name as a word `#D2360` 72364a51 + - util (`ble/builtin/trap/invoke.sandbox`): set `BASH_TRAPSIG` `#D2364` 858630e5 +- bgproc: support opts `kill9-timeout=TIMEOUT` `#D2034` 3ab41652 +- progcomp(cd): change display name and support mandb desc (requested by EmilySeville7cfg) `#D2039` 74402098 +- cmdspec: add completion options for builtins (motivated by EmilySeville7cfg) `#D2040` 9bd24691 +- complete: support `bleopt complete_requote_threshold` (requested by rauldipeas) `#2048` bb7e118e +- menu (`ble/widget/menu/append-arg`): add option `bell` (motivated by bkerin) `#D2066` 3f31be18 bbf3fed3 +- make: support `make uninstall` `#D2068` a39a4a89 +- edit: support `bleopt {edit_marker{,_error},exec_exit_mark}` `#D2079` e4e1c874 +- edit: add widget `zap-to-char` `#D2082` ce7ce403 +- keymap/vi: split widget `text-object` into `text-object-{inner,outer}` (requested by Darukutsu) `#D2093` 11cf118a +- keymap/vi: implement text-object in xmap for brackets (requested by Darukutsu) `#D2095` 7d80167c +- util: support `ble-import -C callback` (motivated by Dominiquini) `#D2102` 0fdbe3b0 +- mandb: look for git subcommands (motivated by bkerin) `#D2112` 9641c3b8 +- edit (`display-shell-version`): show the `atuin` version `#D2124` 9045fb87 +- complete: add widgets `auto_complete/insert-?word` (requested by Tommimon) `#D2127` 0c4b6772 + - auto-complete: insert word only when the cursor is at the end of line `#D2212` b72d78a9 +- edit: add widgets `execute-named-command` and `history-goto` `#D2144` aa92b42a +- keymap/vi_nmap: support `shell-expand-line` `#D2145` aa92b42a + - decode: fix quoting of `WIDGET` and `LASTWIDGET` (reported by 3ximus) `#D2205` 1313390b +- main: support `bash ble.sh --install` `#D2169` 986d26a3 3801a87e +- util(stty): support `bleopt term_stty_restore` (requested by TheFantasticWarrior) `#D2170` e64b02b7 + - util: update workaround of Bash 5.2 `checkwinsize` for `term_stty_restore` (reported by TheFantasticWarrior) `#D2184` ef8272a4 +- magic expansions + - edit: support `bleopt edit_magic_accept` (requested by pl643, bkerin) `#D2175` 3e9d8907 + - edit: support `bleopt edit_magic_accept=verify-syntax` `#D2178` ac84c153 + - edit: support `bleopt edit_magic_{expand,accept}=autocd` (motivated by Jai-JAP) `#D2187` b6344b3b +- main: support shell variable `BLE_VER` `#D2177` a12dedab +- util(bleopt, blehook, ble-face): support wildcards `*` and `?` and change `@` to match an empty string `#D2182` bf595293 +- complete(cd): complete variable names for `cdable_vars` `#D2190` 10527901 +- sabbrev: support suffix sabbrev to emulate Zsh's suffix aliases `#D2191` d66e05d2 + - sabbrev: fix bugs in sabbrev matching and positioning (reported by dgudim) `#D2198` 70a325f9 +- complete: support `ble-face menu_desc_{default,type,quote}` (requested by romaia) `#D2193` b3e7237e +- complete: support `bleopt complete_menu_complete_opts=hidden` and menu-style switching (requested by CamRatliff) `#D2199` 16ff7df7 +- syntax: support `ln=target` in `bleopt filename_ls_colors` (requested by akhilkedia) `#D2213` e169e31d +- syntax: support arbitrary suffixes in `bleopt filename_ls_colors` `#D2213` e169e31d +- util(vbell): support `bleopt vbell_align=panel` (requested by bb010g) `#D2228` fe85e0dd +- highlight: reflect the top-level positional parameters `#D2246` f08e8f08 +- color: adjust default fg values in faces and add `bleopt color_scheme` (requested by mattmc3) `#D2248` e4cce0ea 5f5554a8 `#D2258` d6a38c43 `#D2263` 0aa66b25 + - syntax(highlight/vartype): add `ble-face varname_new` `#D2272` 5bfc0ae5 + - syntax(highlight/vartype): check variable existence for `${var?...}` `#D2273` 5bfc0ae5 +- highlight: add `bleopt highlight_eval_word_limit` (motivated by orionalves) `#D2256` 6833bdf8 +- progcomp: support `complete -E` `#D2257` ffac4205 + - progcomp: fix `complete -I` for empty words (reported by blackteahamburger) `#D2262` 9270b529 +- make: support make variable `USE_DOC=no` (requested by blackteahamburger) `#D2260` 40fe9c95 134a38d1 c5caedf7 + - make: fix condition for the `INSDIR_LICENSE` rule (reported by Jai-JAP) `#D2260` 5a8dcb4b +- edit (`ble/widget/display-shell-version`): print shell options `#D2261` 70b89e5e ed5d451b +- edit: enable `BLE_PIPESTATUS` and `PIPESTATUS` in `PROMPT_COMMAND` and prompts (requested by mattmc3) `#D2276` 27888830 +- nsearch: support `action={load-{line,command},insert{,-line}}` (motivated by vaab) `#D2286` 32f290df +- complete: support completion for `execute-named-command` `#D2288` 4fee44e6 +- complete: support `ble-face menu_complete_{match,selected}` (requested by simonLeary42) `#D2291` 31f264ad +- edit: support `bleopt history_default_point={preserve,begin,end,near,far,{beginning,end}-of-line,preserve-column,...}` (requested by miltieIV2) `#D2297` 37291ff1 + - edit: support `bleopt history_default_point=auto` (reported by miltieIV2) `#D2297` 2a3351e7 + - color: fix a bug that reverse rendition vanishes `#D2318` 209b4da0 +- edit: support `bleopt undo_point={first,last,near,auto}` `#D2303` 99af0ece +- keymap/vi: add readline-compatible widgets for `vi_imap` and `vi_nmap` (requested by excited-bore) `#D2304` d7ec488a +- edit: support bash-5.2 readline bindable function `vi-edit-and-execute-command` `#D2306` c395eb33 cc47acc2 +- edit: support readline bindable function `paste-from-clipboard` in more environments `#D2307` 17646524 + - edit (`paste-from-clipboard`): fix wrong command names to freeze `#D2344` 262baf0e +- keymap/vi: support `:marks` `#D2320` 01182d3b +- cmap: add dsr0 for ESC [ 0 n `#D2338` adf53ed3 +- decode: record timeout in keyboard macro `#D2343` e8045741 +- edit: add keybindings C-up and C-down for history movements (requested by DJCrashdummy) `#D2370` d7afee00 +- util (`bleopt`): support `bleopt var+=value var-=value` for colon-separated lists `#D2381` 27816536 +- complete: support `bleopt complete_auto_complete_opts=syntax-unique` (motivated by David0tt) `#D2382` 2f564e63 +- complete: support `bleopt complete_auto_complete_opts={syntax,history}-disabled` (motivated by Diabochi) `#D2383` 2f564e63 +- complete: support `bleopt complete_auto_complete_opts=suppress-inside-{line,word}:syntax-suppress-{ambiguous,empty}` (requested by pallaswept) `#D2384` 2f564e63 +- util (`bleopt`, etc.): highlight shell quoting by backslash `#D2388` xxxxxxxx + +## Changes + +- edit: clear character highlighting for overwriting mode (requested by mozirilla213) `#D2052` 1afc616b +- history (`ble/builtin/history -w`): write file even without any new entries (requested by Jai-JAP) `#D2053` c78e5c9f +- auto-complete: overwrite subsequent characters with self-insert in overwrite mode `#D2059` 7044b2db +- complete: move face definitions `menu_filter_*` to `core-complete-def.sh` `#D2060` af022266 +- make: add `INSDIR_LICENSE` for install location of licenses (reported by willemw) `#D2064` d39998f0 acf3b091 +- prompt: show prompt ruler after markers (motivated by U-Labs) `#D2067` e4a90378 +- complete: suffix a space to non-filenames with `compopt -o filenames` (reported by Dominiquini) `#D2096` aef8927f +- edit: distinguish space and delimiters in `cword` and `eword` `#D2121` 4f453710 +- prompt: update status line on face change (motivated by Vosjedev) `#D2134` f3e7e386 +- decode: specify the default keymap for the keymap load hooks `#D2141` 4a34ccf2 +- progcomp(compopt): refactor the completion option `ble/{no- => }default` `#D2155` 51f9f4f6 +- main: export `BLE_SESSION_ID` `#D2188` 5871fea2 +- menu-complete: adjust cursor position with `insert-selection` disabled (reported by gvlassis) `#D2206` 341179d1 +- decode (`ble-bind`): do not convert registered C0 (motivated by gvlassis) `#D2210` cbf87fdc + - decode: process @ESC generated by CSI sequence (reported by gvlassis, 10b14224cc, lokxii) `#D2214` 365101cf +- decode (`ble-bind`): support combined option arguments of the forms `--long=OPTARG` and `-kOPTARG` `#D2211` 1b16d399 +- canvas: use `_ble_term_invis` to hide characters used to determine char-width modes (requested by tessus) `#D2223` 8bb302e0 + - canvas: hide cursor during char-width detection (requested by tessus) `#D2232` 0ff29b26 +- exec: refine the elapsed time resolution `#D2249` 67548656 713c4215 +- highlight (`ble/syntax/highlight/vartype`): reference the saved states of variables `#D2268` 063249b4 +- complete: attempt pathname expansions of incomplete pattern for `COMPV` (reported by mcepl) `#D2278` 6a426954 +- make: save commit id and branch name with `git archive` (requested by LecrisUT, blackteahamburger) `#D2290` 31f264ad +- edit: revert edits with widget `discard-line` (reported by dezza) `#D2301` 3b2b4b81 +- vi_nmap: fix cursor position after C-o `#D2302` c106239a +- decode (`ble-bind`): initialize specified keymaps (motivated by quantumfrost) `#D2324` 66e450d7 +- edit (`display-shell-version`): show `(integration: off)` for plugins with integration turned off `#D2330` 2ff03257 + - edit (`display-shell-version`): fix a bug that `WARNING` is never shown `#D2347` 8dfaa4e8 +- decode (`ble/debug/keylog`): exclude duplicate characters due to backtracking `#D2332` 355d1dc0 0379e034 + +## Fixes + +- util (`conditional-sync`): fix bugs when `pid=PID` is specified (contributed by bkerin) `#D2031` 09f5cec2 `#D2034` 09f5cec2 + - util (`conditional-sync`): fix wrong command grouping overwriting `pid=PID` (reported by dragonde, georglauterbach) `#D2122` +- bgproc: return status of bgproc process `#D2036` 887d92dd +- mandb: replace TAB with 4 spaces before removing control characters (reported by EmilySeville7cfg) `#D2038` 313cfb25 +- menu(desc): fix a bug that prefix is not shown with menu-filter `#D2039` e92b78d6 +- progcomp: make option unique after applying mandb description `#D2042` 308ceeed +- util (`ble/util/idle`): fix an infinite loop `#D2043` 5f4c0afd +- main: fix `--inputrc=TYPE` not applied on startup `#D2044` 1b15b851 0adce7c9 +- stty: suggest `stty sane` after exiting from bash >= 5.2 to non-ble session `#D2046` b57ab2d6 +- util (`ble/builtin/readonly`): adjust bash options (reported by dongxi8) `#D2050` 1f3cbc01 +- history (`ble/builtin/history`): fix error message on the empty `HISTFILE` `#D2061` a2e2c4b6 +- complete: exit auto-complete mode on complete self-insert `#D2075` 2783d3d0 +- complete: fix error messages on empty command names `#D2085` dab8dd04 +- complete: fix parsing the output of `complete -p` in bash-5.2 (reported by maheis) `#D2088` a7eb5d04 +- make: specify bash to search the awk path using `type -p` (reported by rashil2000) `#D2089` 26826354 +- keymap/vi: fix the behavior of text-object for quotes in xmap (reported by Darukutsu) `#D2094` 5f9a44ec +- edit(redo): fix broken common prefix/suffix determination (reported by Darukutsu) `#D2098` c920ea65 +- keymap/vi: improve text-object in omap for brackets (reported by Darukutsu) `#D2100` d1a1d538 +- decode(bind): fix command-line argument parsing `#D2107` 57a13c3c +- edit(gexec): fix a bug that `LINENO` is vanishing `#D2108` b5776596 +- mandb: fix extraction of option description in format 5 (reported by bkerin) `#D2110` 90a992cc +- decode: fix handling of @ESC in quoted-insert `#D2119` 0bbc3639 +- syntax: save stat after command name for consistent completion-context `#D2126` 50d6f1bb +- term: fix control sequences for hiding cursor (reported by n87) `#D2130` f9b9aea8 + - term: fix `_ble_term_rmcivis` for `TERM=linux` `#D2197` 56765251 +- highlight: fix inconsistent tab width in plain layer (reported by dgudim) `#D2132` f9072c40 +- decode: consume incomplete keyseq in macros `#D2137` 27e6309e +- keymap/vi: fix conflicting binding to C-RET in `vi_imap` `#D2146` 0b18f3c2 +- decode: force updating cache for @ESC `#D2148` 6154d71c +- progcomp(compopt): support printing the current options (reported by bkerin) `#D2154` 51f9f4f6 +- progcomp(compopt): properly handle dynamically specified `plusdirs` `#D2156` 51f9f4f6 +- edit: fix `BLE_COMMAND_ID` starting from `2` `#D2160` 8f4bf62a +- util(vbell): fix previous vbell not fully cleared `#D2181` 6c740a94 +- decode(rlfunc): fix widget name `vi-command/edit-and-execute-{line => command}` (fixed by alexandregv) 6aa8ba67 +- util(ble/util/idle.push): fix uninitialized `ble/util/idle.clock` (reported by Anyborr) `#D2189` 83ceb124 +- prompt: clear list for the cylic dependency detection (reported by micimize, neilbags) `#D2200` 61968497 00cae745b +- util.hook: fix user DEBUG trap not executed at the top-level context `#D2202` 828fcfc1 +- keymap/vi(relative-line.impl): fix uninitialized variable `nmove` `#D2203` 4268650d +- edit: render the final prompt before updating command history (motivated by pallaswept) `#D2207` 911a4051 + - debug: support `bleopt debug_profiler_opts=tree` `#D2216` a453f373 + - edit: fix leftover region after command execution `#D2247` 75c4a848 +- keymap/vi: fix C-w not saving the word into kill ring `#D2208` aa7ca45d +- edit: fix standard streams in `EXIT` trap with `ble/widget/exit` `#D2217` 89f0dab8 + - edit: fix regressions of vbell and `ble/builtin/exit` in Bash 3.2 `#D2265` f5955d5f +- util(`ble/fd#cloexec`): check `fdflags` compatibility to avoid crash `#D2227` c3b3aaf8 +- util(`ble/function#evaldef`): suppress alias expansions (reported by 103sbavert) `#D2240` 51e762fe + - main: fix a bug that `_ble_bash` is missing (reported by tessus and Knusper) `#D2242` bb2dae6e a9b962d2 9eb1fee7 +- mandb: fix incorrect use of `groff` in place of `nroff` `#D2245` e0ffc418 +- edit: fix fd broken by ble-attach of new session in user space (reported by JohEngstrom) `#D2271` 49f97618 670c7ea0 +- util (`ble-import`): do not specify arguments to `-C callback` `#D2277` 4f0e94a2 +- main: fix issues with `ble/bin/awk` (reported by devidw) `#D2292` b0a7adcb +- util (`ble/path#remove-glob`): fix a bug that `*` matches and removes multiple paths `#D2310` fd518d24 +- decode (`bind`): print the filename and line in error messages (motivated by excited-bore) `#D2311` 89c69077 +- util: fix the race condition of `ble/util/idle.clock` and the `TMOUT` initialization (reported by Anyborr, georglauterbach) `#D2314` 154386de +- util (`ble/util/save-vars`): support saving sparse arrays to preserve undos and marks `#D2319` 486314c5 +- main (`connect_tty`): do not reject `connect_tty=inherit` by the initial check of `ble.pp` `#D2335` d6d69dad +- decode: clear info panel when cmap cache is updated before attaching `#D2340` d7a16347 +- edit (`display-shell-version`): fix a bug that `contrib/integration/bash-preexec` is not detected `#D2347` 8dfaa4e8 +- util (`bleopt`): fix a bug that previous match result for `=` affects `var:=` `#D2352` 8bea90d1 + - util (`ble/string#quote-words`): correct the comparison operator (fixup 8bea90d1) (contributed by anoriqq) +- syntax: fix a bug that the completion does not start with `<<[TAB]` `#D2354` 94109ea7 +- syntax: fix infinite loop with `case a in \^J` `#D2361` 173ec27f +- util (`ble/util/writearray`): fix a bug in use of gensub in gawk (reported by allenap, LeonardoMor, aaronjamt, ionesculiviucristian, Gabryx64) `#D2368` +- complete: fix a bug that `mandb` record is generated as completions (reported by allenap) `#D2369` f1ccf771 +- stty: avoid adjusting the `stty` state if it has never been modified (reported by LEI) `#D2376` edb21da9 +- main: fix the initialization order of `ble/bin/awk` (contributed by yecho) `github#613` 8060b7ad +- util (`ble/util/load-standard-builtin`): actually load from `$loadable_path` (fixup 044c016a) (contributed by xarblu) `github#611` 52c38977 +- edit: run `bleopt editor` with `eval` `#D2380` eff10c4b +- complete: fix extra quoting of requote with incomplete word `#D2386` xxxxxxxx +- cmdspec (`declare/chroma`): fix a bug of evaluating global variable `d` (reported by LeonardoMor) `#D2387` xxxxxxxx + +## Compatibility + +- Terminal detection + - util: detect Zellij heuristically `#D2219` 86034398 + - term: detect iTerm2 `#D2224` da6e71db + - util: update the iTerm2 detection `#D2331` dde63fa3 + - util: update the VTE detection `#D2335` 3b4cdf2e +- main: check `nawk` version explicitly `#D2037` 0ff7bca1 +- mandb: inject in bash-completion-2.12 interfaces `#D2041` dabc8553 +- complete: determine comp prefix from `COMPS` when `ble/syntax-raw` is specified (reported by teutat3s) `#D2049` f16c0d80 +- syntax: allow double-quotes in `$(())` in bash-4.4 (requested by mozirilla213) `#D2051` 611c1d93 +- syntax: support version-dependent arithmetic backslash `#D2051` 611c1d93 +- util: work around mawk 1.3.3-20090705 regex (reported by dongxi8, Frezrik) `#D2055` 4089c4e1 +- complete: update a workaround for cobra-1.5.0 (reported by 3ximus) `#D2057` a24435d3 +- make: work around ecryptfs bug (reported by juanejot) `#D2058` 969a763e dc0cdb30 +- edit: update mc-4.8.29 integration (reported by mooreye) `#D2062` 2c4194a2 68c5c5c4 +- make: work around `make-3.81` bug of pattern rules `#D2065` f7ec170b +- decode: work around `convert-meta on` in bash >= 5.2 with broken locale (reported by 3ximus) `#D2069` 226f9718 +- canvas: adjust GraphemeClusterBreak of hankaku-kana voiced marks `#D2077` 31d168cc +- canvas: update tables and grapheme clusters for Unicode 15.1.0 `#D2078` 503bb38b 9d84b424 9d84b424 +- complete: use conditional-sync for cobraV2 completions (reported by sebhoss) `#D2084` 595f905b +- term: add workarounds for `eterm` `#D2087` a643f0ea +- global: adjust bash options for utilities outside the ble context (motivated by jkemp814) `#D2092` 6b144de7 +- decode,syntax: quote `$#` in arguments properly `#D2097` 40a625d3 +- global: work around case-interleaving collation (reported by dongxi8) `#D2103` a3b94bb3 +- nsearch: set `immediate-accept` for `empty=emulate-readline` (reported by blackteahamburger) `#D2104` 870ecef7 +- decode, vi_digraph: trim CR of text resources in MSYS `#D2105` 6f4badf4 +- progcomp: conditionally suffix space for git completion (reported by bkerin) `#D2111` 2c7cca2f +- main: fix initialization errors with `set -u` `#D2116` b503887a +- progcomp: work around slow `make` completion in large repository (reported by blackteahamburger) `#D2117` 5f3a0010 +- util(TRAPEXIT): fix condition for `stty sane` in Cygwin `#D2118` a7f604e1 +- progcomp: fix the detection of the zoxide completion (reported by 6801318d8d) `#D2120` 29cd8f10 +- progcomp: pass original command path to completion functions (reported by REmerald) `#D2125` 0cf0383a +- main: work around nRF Connect initialization (requested by liyafe1997) `#D2129` 2df3b109 +- main(unload): redirect streams to work around trap `EXIT` in bash-5.2 (reported by ragnarov) `#D2142` 38a8d571 +- complete: call the `docker` command through `ble/util/conditional-sync` `#D2150` 6c3f824a +- util,complete: work around regex `/=.../` failing in Solaris nawk `#D2162` 46fdf44a +- main: fix issues in MSYS1 `#D2163` 5f0b88fb +- util: work around bash-3.1 bug that `10>&-` fails to close the fd `#D2164` b5938192 +- decode: fix the problem that key always timed out in bash-3 `#D2173` 0b176e76 +- term: adjust the result of `tput clear` for `ncurses >= 6.1` (reported by cmndrsp0ck) `#D2185` 18dd51ab +- main: work around WSL's permission issue on `/run/user/1000` (reported by antonioetv and geoffreyvanwyk) `#D2195` fb826ab6 +- decode: exclude `/etc/inputrc` in SUSE as well as in openSUSE (reported by Anyborr) `#D2220` 63be48df +- mandb: support man page format of `rg` (requested by pallaswept) `#D2225` 063bf66b +- mandb: restore ASCII hyphens from Unicode hyphens before analysis (reported by pallaswept) `#D2230` f160b8f0 +- main: work around the issue WSL clears `/tmp` after Bash starts (reported by LeonardoMor) `#D2235` fcbf1ed0 +- decode(`ble/builtin/bind`): support single quotes in the macro/command strings `#D2236` 2f90120e +- mandb: process less formatting sequences in parsing `--help` `#D2244` 60d36ba5 +- mandb: hook into bash-completion's `_comp_command_offset` `#D2255` cbcce625 +- canvas: update tables for Unicode 16.0.0 `#D2283` 5b43ca3f 25a10a6f +- complete: work around `mawk <= 1.3.4-20230525` type-inference bug (reported by KaKi87) `#D2295` 546499b5 +- main: work around macOS sed (reported by Mossop) `#D2298` a16aa594 +- main: delay attaching in kitty, Ghostty, and VS Code Terminal `#D2215` 430a1746 + - main: update workaround for Ghostty (reported by odili) `#D2322` 4338bbf7 +- edit: adjust cursor position after `bind -x` in vi_nmap (requested by miltieIV2) `#D2317` 36ab934f +- progcomp: update workaround for the dnf completion (reported by msr8) `#D2321` 2a0c6ba6 +- global: check `LC_COLLATE=C` for range expressions `#D2326` f507a1bc +- decode: fix unrecoginized ESC O A in `4.0 <= bash < 5.0` `#D2333` 6f4d0401 +- decode: verify cache consistency by embedded hash (reported by teutat3s, bigbruno, giggio, erfan-star-1999) `#D2345` e63f6f67 +- history: work around readonly `HISTSIZE` (reported by seefood) `#D2346` 2d55928a +- main: workaround coreutils `stty` in macOS (reported by EmilyGraceSeville7cf, sshresthaEG, syuraj, seefood, arc279) `#D2348` cdda9f9b +- main (`ble/bin#freeze-utility-path`): use `command` to call the command `#D2349` df6a4dad + - main: fix the list of missing POSIX utilities in the error message (reported by LecrisUT) `#D2372` 5de739ef +- util (`ble/array#fill-range`): work around bash-5.2 array bug for wrong syntax highlighting `#D2352` 8bea90d1 + - complete: fix stray `}` after the completion prefix (fixup 8bea90d1) (reported by cmndrsp0ck) `#D2359` c6bcb824 +- util (`ble/util/load-standard-builtins`): extend search paths `#D2357` 044c016a +- canvas: avoid using DL at the top to clear lines (requeted by u/JustABro_2321 aka AB-boi) `#D2358` f6a3a116 +- edit: fix bash-3.2 problems of receiving C-d through `SIGUSR1` `#D2365` 38767afe +- main: update messages for broken locale and environment `#D2370` ea1e547b +- decode (`ble/builtin/bind`): suppress `builtin bind -x` with more-than-2-byte keyseq `#D2378` 41ee9aaa +- decode (`ble/builtin/bind`): treat the last `\e` as an isolated ESC (reported by sharpchen) `#D2385` xxxxxxxx + +## Contrib + +- histdb + - fix(histdb): show error message only when bgproc crashed `#D2036` 887d92dd + - util: add `ble/util/{time,timeval,mktime}` `#D2133` 34a886fe + - histdb: suppress outputs from `PRAGMA quick_check;` `#D2147` 6154d71c + - histdb: fix variable leak of `ret` `#D2152` 98a2ae15 + - util: fix `ble/util/time` in `bash < 4.2` `#D2161` 623dba91 + - histdb: support subcommands `#D2167` 4d7dd1ee + - histdb: support `top`, `stats`, `calendar`, and `week` `#D2167` 4d7dd1ee + - histdb: unify the color palette selection `#D2167` 4d7dd1ee + - histdb: fix the seasonal default palette names `#D2289` 4fee44e6 + - histdb: fix the error with missing current working directory `#D2323` 98985f38 +- contrib/fzf-git: update to be consistent with the upstream (motivated by arnoldmashava) `#D2054` c78e5c9f +- contrib/layer/pattern: add `{pattern}` layer `#D2074` 449d92ca +- contrib/fzf-git: fix unsupported command modes (reported by dgudim) `#D2083` ba2b8865 +- contrib/bash-preexec: support the latest version of `bash-preexec` (reported by mcarans) `#D2128` 50af4d9c +- contrib/config/execmark: output error status through `ble/canvas/trace` `#D2136` 64cdcd01 +- contrib/airline: remove dummy faces (reported by alexalekseyenko) `#D2204` 59787ee5 +- contrib/airline: update themes `#D2204` 59787ee5 +- contrib/fzf-git: fix unadjusted terminal states in calling `fzf` (reported by tessus) `#D2237` b154058a +- contrib/bash-preexec: support `__bp_set_ret_value` (requested by Comnenus) `#D2238` b154058a +- contrib/colorglass: fix fixed-point round `#D2239` b154058a +- contrib: add `config/github48{1,3}` for elapsed-mark examples (motivated by paulzzy, TheFantasticWarrior) `#D2249` 67548656 ed5d451b +- contrib: add `integration/fzf-menu` (motivated by pallaswept) `#D2251` ad6f58b7 `#D2259` 5b9d9ab3 +- contrib/integration/fzf-completion: add `ble/widget/fzf-complete` (motivated by 3ximus) `#D2252` ad6f58b7 +- contrib/colorglass: color: import themes from `Gogh-Co/Gogh` (motivated by d4rkb4sh8) `#D2274` d2eb75b5 +- contrib/integration/fzf-completion: suppress unexpected quoting by compgen in dynamic completions (reported by mcepl) `#D2284` 32f290df +- contrib/integration/fzf-initialize: use `fzf --bash` when shell integration files are not found (motivated by louiss0) `#D2285` 32f290df + - integration/fzf-initialize: (reported by 3ximus) `#D2285` a36d13ce +- config: add `github499-append-to-last-modified` (motivated by vaab) `#D2286` 32f290df +- integration: add `skim` integration for completion (reported by cmm) `#D2287` a36d13ce +- integration/zoxide: fix the problem of unquoted filenames (reported by tessus) `#D2216` 430a1746 +- integration/{bash,fzf,skim}-completion: adjust dynamically loaded completion functions (motivated by tessus) `#D2327` 788dfd15 +- integration/fzf: suppress dynamic binding `#D2350` e9d5ca26 +- integration/bash-completion (`_comp_command_offset`): perform fallback completion based on the given context (motivated by Jai-JAP) `#D2377` 2ef5e483 +- contrib: add `readline` (motivated by thoughtsunificator) `#D2379` a985559a + +## Documentation + +- docs(CONTRIBUTING): add styleguide (motivated by bkerin) `#D2056` 44cf6756 +- docs(README): fix dead links to blerc.template (fixed by weskeiser) e0f3ac28 +- github: add FUNDING `#D2080` 3f133936 +- blerc: describe keybinding to accept autosuggestion by TAB (motivated by TehFunkWagnalls) `#D2090` cd069860 +- docs: apply Grammarly and fix typos `#D2099` 8b3f6f8c +- docs(README): add sabbrev example for named directories `#D2115` a9a21a0e +- docs(README): note `bleopt prompt_command_changes_layout=1` `#D2196` 208eaa9d +- docs(README): move disclaimers to a later section `#D2250` ad6f58b7 +- README: use `[[ ! ${BLE_VERSION-} ]] || ble-attach` `#D2264` ed11901a +- github: update GitHub issue templates `#D2294` aa396f60 +- memo: fix syntax error in the testing code for #D1779 (reported by andychu) `#D2329` 8c387422 +- github: fix URLs in the nightly description (reported by TheFozid) `#D2373` 97c6caea +- history: include `HISTFILE` in the invalid timestamp mesasge (motivated by Strykar) `#D2374` 5c088fe7 +- README: clarify small things `#D2379` a985559a + - workflows: show date on the nightly page + - README: clarify fzf compat issues + - README: link the sabbrev section in Manual + - README: clarify that blerc.template is prepared for the same version + +## Test + +- test(bash): fix condition for bash bug of history expansion `#D2071` aacf1462 +- test(main): fix delimiter of `MSYS` in adding `winsymlinks` `#D2071` aacf1462 +- test(util,vi): adjust `ble/util/is-stdin-ready` while testing `#D2105` 23a05827 6f4badf4 +- test(vi): suppress warnings for non-interactive sessions `#D2113` b8b7ba0c +- test(bash,util): fix tests in interactive session `#D2123` 06ad3a6c +- test(vi): fix broken states after test `#D2123` 06ad3a6c +- test(bash): fix test cases for history expansion `#D2131` 838b4652 +- test(bash): add tests for bash array bugs `#D2149` 6154d71c +- github/workflows: update versions of GitHub Actions `#D2186` 0c42c8bd 433ac7c2 +- test: skip tests on `ble/test/chdir` failure `#D2234` 467ec48b + +## Internal changes + +- refactor: move files `{keymap/ => lib/keymap.}*` f4c973b8 +- global: fix coding style `#D2072` bdcecbbf +- memo: add recent configs and create directories `#D2073` 99cb5e81 +- highlight: generalize `region` layer `#D2074` 449d92ca +- keymap/vi: integrate vi tests into the test framework `#D2101` d16b8438 +- global(leakvar): fix variable leak `#D2114` d3e1232d +- make(scan): apply builtin checks to `contrib` `#D2135` 2f16d985 + - contrib/fzf-git: do not use `ble/util/print` in a script mode (reported by dgudim) `#D2166` 8f0dfe9b +- decode: change Isolated ESC to U+07FC `#D2138` 82bfa665 +- edit: introduce `selection` keymap for more flexible shift selection `#D2139` 2cac11ad + - edit: fix a regression that delete-selection does not work (reported by cmndrsp0ck) `#D2151` 98a2ae15 +- util: support `bleopt connect_tty` `#D2140` f940696f + - util: support `ble/fd#add-cloexec` and add `O_CLOEXEC` by default `#D2158` 785267e1 + - util: fix error of bad file descriptors (reported by ragnarov) `#D2159` 785267e1 + - util: work around macOS/FreeBSD failure on `exec 32>&2` (reported by tessus, jon-hotaisle) `#D2165` 8f0dfe9b + - main: record external file descriptors on `ble-attach` `#D2183` a508a827 + - util: check leftovers of CLOEXEC fds more strictly `#D2215` 79fe2483 +- main: fix unprocessed `-PGID` in `*.pid` for cleanup `#D2143` a5da23c0 +- history: prevent `SIGPIPE` from reverting the TTY state in trap `EXIT` `#D2153` 4b8a0799 + - history: fix initially shifted history index `#D2180` e425dc56 +- edit: support `bleopt internal_exec_int_trace` (motivated by tessus) `#D2171` cebea478 3801a87e +- global: avoid using the builtin `:` `#D2192` f2fd2955 +- global: pass `--` to `type` and `declare` before arbitrary arguments `#D2194` 5c0efcf6 +- global: fix spelling mistakes `#D2201` 86815f61 +- util (`ble/util/buffer.flush`): write to the TUI stderr `#D2218` b5c88947 +- util (`ble/util/buffer.flush`): use DECSET(2026) in terminals with the support `#D2226` c3df08be +- main: refactor initialization sequence `#D2231` cc9d7f39 +- util (`ble/util/is-stdin-ready`): check `$_ble_util_fd_tui_stdin` by default `#D2254` 29c00fd8 + - util (`ble/util/is-stdin-ready`): work around polling issue in Windows Terminal `#D2362` 622cb247 + - util (`ble/util/is-stdin-ready`): fix the condition to use stdin (reported by Jai-JAP, darukutsu) `#D2375` 38fe52b3 +- decode (`ble-decode-key/bind`): reference the argument to check the widget name (contributed by musou1500) `#D2279` 21b1bb3d +- global: normalize quoting of function names of the form `prefix:$name` `#D2296` 3d7c98bb +- global: use `[:blank:]` instead of `[:space:]` `#D2299` e2fd8f0f +- global: rename `ret` not used as `REPLY` `#D2300` 86cbf78e +- global: avoid raw word splitting `#D2309` b55c4003 +- global: use `ble/util/assign` in more places `#D2312` b0e39732 +- main: show details of the loading time (motivated by tessus, Darukutsu) `#D2313` 3d8f6264 +- canvas: optimize binary search in tables `#D2325` d56c7d2f d4c812b7 +- util: optimize `ble/fd#list` using `compgen -G` `#D2328` 6f34012d + - util (`ble/fd#list`): fix a bug that `BASHPID` undefined in `bash < 4.3` is used (fixup 6f34012d) `#D2352` 8bea90d1 + - util (`ble/fd#list`): fix `ble/fd#list` generating an internal fd and breaking `ble/fd#add-cloexec` (reported by xlei77) `#D2356` 02ca0006 +- bind: clean up old codes to bind to ESC `#D2334` 514d177e c9cd95c4 +- decode: move key definitions into `lib/init-cmap.sh` `#D2341` fbdda841 +- complete: rename key `{auto_complete => ac}_enter` `#D2342` a30125c4 +- color: change color representation for faithful 24-bit black (reported by seefood) `#D2351` 9ea84456 +- global: reduce the uses of `:`, `true`, and `false` `#D2353` 61a46734 +- global: use `ble/opts#extract-last-optarg` `#D2363` 1cfd6c0a +- global: use `source -- path` to source an arbitrary path `#D2366` 3d2e230a +- main: describe `--lib` in the output of `ble.sh --help` `#D2367` 9699ff6a + + +# ble-0.4.0-devel3 + +2020-12-02...2023-04-03 (`#D1427`...`#D2030`) 276baf2...1a5c451c + +## New features + +- decode (`ble-decode-kbd`): support various specifications of key sequences `#D1439` 0f01cab +- edit: support new options `bleopt edit_line_type={logical,graphical}` (motivated by 3ximus) `#D1442` 40ae242 +- complete: support new options `bleopt complete_limit{,_auto}` (contributed by timjrd) `#D1445` b13f114 5504bbc + - complete: update the default value of `bleopt complete_limit{,auto}` `#D1500` aae553c + - complete: inject user interruption and complete limits into `bash-completion` through `read` (motivated by timjrd) `#D1504` 856cec2 `#D1507` 4fc51ae +- edit (kill/copy): combine multiple kills and copies (suggested by 3ximus) `#D1443` 66564e1 + - edit (`{kill,copy}-region-or`): fix unconditionally combined kills/copies (reported by 3ximus) `#D1447` 1631751 +- canvas: update emoji database and support `bleopt emoji_version` (motivated by endorfina) `#D1454` d1f8c27 + - emoji: unify emoji tables of different versions `#D1671` af82662 +- canvas, edit: support `bleopt info_display` (suggested by 0neGuyDev) `#D1458` 69228fa + - canvas (panel): always call `panel::render` to update height `#D1472` 51d2c05 + - util (visible-bell): work around coordinate mismatches in subshells `#D1495` 01cfb10 + - canvas: work around kitty's quirk not recognizing DECSTBM (CSI ; r) `#D1503` eca2976 +- prompt: support `bleopt prompt_status_{line,align}` and `face prompt_status_line` `#D1462` cca1cbc + - prompt: fix missing height allocation for status line `#D1487` b424fa5 + - prompt: support `bleopt prompt_status_align=justify` `#D1494` c30a0db +- syntax: properly support case patterns `#D1474` `#D1475` `#D1476` 64b55b7 +- keymap/vi: add `ble/keymap:vi/script/get-mode` for user-defined mode strings `#D1488` f25a6e8 462918d +- prompt: support multiline `prompt_rps1` `#D1502` 4fa139a + - canvas: fix wrong coordinate calculation on linefolding (reported by telometto) `#D1602` 9badb5f + - prompt: fix coordinates after `prompt_rps1` `#D1972` e128801 + - prompt: clear remaining SGR after `prompt_rps1` (reported by linwaytin) `#D2003` ea99d944 +- syntax: support tilde expansions in parameter expansions `#D1513` 0506df2 +- decode: support `ble-bind -m KEYMAP --cursor DECSCUSR` (motivated by jmederosalvarado) `#D1514` `#D1515` `#D1516` 79d671d + - decode: reflect changes after `ble-bind --cursor` `#D1873` 39efcf9 +- edit: support `nsearch` options (motivated by Alyetama, rashil2000, carv-silva) `#D1517` 9125795 + - edit: support `nsearch` opts `empty=emulate-readline` (motivated by jainpratik163) `#D1661` d68ba61 + - edit: support bash-5.2 binding of `prior/next` to `history-search-{for,back}ward` `#D1661` d26a6e1 +- syntax: support the deprecated redirection `>& file` `#D1539` b9b0de4 +- complete: complete file descriptors and heredoc words after redirections `#D1539` b9b0de4 +- main: support `blehook ATTACH DETACH`, `BLE_ONLOAD`, `BLE_ATTACHED` `#D1543` 750ca38 +- main: support `ble` `#D1544` 750ca38 +- main (`ble-update`): support package updates and `sudo` updates (motivated by huresche, oc1024) `#D1548` 0bc2660 + - main (`ble-update`): fix help message (contributed by NoahGorny) 50288bf +- syntax: support undocumented `${a~}` and `${a~~}` `#D1561` 4df29a6 +- lib: support `lib/vim-airline` (motivated by huresche) `#D1565` da1d0ff + - util (`ble/gdict`): refactor `#D1569` 7732eed + - vim-airline: support `bleopt vim_airline_theme` `#D1589` 73b037f + - prompt: track dependencies and detect changes `#D1590` `#D1591` cf8d949 + - prompt: preserve `LINES` and `COLUMNS` for custom sequences `#D1592` 040016d + - color: fix the face initialiation order for uses in prompts (motivated by jmederosalvarado) `#D1593` 321371f + - prompt (`contrib/prompt-git`): support dirty checking `#D1601` b2713d9 + - prompt (`contrib/prompt-git`): do not use `ble/util/idle` in Bash 3 `#D1606` 959cf27 + - util (`bleopt`): add new option `-I` to reinitialize user settings on reload `#D1607` 959cf27 + - vi (vi_cmap): fix wrong prompt calculations by the outdated initial values `#D1653` 2710b23 + - vim-airline: measure separator widths and fix layout of status line `#D1999` 1ce0d1ad 478c9a10 +- util, color: refactor configuration interfaces (`bleopt`, `blehook`, `ble-face`) `#D1568` c94d292 + - color: support new face setting function `ble-face` + - util (`bleopt`): support option `-r` and `-u` and wildcards in option names + - util (`blehook`): hide internal hooks by default and support option `-a` + - util, color: fix argument analysis of `bleopt`, `blehook`, and `ble-face` (fixup c94d292) `#D1571` bb53271 + - util (`blehook`): show explicitly specified internal hooks `#D1594` f4312df + - util (`bleopt`): do no select obsoleted options by wildcards `#D1595` f4312df + - util (`bleopt`): fix error messages for unknown options `#D1610` 66df3e2 + - util (`bleopt`, `bind`): fix error message and exit status, respectively `#D1640` b663cee + - util (`blehook`): support wildcards `#D1861` 480b7b3 +- progcomp: support quoted commands and better `progcomp_alias` `#D1581` `#D1583` dbe87c3 + - progcomp: fix a bug that command names may stray into completer function names `#D1611` 1f2d45f +- syntax: highlight quotes of the `\?` form `#D1584` 5076a03 + - syntax: recognize escape \" in double-quoted strings `#D1641` 4b71449 +- prompt: support a new backslash sequence `\g{...}` `#D1609` be31391 + - prompt: accept more general `[TYPE:]SPEC` in `\g{...}` like `ble-face` `#D1963` 81b3b0e + - prompt: fix non-working 24-bit color in `\g{...}` `#D1977` 881ec25 +- complete: add a new option `bleopt complete_limit_auto_menu` `#D1618` 1829d80 +- canvas: support grapheme clusters (motivated by huresche) `#D1619` c0d997b + - canvas (`ble/util/c2w`): use `EastAsianWidth` and `GeneralCategory` to mimic `wcwidth` `#D1645` 9a132b7 + - canvas (c2w:auto): work around combining chars applied to the previous line `#D1649` 1cbbecb + - canvas (c2w:auto): avoid duplicate requests `#D1649` 1cbbecb a3047f56 + - canvas (c2w:auto): send DSR(6) in the internal state `#D1664` a3047f5 + - canvas (c2w): support `bleopt char_width_mode=musl` `#D1668` 05b258f `#D1672` af82662 + - canvas (c2w:auto): detect `emacs` and `musl` `#D1668` 05b258f +- rlfunc: support vi word operations in `emacs` keymap (requested by SolarAquarion) `#D1624` 21d636a +- edit: support `TMOUT` for the session timeout `#D1631` 0e16dbd +- edit: support bash-5.2 `READLINE_ARGUMENT` `#D1638` d347fb3 +- complete: support `complete [-DI]` in old versions of Bash through `_DefaultCmD_` and `_InitialWorD_` `#D1639` 925b2cd +- rlfunc: support nsearch widgets in `vi_nmap` keymap (requested by cornfeedhobo) `#D1651` 9a7c8b1 +- prompt: support `bleopt prompt_ruler` (motivated by Barbarossa93) `#D1666` 05cf638 + - prompt: fix hanging by a zero-width `prompt_ruler` `#D1673` 9033f29 +- edit: support `bleopt canvas_winch_action` (requested by Johann-Goncalves-Pereira, guptapriyanshu7) `#D1679` 2243e91 + - blerc: fix the name of the option `bleopt canvas_winch_action` (reported by Knusper) b1be640 + - edit: go back to the previous lines with `redraw-here` more aggressively `#D1966` a125187 +- menu (menu-style:desc): improve descriptions (motivated by Shahabaz-Bagwan) `#D1685` 4de1b45 +- menu (menu-style:desc): support multicolumns (motivated by Shahabaz-Bagwan) `#D1686` 231dc39 + - menu (menu-style:desc): fix not working `bleopt menu_desc_multicolumn_width=` `#D1727` 2140d1e +- term: let DECSCUSR pass through terminal multiplexers (motivated by cmplstofB) `#D1697` a3349e4 + - util: refactor `_ble_term_TERM` `#D1746` 63fba6b +- complete: requote for more compact representations on full completions `#D1700` a1859b6 + - complete (requote): requote from optarg/rhs starting point `#D1786` 93c2786 +- complete: improve support for `declare` and `[[ ... ]]` `#D1701` da38404 + - syntax: fix completion and highlighting of `declare` with assignment arguments `#D1704` `#D1705` e12bae4 + - cmdspec: refactor `{mandb => cmdspec}_opts` `#D1706` `#D1707` 0786e92 +- complete (menu-style:align): refactor `complete_menu_align => menu_align_{min,max}` (motivated by banoris) `#D1717` 22a2449 +- prompt: support `bleopt prompt_command_changes_layout` `#D1750` e199bee +- exec: measure execution times `#D1756` 2b28bec + - edit: work around a bash-4.4..5.1 bug of `exit` outputting time to stderr of exit context `#D1765` 3de751e e61dbaa + - edit (`exec_elapsed_mark`): show hours and days `#D1793` 699dabb +- util: preserve original traps and restore them on unload `#D1775` `#D1776` `#D1777` 398e404 + - util (trap): fix a bug of restoring original traps `#D1850` 8d918b6 +- progcomp: support `compopt -o ble/no-default` to suppress default completions `#D1789` 7b70a0e +- sabbrev: support options `-r` and `--reset` to remove entries `#D1790` 29b8be3 +- util (blehook): support `hook!=handler` and `hook+-=handler` `#D1791` 0b8c097 +- prompt: escape control characters in `\w` and `\W` `#D1798` 8940434 a9551e5 + - prompt: fix wrongly escaped UTF-8 chars in `\w` and `\W` `#D1806` d340233 + - prompt: fix a bug that `\u` is expanded to the shell name `#D1975` fe339c3 +- emacs: support `bleopt keymap_emacs_mode_string_multiline` (motivated by ArianaAsl) `#D1818` 8e9d273 +- util: synchronize rlvars with `bleopt complete_{menu_color{,_match},skip_matched} term_bracketed_paste_mode` (motivated by ArianaAsl) `#D1819` 6d20f51 + - util: suppress false warnings of `bind` inside non-interactive shells (reported by wukuan405) `#D1823` 1e19a67 +- history: support `bleopt history_erasedups_limit` (motivated by SuperSandro2000) `#D1822` e4afb5a 3110967 +- prompt: support `bleopt prompt_{emacs,vi}_mode_indicator` (motivated by ferdinandyb) `#D1843` 2b905f8 +- util (`ble-import`): support option `-q` `#D1859` 1ca87a9 +- history: support extension `HISTCONTROL=strip` (motivated by aiotter) `#D1874` 021e033 +- benchmark (ble-measure): support an option `-V` `#D1881` 571ecec +- color: allow setting color filter by `_ble_color_color2sgr_filter` `#D1902` 88e74cc +- auto-complete: add `bleopt complete_auto_complete_opts` (motivated by DUOLabs333) `#D1901` `#D1911` 1478a04 6a21ebb +- menu-complete: add `bleopt complete_menu_complete_opts` (requested by DUOLabs333) `#D1911` 6a21ebb +- edit (`magic-space`): support `bleopt edit_magic_expand=...:alias` (requested by telometto) `#D1912` 63da2ac + - auto-complete: cancel auto-complete for `magic-space` `#D1913` 01b4f67 +- complete: support ambiguous completion for command paths `#D1922` 8a716ad +- complete: preserve original path segments as long as possible `#D1923` `#D1924` e3cdb9d +- main: support `BLE_SESSION_ID` and `BLE_COMMAND_ID` `#D1925` 44d9e10 `#D1947` 46ac426 `#D1954` 651c70c +- main: support an option `--inputrc={diff,all,user,none}` `#D1926` 92f2006 +- util (`ble/builtin/trap`): support Bash 5.2 `trap -P` `#D1937` 826a275 +- syntax: highlight `\?` in here documents `#D1959` e619e73 +- syntax: recognize history expansion in here documents, `"...!"` (bash <= 4.2), and `$!` (bash <= 4.1) `#D1959` e619e73 +- syntax: support context after `((...))` and `[[ ... ]]` in bash-5.2 `#D1962` 67cb967 +- edit: support the readline variable `search-ignore-case` of bash-5.3 `#D1976` e3ad110 +- menu-complete: add `insert_unique` option to the `complete` widget `#D1995` 36efbb7 +- syntax: check alias expansions of `coproc` variable names `#D1996` 92ce433 +- syntax: support new parameter transformation `"${arr@k}"` `#D1998` 1dd7e385 +- edit: support a user command `ble append-line` (requested by mozirilla213) `#D2001` 2a524f34 +- decode: accept isolated ESC \ (requested by mozirilla213) `#D2004` d7210494 +- sabbrev: add widget `magic-slash` to approximate Zsh named directories (motivated by mozirilla213) `#D2008` e6b9581c +- sabbrev: support inline and linewise sabbre with `ble-sabbrev -il` `#D2012` 56208534 +- complete: add `bleopt complete_source_sabbrev_{opts,ignore}` (motivated by mozirilla213) `#D2013` f95eb0cc `#D2016` 45c76746 +- util.bgproc: separate `ble/util/bgproc` from `histdb` (motivated by bkerin) `#D2017` 7803305f + - util.bgproc: fix use of `ble/util/idle` in bash-3 `#D2026` 79a6bd41 + - util.bgproc: increase frequency of bgproc termination check (motivated by bkerin) `#D2027` 8d623c19 + - util.bgproc: fix an `fd#alloc` failure in bash-4.2 `#D2029` 7c4ff7bc +- menu-complete: support selection by index (requested by bkerin) `#D2023` b91b8bc8 + +## Changes + +- syntax: exclude \\ + LF at the word beginning from words (motivated by cmplstofB) `#D1431` 67e62d6 +- complete: do not quote `:` and `=` in non-filename completions generated by progcomp (reported by 3ximus) `#D1434` d82535e +- edit: preserve the state of `READLINE_{LINE,POINT,MARK}` `#D1437` 8379d4a +- edit: change default behavior of C-w and M-w to operate on backward words `#D1448` 47a3301 +- prompt: rename `bleopt prompt_{status_line => term_status}` `#D1462` cca1cbc +- edit (`ble/builtin/read`): cancel by C-d on an empty line `#D1473` ecb8888 +- syntax: change syntax context after `time ;` and `! ;` for Bash 4.4 `#D1477` 4628370 +- decode (rlfunc): update mapping `vi-replace` in `imap` and `vi-editing-mode` in `nmap` (reported by onelittlehope) `#D1484` f2ca811 +- prompt: invalidate prompt and textarea on prompt setting changes `#D1492` 1f55913 +- README: update informations on stable versions `#D1509` c8e658e +- README: update the description of how to uninstall `#D1510` c8e658e +- util (`bleopt`): validate initial user settings `#D1511` 82c5ece + - util (`bleopt`): fix a bug that old values are double-expanded on init (fixup 82c5ece) `#D1521` f795c07 + - util (`bleopt`): do not validate obsoleted initial settings `#D1527` 032f6b2 +- main: preserve user-space overridden builtins `#D1519` 0860be0 + - util (`ble/util/type`): fix a bug that aliases are not properly highlighted (reported by 3ximus) `#D1526` 45b30a7 + - main: preserve user's `expand_aliases` and allow aliases in internal space (fixup 0860be0) `#D1574` afc4112 + - main: main: fix expand_aliases unset on ble-reload (fixup afc4112) `#D1577` 3417388 +- main: accept non-regular files as `blerc` and add option `--norc` `#D1530` 7244e2f +- prompt: let `stderr` pass through to tty in evaluating `PS0` (reported by tycho-kirchner) `#D1541` 24a88ce +- prompt: adjust behavior of `LINENO` and prompt sequence `\#` (reported by tycho-kirchner) `#D1542` 8b0257e + - prompt: update `PS0` between multiple commands (motivated by tycho-kirchner) `#D1560` 8f29203 +- edit (`widget:display-shell-version`): include `ble.sh` version `#D1545` 750ca38 + - edit (`display-shell-version`): detect configurations and print details `#D1781` 5015cb56 + - edit (`display-shell-version`): show information of the OS distribution and properly handle saved locales `#D1854` 066ec63 bdb7dd6 + - edit (`display-shell-version`): show `gawk`, `make`, and `git` versions of the build time `#D1892` e618133 + - edit (`display-shell-version`): support running as a user command (reported by DhruvaG2000) `#D1893` e618133 + - edit (`display-shell-version`): show warnings for fzf-integration `#D1907` 3bc3bea + - edit (`display-shell-version`): show the `zoxide` version `#D1907` 3bc3bea +- complete (`ble-sabbrev`): support colored output `#D1546` 750ca38 +- decode (`ble-bind`): support colored output `#D1547` 750ca38 + - decode (`ble-bind`): output bindings of the specified keymaps with `ble-bind -m KEYMAP` (fixup 750ca38) `#D1559` 6e0245a +- keymap/vi: update mode names on change of `bleopt keymap_vi_mode_name_*` (motivated by huresche) `#D1565` 11ac106 +- main: show notifications against debug versions of Bash `#D1612` 8f974aa +- term: terminal identification + - term (`_ble_term_TERM`): update `vte` identification `#D1620` 00e74d8 + - term (`_ble_term_TERM`): detect wezterm-20220408 `#D1909` 486564a + - term (`_ble_term_TERM`): detect konsole `#D1988` 600e845 ed53858 +- edit: suppress only `stderr` with `internal_suppress_bash_output` (motivated by rashil2000) `#D1646` a30887f +- prompt: do not evaluate `PROMPT_COMMAND` for subprompts `#D1654` 08e903e +- Makefile: work around the case the repository is cloned without `--recursive` `#D1655` 22ace5f +- repo: add subdirectories `make` and `docs` `#D1657` 75bd04c +- util: time out CPR requests `#D1669` 1481d48 + - util (CPR): fix the problem of always timing out (fixup 1481d48) `#D1792` 9b331c4 +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 0525528 88e2df5 +- mandb: integrate `mandb` with `bash-completion` (motivated by Shahabaz-Bagwan, bbyfacekiller and EmilySeville7cfg) `#D1688` c1cd666 +- syntax: do not start argument completions immediately after previous word (reported by EmilySeville7cfg) `#D1690` 371a5a4 + - syntax: revert 371a5a4 and generate empty completion source on syntax error `#D1609` e09fcab +- syntax: strictly check variable names of `for`-statements `#D1692` d056547 +- widget `self-insert`: untranslate control chars and insert the last character `#D1696` 5ff3021 +- complete (`source:command`): exclude inactive aliases `#D1715` d6242a7 +- complete (`source:command`): not quote aliases and keywords `#D1715` d6242a7 +- highlight (`wtype=CTX_CMDI`): check alias names before shell expansions `#D1715` d6242a7 + - util (`ble/is-alias`): fix a bug of unredirected error messages for bash-3.2 (fixup d6242a7) `#D1730` 31372cb +- edit (`history_share`): update history on `discard-line` (reported by SuperSandro2000) `#D1742` 8dbefe0 +- canvas: do not insert explicit newlines on line folding if possible (reported by banoris) `#D1745` 02b9da6 dc3827b + - edit: fix layout with `prompt_rps1` caused by missing `opts=relative` for `ble/textmap#update` `#D1769` f6af802 +- edit (`ble-bind -x`): preserve multiline prompts on execution of `bind -x` commands (requested by SuperSandro2000) `#D1755` 7d05a28 +- util (`ble/util/buffer`): hide cursor in rendering `#D1758` e332dc5 +- complete (`action:file`): always suffix `/` to complete symlinked directory names (reported by SuperSandro2000) `#D1759` 397ac1f +- edit (command-help): show source files for functions `#D1779` 7683ab9 +- edit (`ble/builtin/exit`): defer exit in trap handlers (motivated by SuperSandro2000) `#D1782` f62fc04 6fdabf3 + - util (`blehook`): fix a bug that the the hook arguments are lost (reported by SuperSandro2000) `#D1804` 479795d + - edit: fix a bug of `ble/builtin/exit` inside subshells in the `EXIT` trap `#D1973` 0451521 +- complete (`source:command/get-desc`): show function location and body `#D1788` 496e798 +- edit (`ble-detach`): prepend a space to `stty sane` for `HISTIGNORE=' *'` `#D1796` 26b532e +- decode (`bind`): do not treat non-beginning `#` as comments `#D1820` 65c4138 +- history: disable the history file when `HISTFILE` is empty `#D1836` 9549e83 +- complete: generate options by empty-word copmletion after filenames (reported by geekscrapy) `#D1846` 6954b13 + - complete: do not show option descriptions for the empty-word completion (requested by geekscrapy) `#D1846` 1c7f7a1 +- syntax (`extract-command`): extract unexpected command names as commands `#D1848` 5b63459 +- main (`ble-reload`): preserve the original initialization options `#D1852` d8c92cc + - main (`ble-reload`): fix a bug that the default rcfile is not loaded `#D1914` 85b5828 +- blehook: print reusable code to restore the user hooks `#D1857` b763677 + - blehook: separate internal and user hooks `#D1856` b763677 + - blehook: prefer the uniq `!=` to the addition `+=` `#D1871` fe7abd4 + - blehook: print hooks with `--color=auto` by default `#D1875` 3953afe +- util (`ble/builtin/trap`): refactor + - trap,blehook: rename `ERR{ => EXEC}` and separate from the `ERR` trap `#D1858` 94d1371 + - trap: remove the support for the shell function `TRAPERR` `#D1858` 94d1371 + - trap: preserve `BASH_COMMAND` in trap handlers `#D1858` 94d1371 + - util (`ble/builtin/trap`): run EXIT trap in subshells `#D1862` 5b351e8 + - util (`ble/builtin/trap`): fix the RETURN trap `#D1863` 793dfad + - trap,blehook: move to a new file `util.hook.sh` `#D1864` 55a182b + - trap (`trap -p`): fix unprinted existing user traps `#D1864` 55a182b + - trap (`ble/builtin/trap/finalize`): fix a failure of restoring the original trap `#D1864` 55a182b + - trap (`trap -p`): print also custom traps `#D1864` 55a182b + - trap: preserve positional parameters for user trap handlers `#D1865` 9e2963c + - trap: suppress `INT` processing with user traps `#D1866` 5c28387 + - trap: unify handling of `DEBUG` and the other traps `#D1867` a22c25b + - trap: work around possible interferences by recursive traps `#D1867` a22c25b + - trap: ignore `RETURN` for `ble/builtin/trap/.handler` `#D1867` a22c25b + - trap: fix a bug that `DEBUG` for internal commands clears `$?` `#D1867` a22c25b + - trap: use `ble/util/assign/.mktmp` to read the `DEBUG` trap `#D1910` 1de9a1e +- progcomp: reproduce arguments of completion functions passed by Bash `#D1872` 4d2dd35 +- prompt: preserve transient prompt with `same-dir` after `clear-screen` `#D1876` 69013d9 +- color: let `bleopt term_index_colors` override the default if specified `#D1878` 7d238c0 +- canvas: update Unicode version 15.0.0 `#D1880` 49e55f4 +- decode (`vi_imap-rlfunc.txt`): update the widget for `backward-kill-word` as `kill-backward-{u => c}word` `#D1896` e19b796 +- color: rearrange color table by `ble palette` (suggested by stackoverflow/caoanan) `#D1961` bb8541d +- util (`ble/util/idle`): process events before idle sleep `#D1980` 559d64b +- keymap/vi (`decompose-meta`): translate S-a to A `#D1988` 600e845 +- sabbrev: apply sabbrev to right-hand sides of variable assignments `#D2006` 41faa494 +- complete (`source:argument`): fallback to rhs completion also for `name+=rhs` `#D2006` 41faa494 +- auto-complete: limit the line length for auto-complete `#D2009` 5bfbd6f2 +- complete (`source:argument`): generate sabbrev completions after normal completions (motivated by mozirilla213) `#D2011` a6f168d0 +- complete (`source:option`): carve out `ble/complete/source:option/generate-for-command` (requested by mozirilla213) `#D2014` 54ace59c + +## Fixes + +- term: fix a bug that VTE based terminals are not recognized `#D1427` 7e16d9d +- complete: fix a problem that candidates are not updated after menu-filter (reported by 3ximus) `#D1428` 98fbc1c +- complete/mandb-related fixes + - mandb: support mandb in FreeBSD `#D1432` 6c54f79 + - mandb: fix BS contamination used by nroff to represent bold (reported by rlnore) `#D1429` b5c875a + - mandb: fix an encoding prpblem of utf8 manuals `#D1446` 7a4a480 + - mandb: improve extraction and cache for each locale `#D1480` 3588158 + - mandb: fix an infinite loop by a leak variable (reported by rlanore, riblo) `#D1550` 0efcb65 + - mandb: work around old groff in macOS (reported by killermoehre) `#D1551` d4f816b + - mandb: use `manpath` and `man -w`, and read `/etc/man_db.conf` and `~/.manpath` `#D1637` 2365e09 + - mandb: support the formats of the man pages of `awk` and `sed` (reported by bbyfacekiller) `#D1687` 6932018 + - mandb: generate completions of options also for the empty word `#D1689` b90ac78 + - mandb: support the man-page formats of `wget`, `fish`, and `ping` (reported by bbyfacekiller) `#D1687` a79280e + - mandb: carry optarg for e.g. `-a, --accept=LIST` `#D1687` 23d5657 + - mandb: parse `--help` for specified commands `#D1693` e1ad2f1 + - mandb: fix small issues of man-page analysis `#D1708` caa77bc + - mandb: insert a comma in brace expansions instead of a space `#D1719` 0ac7f03 + - mandb: support man-page format of `rsync` `#D1733` 7900144 + - mandb: fix a bug that the description is inserted for `--no-OPTION` `#D1761` 88614b8 + - mandb: fix a bug that the man page is not correctly searched (fixup 2365e09) `#D1794` 65ffe70 + - mandb: support the man-page formats of `man ls` in coreutils/Japanese and in macOS `#D1847` fa32829 + - mandb: include short name in the longname description `#D1879` 60b6989 +- edit: work around the wrong job information of Bash in trap handlers (reported by 3ximus) `#D1435` `#D1436` bc4735e +- edit (command-help): work around the Bash bug that tempenv vanishes with `builtin eval` `#D1438` 8379d4a +- global: suppress missing locale errors (reported by 3ximus) `#D1440` 4d3c595 +- edit (sword): fix definition of `sword` (shell words) `#D1441` f923388 +- edit (`kill-forward-logical-line`): fix a bug not deleting newline at the end of the line `#D1443` 09cf7f1 +- util (`ble/util/msleep`): fix hang in Cygwin by swithing from `/dev/udp/0.0.0.0/80` to `/dev/zero` `#D1452` d4d718a + - util (`ble/util/msleep`): work around the bash-4.3 bug of `read -t` (reported by 3ximus) `#D1468` `#D1469` 4ca9b2e +- syntax: fix broken AST with `[[` keyword `#D1454` 69658ef +- benchmark (`ble-measure`): work around a locale-dependent decimal point of `EPOCHREALTIME` (reported by 3ximus) `#D1460` 1aa471b +- global: work around bash-4.2 bug of `declare -gA` (reported by 0xC0ncord) `#D1470` 8856a04 + - global: fix declaration of associative arrays for `ble-reload` (reported by 0xC0ncord) `#D1471` 3cae6e4 + - global: use a better workaround of bash-4.2 `declare -gA` by separating assignment `#D1567` 2408a20 +- bind: work around broken `cmd_xmap` after switching the editing mode `#D1478` 8d354c1 + - decode (`encoding:C`): fix initialization for isolated ESC `#D1839` c3bba5b +- edit: clear graphic rendition on newlines and external commands `#D1479` 18bb2d5 +- decode (rlfunc): work around incomplete bytes in keyseq (reported by onelittlehope) `#D1483` 3559658 beb0383 37363be +- main: fix a bug that unset `IFS` is not correctly restored `#D1489` 808f6f7 + - edit: fix error messages on accessing undo records in emacs mode (reported by rux616) `#D1497` 61a57c0 e9be69e +- canvas: fix a glitch that SGR at the end of command line is applied to new lines `#D1498` 4bdfdbf +- syntax: fix a bug that `eval() { :; }`, `declare() { :; }` are not treated as function definition `#D1529` b429095 +- decode: fix a hang on attach failure by cache corruption `#D1531` 24ea379 +- edit, etc: add workarounds for `localvar_inherit` `#D1532` 7b63c60 + - edit: fix a bug that `command-help` doesn't work `#D1635` 0f6a083 +- progcomp: fix non-working `complete -C prog` (reported by Archehandoro) `#D1535` 026432d +- bind: fix a problem that `bind '"seq":"key"'` causes a loop macro `bind -s key key` (reported by thanosz) `#D1536` ea05fc5 + - bind: fix errors on readline macros (reported by RakibFiha) `#D1537` c257299 +- main: work around sourcing `ble.sh` inside subshells `#D1554` bbc2a90 + - main: fix exit status for `bash ble.sh --test` (fixup bbc2a90) `#D1558` 641238a + - main: fix reloading after ble-update (fixup bbc2a90) (fixed by oc1024) `#D1558` 9372670 +- main: work around `. ble.sh --{test,update,clear-cache}` in intereactive sessions `#D1555` bbc2a90 +- Makefile: create `run` directory instead of `tmp` `#D1557` 9bdb37d +- main: fix the workaround for `set -e` `#D1564` ab2f70b + - main: fix the workaround for `set -u` `#D1575` 76073a9 + - main: fix the workaround for `set -eu` and refactor `#D1743` 6a946f0 + - decode: fix the workaround for `set -e` with `--prompt=attach` `#D1832` 5111323 +- util: work around bash-3.0 bug `"${scal[@]/xxx}"` `#D1570` 24f79da +- sabbrev (`ble-sabbrev`): fix delayed output before the initialization `#D1573` 5d85238 +- history: fix the workaround for bash-3.0 bug of reducing histories `#D1576` 15c9133 +- syntax: fix a bug that argument completion is attempted in nested commands (reported by huresche) `#D1579` 301d40f +- edit (brackated-paste): fix incomplete `CR => LF` conversion (reported by alborotogarcia) `#D1587` 8d6da16 +- main (adjust-bash-options): adjust `LC_COLLATE=C` `#D1588` e87ac21 +- highlight (`layer:region`): fix blocked lower-layer changes without selection changes `#D1596` 5ede3c6 +- complete (`auto-menu`): fix sleep loops by clock/sclock difference `#D1597` 53dd018 +- history: fix a bug that history data is cleared on `history -r` `#D1605` 72c274e +- util (`ble/string#quote-command`): remove redundant trailing spaces for single word command `#D1613` 94556b4 +- util: work around the Bash 3 bug of array assignments with `^A` and `^?` in Bash 3.2 `#D1614` b9f7611 +- benchmark (`ble-measure`): fix a bug that the result is always 0 in Bash 3 and 4 (fixup bbc2a904) `#D1615` a034c91 +- complete: fix a bug that the shopt settings are not restored correctly (reported by Lun4m) `#D1623` 899c114 +- decode, canvas, etc.: explicitly treat CSI arguments as decimal numbers (reported by GorrillaRibs) `#D1625` c6473b7 2ea48d7 +- history: fix the vanishing history entry used for `ble-attach` `#D1629` eb34061 +- global: work around readonly `TMOUT` (reported by farmerbobathan) `#D1630` 44e6ec1 +- complete: fix a task scheduling bug of referencing two different clocks (reported by rashil2000) `#D1636` fea5f5b +- canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 68ee111 +- decode (`cmap/initialize`): fix unquoted special chars in the cmap cache `#D1647` 7434d2d +- decode: fix a bug that the characters input while initialization are delayed `#D1670` 430f449 +- util (`ble/util/readfile`): fix a bug of always exiting with 1 in `bash <= 3.2` (reported by laoshaw) `#D1678` 61705bf +- trace: fix wrong positioning of the ellipses on overflow `#D1684` b90ac78 +- complete: do not generate keywords for quoted command names `#D1691` 60d244f +- menu (menu-style:align): fix the failure of delaying `ble/canvas/trace` on items (motivated by banoris) `#D1710` acc9661 +- complete: fix empty completions with `FIGNORE` (reported by seanfarley) `#D1711` 144ea5d +- main: fix the message of owner errors of cache directories (reported by zim0369) `#D1712` b547a41 +- util (`ble/string#escape-for-bash-specialchars`): fix escaping of TAB `#D1713` 7db3d2b +- complete: fix failglob messages while progcomp for commands containing globchars `#D1716` e26a3a8 + - complete: fix a bug that the default progcomp does not work properly `#D1722` 01643fa +- highlight: fix a bug that arrays without the element `0` is not highlighted `#D1721` b0a0b6f +- util (visible-bell): erase visible-bell before running external commands `#D1723` 0da0c1c + - util(`ble/util/eval-pathname-expansion`): fix restoring shopt options in bash-4.0 `#D1825` 736f4da +- util (`ble/function`): work around `shopt -u extglob` `#D1725` 952c388 +- syntax: fix uninitialized syntax-highlighting in bash-3.2 `#D1731` e3f5bf7 +- make: fix a bug that config update messages are removed on install `#D1736` 72d968f +- util: fix bugs in conversions from `'` to `\''` `#D1739` 6d15782 +- canvas: fix unupdated prompt on async wcwidth resolution `#D1740` e14fa5d +- progcomp: retry completions on `$? == 124` also for non-default completions (reported by SuperSandro2000) `#D1759` 82b9c01 +- app: work around data corruption by WINCH on intermediate state `#D1762` 5065fda +- util (`ble/util/import`): work around filenames with bash special characters `#D1763` b27f758 +- edit: fix the restore failure of `PS1` and `PROMPT_COMMAND` on `ble-detach` `#D1784` b9fdaab +- complete: do not attempt an independent rhs completion for arguments (reported by rsteube) `#D1787` f8bbe2c +- history: fix the unsaved history in the detached state `#D1795` 344168e +- edit: fix an unexpected leave from the command layout on `read` `#D1800` 4dbf16f + - edit: fix the command layout remaining after job information (reported by mozirilla213) `#D1991` dcfb067 +- history: work around possible dirty prefix `*` in the history output `#D1808` 64a740d +- decode (`ble-bind`): fix the printed definition of `-c`/`-x` bindings `#D1821` 94de078 +- command-help (`.read-man`): add missing `ble/util/assign/.rmtmp` `#D1840` 937a164 +- complete: fix wrong `COMP_POINT` with `progcomp_alias` `#D1841` 369f7c0 +- main (`ble-update`): fix error message with system-wide installation of `ble.sh` (fixed by tars0x9752) 1d2a9c1 a450775 +- main. util: fix problems of readlink etc. found by test in macOS (reported by aiotter) `#D1849` fa955c1 `#D1855` a22e145 +- progcomp: fix a bug that `COMP_WORDBREAKS` is ignored `#D1872` 4d2dd35 +- global: quote `return $?` `#D1884` 801d14a +- canvas (`ble/canvas/trace`): fix text justification for empty lines (reported by rashil2000) `#D1894` cdf74c2 +- main: fix adjustments of bash options (reported by rashil2000) `#D1895` 138c476 +- complete: suppress error messages for non-bash_completion `_parse_help` (reported by nik312123) `#D1900` 267de7f +- prompt: fix the marker position for the readline variable `show-mode-in-prompt` (reported by Strykar) `#D1903` 09bb4d3 +- highlight: fix a bug that `bleopt filename_ls_colors` is not working (reported by qoreQyaS) `#D1919` b568ade +- bind: fix M-C-@, C-x C-@, and M-C-x (`bash-4.2 -o emacs`) `#D1920` a410b03 +- complete (action:file): support `ble/syntax-raw` in the filename extraction (reported by qoreQyaS) `#D1921` 32277da +- decode: fix a bug that the tab completion do not work with bash-4.4 and lower `#D1928` 7da9bce +- complete: fix non-working ambiguous path completion with `..` and `.` in the path `#D1930` 632e90a +- main (`ble-reload`): fix failure by non-existent rcfile `#D1931` b7ae2fa +- syntax (`ble/syntax/highlight/vartype`): check variable in global scope `#D1932` b7026de +- menu (linewise): fix layout calculation with variable width of line prefix (reported by bkerin) `#D1979` cc852dc +- edit (`ble/textarea#render`): fix interleaving outputs to `_ble_util_buffer` and `DRAW_BUFF` `#D1987` 6d61388 +- keymap/vi (`expand-range-for-linewise-operator`): fix the end point being not extended `#D1994` bce2033 +- keymap/vi (`operator:filter`): do not append newline at the end of line `#D1994` bce2033 +- highlight: fix shifted error marks after delayed `core-syntax` `#D2000` f4145f16 +- syntax: fix unrecognized variable assignment of the form `echo arr[i]+=rhs` `#D2007` 41faa494 +- menu (linewise): fix clipping of long line (reported by bkerin) `#D2025` 4c6a4775 + +## Documentation + +- blerc: add all the missing options `#D1667` 0228d76 +- blerc: add missing faces `argument_option` and `cmdinfo_cd_cdpath` (reported by Prikalel) `#D1675` 26aaf87 +- README: describe how to invoke multiple widgets with a keybinding (motivated by michaelmob) `#D1699` 6123551 +- README: add links to `bash-it` and `oh-my-bash` `#D1724` 4a2575f +- README: mention the Guix package (motivated by kiasoc5) `#D1888` 0f7c04b +- blerc: add frequently used keybindings (motivated by KiaraGrouwstra, micimize) `#D1896` `#D1897` e19b796 +- wiki/Q&A: add item for defining a widget calling multiple widgets (motivated by micimize) `#D1898` e19b796 +- blerc: rename from `blerc` to `blerc.template` `#D1899` e19b796 +- README: add a link to the explanation on the "more reliable setup" of bashrc (motivated by telometto) `#D1905` 09bb4d3 +- README: describe `contrib/fzf` integration (reported by SuperSandro2000, tbagrel1) `#D1907` 3bc3bea b568ade +- README: add links to Manual pages for *kspec* and `modifyOtherKeys` `#D1917` fb7bd0b1 b568ade +- README: explain the build process `#D1964` `#D1965` 14ca1e5 + +## Optimization + +- syntax (`layer:syntax/word`): perform pathname expansions in background subshells (motivated by 3ximus) `#D1449` 13e7bdd + - syntax (`simple-word/is-simple-noglob`): suppress error messages on expansions `#D1461` a56873f + - syntax (`simple-word/eval`): fix unperformed tilde expansions in the background (reported by 3ximus) `#D1463` 6ebec48 + - syntax (`simple-word/eval`): propagate timeouts in sync highlighting (reported by 3ximus) `#D1465` c2555e2 + - edit: change the priority of `render-defer` and `menu-filter` `#D1501` aae553c +- complete: perform pathname expansions in subshells (motivated by 3ximus) `#D1450` d511896 +- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` cc2881a +- complete (`ble/complete/source:file`): remove slow old codes (reported by timjrd) `#D1512` e5be0c1 +- syntax (`ble/syntax:bash/simple-word/eval`): optimize large array passing (motivated by timjrd) `#D1522` c89aa23 + - syntax (`ble/syntax:bash/simple-word/eval`): use `mapfile -d ''` for Bash 5.2 `#D1604` 72c274e +- main: prefer `nawk` over `mawk` and `gawk` `#D1523` `#D1524` c89aa23 + - main (`ble/bin/.freeze-utility-path`): fix unupdated temporary implementations `#D1528` c70a3b4 + - util (`ble/util/assign`): work around subshell conflicts `#D1578` 6e4bb12 +- history: use `mapfile -d ''` to load history in Bash 5.2 `#D1603` 72c274e +- prompt: use `${PS1@P}` when the prompt contains only safe prompt sequences `#D1617` 8b5da08 + - prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` 521aff9 + - prompt: fix a bug that the special treatment of `\$` in Cygwin/MSYS is disabled `#D1741` 4782a33 +- decode: cache `inputrc` translations `#D1652` 994e2a5 +- complete: use `awk` for batch `quote-insert` (motivated by banoris) `#D1714` a0b2ad2 92d9734 + - complete (quote-insert.batch): fix regex escaping in bracket expr of awk (reported by telometto) `#D1729` 8039b77 +- prompt: reduce redundant evaluation of `PROMPT_COMMAND` on the startup `#D1778` 042376b +- main: run `ble/base/unload` directly at the end of `EXIT` handler `#D1797` 115baec +- util: optimize `ble/util/writearray` `#D1816` 96e9bf8 +- history: optimize processing of `erasedups` (motivated by SuperSandro2000) `#D1817` 944d48e +- debug: add `ble/debug/profiler` (motivated by SuperSandro2000) `#D1824` f629698 11aa4ab 7bb10a7 + - util (`ble/string#split`): optimize `#D1826` 7bb10a7 + - global: avoid passing arbitrary strings through `awk -v var=value` `#D1827` 82232de + - edit: properly set `LINENO` for `PS1`, `PROMPT_COMMAND`, and `DEBUG` `#D1830` 4d24f84 +- complete: generate command names in background with slow WSL2 `PATH`s (contributed by musou1500) `#D2280` 0914a119 + +## Compatibility + +- term: work around quirks of Solaris xpg4 awk `#D1481` 6ca0b8c +- term: support key sequences and control sequences of Solaris console `#D1481` 6ca0b8c +- term: work around Cygwin-console bug of bottom `IL`/`DL` `#D1482` 5dce0b8 +- term: work around leaked DA2R in screen from outside terminal `#D1485` e130619 +- complete: work around `fzf` completion settings loaded automatically `#D1508` 4fc51ae +- complete: work around `bash-completion` bugs (reported by oc1024) `#D1533` 9d4ad56 +- main: work around MSYS2 .inputrc (reported by n1kk) `#D1534` 9e786ae +- util (`modifyOtherKeys`): work around a quirk of kitty (reported by NoahGorny) `#D1549` f599525 + - util (`modifyOtherKeys`): update the workaround for a new quiark of kitty `#D1627` 3e4ecf5 + - util (`modifyOtherKeys`): use the kitty protocol for kitty 0.23+ which removes the support of `modifyOtherKeys` (reported by kovidgoyal) `#D1681` ec91574 + - util (`modifyOtherKeys`): set up `modifyOtherKeys` only after `DA2` (reported by dongxi8) `#D1885` 149eee9 +- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` 560160b +- decode: identify `kitty` and treat `\e[27u` as isolated ESC (reported by lyiriyah) `#D1585` c2a84a2 +- complete: suppress known error messages of `bash-completion` (reported by oc1024, Lun4m) `#D1622` d117973 +- decode: work around kitty keypad keys in modifyOtherKeys (reported by Nudin) `#D1626` 27c80f9 +- main: work around `set -B` and `set -k` `#D1628` a860769 +- term: disable `modifyOtherKeys` and do not send `DA2` for `st` (requested by Shahabaz-Bagwan) `#D1632` 92c7b26 +- cmap: add `st`-specific escape sequences for cursor keys `#D1633` acfb879 +- cmap: distinguish find/select from home/end for openSUSE `inputrc.keys` (reported by cornfeedhobo) `#D1648` c4d28f4 + - cmap: freeze the internal codes of find/select and kitty special keys `#D1674` fdfe62a +- main: work around self-modifying `PROMPT_COMMAND` by `bash-preexec` (reported by cornfeedhobo) `#D1650` 39ebf53 + - main: fix an infinite loop on `ble-reload` with externally saved `PROMPT_COMMAND` (reported by tars0x9752) `#D1851` 53af663 +- decode: work around openSUSE broken `/etc/inputrc` `#D1662` e5b0c86 +- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680` a6b4e2c +- complete: work around the variable leaks by `virsh` completion from `libvirt` (reported by telometto) `#D1682` f985b9a +- stty: do not remove keydefs for C-u, C-v, C-w, and C-? (reported by laoshaw) `#D1683` 82f74f0 +- builtin: print usages of emulated builtins on option errors `#D1694` 6f74021 +- decode (`ble/builtin/bind`): improve compatibility of the deprecated form `bind key:rlfunc` (motivated by cmplstofB) `#D1698` b6fc4f0 + - decode (`ble/builtin/bind`): fix a bug that only lowercase is accepted for deprecated form `bind key:rlfunc` (reported by returntrip) `#D1726` a67458e e363f1b +- complete: work around a false warning messages of gawk-4.0.2 `#D1709` 9771693 +- main: work around `XDG_RUNTIME_DIR` of a different user by `su` (reported by zim0369) `#D1712` 8d37048 +- main (`ble/util/readlink`): work around non-standard or missing `readlink` (motivated by peterzky) `#D1720` a41279e + - util (`ble/function#pop`): allow popping unset function `#D1834` c0abc95 +- menu (`menu-style:desc`): work around xenl quirks for relative cursor movements (reported by telometto) `#D1728` 3e136a6 +- global: work around the arithmetic syntax error of `10#` in Bash-5.1 `#D1734` 7545ea3 +- global: adjust implementations for Bash 5.2 `patsub_replacement` `#D1738` 4590997 + - global: work around `compat42` quoting of `"${v/pat/"$rep"}"` `#D1751` a75bb25 + - prompt: fix a bug of `ble/prompt/print` redundantly quoting `$` `#D1752` a75bb25 + - global: identify bash-4.2 bug that internal quoting of `${v/%$empty/"$rep"}` remains `#D1753` a75bb25 + - global: work around `shopt -s compat42` `#D1754` a75bb25 +- global (`ble/builtin/*`): work around `set -eu` in NixOS initialization (reported by SuperSandro2000) `#D1743` 001c595 +- util, edit, contrib: add support for `bash-preexec` (motivated by SuperSandro2000) `#D1744` e85f52c + - util (`ble/builtin/trap`): fix resetting `$?` and `$_` (reported by SuperSandro2000) `#D1757` dfc6221 + - util (`ble/builtin/trap`): fix a failure of setting the trap-handler exit status (reported by SuperSandro2000) `#D1771` c513ed4 + - edit (`TRAPDEBUG`): partially restore `$_` after `DEBUG` trap (reported by aiotter) `#D1853` 0b95d5d +- main: check `IN_NIX_SHELL` to inactivate ble.sh in nix-shell (suggested by SuperSandro2000) `#D1747` b4bd955 + - main: force prompt-attach inside the nix-shell `rc` `#D1766` ceb2e7c +- canvas: test the terminal for the sequence of clearing `DECSTBM` `#D1748` 4b1601d +- main: check `/dev/tty` on startup (reported by andychu) `#D1749` 711c69f + - main: fix the check of tty on stdin/stdout `#D1833` 80f09c9 +- util: add identification of Windows Terminal `wt` `#D1758` e332dc5 +- complete: evaluate words for `noquote` (motivated by SuperSandro2000) `#D1767` 0a42299 +- edit (TRAPDEBUG): preserve original `DEBUG` trap and enabled it in `PROMPT_COMMAND` (motivated by ammarooo) `#D1772` `#D1773` ec2a67a + - main, trap: fix initialization order of `{save,restore}-BASH_REMATCH` (reported by SuperSandro2000) `#D1780` 689534d +- global: work around bash-3.0 bug that single quotes remains for `"${v-$''}"` `#D1774` 9b96578 +- util: work around old `vte` not supporting `DECSCUSR` yet setting `TERM=xterm` (reported by dongxi8) `#D1785` 70277d0 +- progcomp: work around the cobra V2 description hack (reported by SuperSandro2000) `#D1803` 71d0736 +- complete: work around blocking `_scp_remote_files` and `_dnf` (reported by iantra) `#D1807` a4a779e 46f5c13 +- history: work around broken timestamps in `HISTFILE` (reported by johnyaku) `#D1831` 5ef28eb +- progcomp: disable `command_not_found_handle` (reported by telometto, wisnoskij) `#D1834` 64d471a d5fe1d1 973ae8c +- util (`modifyOtherKeys`): work around delayed terminal identification `#D1842` 14f3c81 + - util (`modifyOtherKeys`): fix a bug that kitty protocol is never activated `#D1842` 14f3c81 +- util (`modifyOtherKeys`): pass-through kitty protocol sequences (motivated by ferdinandyb) `#D1845` f66e0c1 +- main: show warning for empty locale (movivated by Ultra980) `#D1927` 92f2006 +- main: never load `/etc/inputrc` in openSUSE (motivated by Ultra980) `#D1926` 92f2006 0ceb0cb +- canvas: refine detection of `bleopt char_width_mode=musl` `#D1929` b0c16dd +- term (`terminology`): work around terminal glitches `#D1946` 9a1b4f9 +- main (`ble/bin/awk`): add workaround for macOS `awk-32` `#D1974` e2ec89c +- util.hook: workaround bash-5.2 bug of nested read by `WINCH` `#D1981` a5b10e8 + - main (`ble/base/adjust-builtin-wrappers`): fix persistent tempenv `IFS=` in bash-5.0 (reported by pt12lol) `#D2030` 5baf6f63 +- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` 5d14cf1 + - edit: restore `PS1` while processing `bind -x` (reported by adoyle-h) `#D2024` 2eadcd5b +- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` 1e7b884 +- progcomp: work around slow `nix` completion `#D1997` 2c1aacf +- complete: suppress error messages from `_adb` (reported by mozirilla213) `#D2005` f2aa32b0 +- util: test the UTF-8 support of the current `LC_CTYPE` `#D2281` 537c6504 aa1b6f35 + +## Test + +- github/workflows: add CI checks in macOS and msys2 (requested by aiotter) `##D1881` c5ddacc + - github/workflows (nightly): add check for macOS (contributed by aiotter) `#D1881` 4cb0baa + - github/workflows (nightly, test): interchange setup `#D1881` 4cb0baa + - github/workflows: add `test.yml` `#D1881` 824dc53 + - fix for macOS tests + - test (ble/util/c2s): fix locale settings in tests `#D1881` 26ed622 + - test (ble/util/msleep): loosen the condition `#D1881` 26ed622 + - test (ble/util/msleep): skip test in CI `#D1881` 26ed622 + - fix for msys2 tests + - test: ensure a non-empty locale `#D1881` c5d1b82 + - test (ble/util/readlink): work around msys symlinks `#D1881` c5d1b82 + - test (ble/util/declare-print-definitions): skip array assignments involing CR in msys `#D1881` c5d1b82 + - test (ble/util/is-stdin-ready): skip test in the CI msys `#D1881` c5d1b82 + - main (bind): suppress non-interactive warning in msys `#D1881` c5d1b82 + - canvas (GraphemeClusterBreak): handle surrogate pairs for UCS-2 `wchar_t` `#D1881` 18bf121 + - util (ble/encoding:UTF-8/b2c): fix interpretation of leading byte `#D1881` 2e1a7c1 + - util (ble/util/s2c): work around intermediate mbstate of bash <= 5.2 `#D1881` 2e1a7c1 + - util (ble/util/s2bytes): clear locale cache `#D1881` 2e1a7c1 + - complete: fix syntax error for bash-3.0 `#D1881` 0b3e611 + - github/workflows: work around grep-3.0 which crashes in windows-latest `#D1915` fb7bd0b +- test (ble/util/writearray): use `ble/file#hash` instead of `sha256sum` `#D1882` b76e21e +- test (ble/util/readlink): work around external aliases `#D1890` 0c6291f + +## Internal changes and fixes + +- main: include hostname in local runtime directory `#D1444` 6494836 +- global: update the style of document comments ff4c4e7 +- util: add function `ble/string#quote-words` `#D1451` f03b87b +- syntax (`ble/syntax:bash/simple-word/eval`): cache `#D1453` 6d8311e + - syntax (`simple-word/eval`): support `opts=single` for a better cache performance (motivated by 3ximus) `#D1464` 10caaa4 +- global: refactor `setup => set up / set-up` `#D1456` c37a9dd +- global: clean up helps of user functions `#D1459` 33c283e +- benchmark (`ble-measure`): support `-T TIME` and `-B TIME` option `#D1460` 1aa471b +- util, color (`bleopt`, `blehook`, `ble-color-setface`): support `--color` and fix `sgr0` contamination in non-color output `#D1466` 69248ff +- global: fix status check for read timeout `#D1467` e886883 +- decode: move `{keymap/*. => lib/core-decode.*-}rlfunc.txt` and clean up files `#D1486` f7323b4 + - Makefile: fix up f7323b4: restore rule for `keymap/*.txt` `#D1496` 054e5c1 +- util, etc: ensure each function to work with arbitrary `IFS` `#D1490` `#D1491` 5f9adfe +- tui, canvas (`ble/canvas/trace`): support `opts=clip` `#D1493` 61ce90c +- tui, edit: add a new render mode for full-screen applications 817889d +- test (`test-canvas`): fix dependency on `ext/contra` `#D1525` c89aa23 +- util: inherit special file descriptors `#D1552` 98835b5 + - util: fix a bug that old tty is used in new sessions `#D1586` 0e55b8e +- global: use `_ble_term_IFS` `#D1557` d23ad3c +- global: work around `localvar_inherit` for varname-list init `#D1566` 5c2edfc +- util: fix `ble/util/dense-array#fill-range` a46fdaf +- util: fix leak variables `buff`, `trap`, `{x,y}{1,2}` `#D1572` 5967d6c +- util: fix leak variables `#D1643` fcf634b +- edit (`command-help`): use `ble/util/assign/.mktmp` to determine the temporary filename `#D1663` 1af0800 +- make: update lint check `#D1709` 7e26dcd +- test: save the test log to a file `#D1735` d8e6ea7 +- benchmark: improve determination of the base time `#D1737` ad866c1 +- make: add fallback Makefile for BSD make `#D1805` e5d8d00c +- main: support `bleopt debug_xtrace` (requested by SuperSandro2000) `#D1810` 022d38b +- test: clean up check failures by `make check` and `make scan` `#D1812` bb3e0a3 +- util (`fd#alloc`): limit the search range of free fds `#D1813` 43be0e4 4c90072 +- github/workflows: define an action for the nightly builds (contributed by uyha) `#D1814` a3082a0 +- global: quote numbers for unexpected `IFS` `#D1835` 0179afc +- history: refactor hooks `history_{{delete,clear,insert} => change}` `#D1860` c393c93 +- history: rename the hook `history_{on => }leave` `#D1860` c393c93 +- make: check necessary `.git` `#D1887` 0f7c04b +- benchmark (zsh): fix for `KSH_ARRAYS` `#D1886` a144ffa 8cb9b84 +- benchmark: support for ksh as `benchmark.ksh` `#D1886` 5dae4da +- github/workflows (build): rename directory in `ble-nightly.tar.xz` to `ble-nightly` (reported by Harduex) `#D1891` f20854f 4ea2e23 43c6d4b +- edit: update prompts on g2sgr change `#D1906` 40625ac +- util, decode, vi: fix leak variables `#D1933` 8d5cab8 +- util: support `bleopt debug_idle` `#D1945` fa10184 +- global: work around bash-4.4 no-argument return in trap `#D1970` eb4ffce +- util: replace builtin `readonly` with a shell function (requested by mozirilla213) `#D1985` 8683c84 e4758db + - util (`ble/builtin/readonly`): show file and line in warnings `#D2015` 467fa448 2c9b56d7 +- global: avoid directly using `/dev/tty` `#D1986` a835b83 +- util: add `ble/util/message` `#D2001` 2a524f34 +- global: normalize bracket expressions to `_a-zA-Z` / `_a-zA-Z0-9` `#D2006` 41faa494 +- global: fix leak variables `#D2018` 6f5604de +- edit: handle nested WINCH properly `#D2020` a6b2c078 +- make: include the source filenames in the installed files (suggested by bkerin) `#D2027` 610fab39 + +## Contrib + +- prompt-git: detect staged changes `#D1718` 2b48e31 +- prompt-git: fix a bug that information is not updated on reload `#D1732` 361e9c5 +- config/execmark: show exit status in a separate line `#D1828` 4d24f84 + - config/execmark: add names of exit statuses `#D2019` a6b2c078 +- prompt-git: ignore untracked files in submodules `#D1829` 4d24f84 +- integration/fzf + - fzf-completion: fix integration (reported by ferdinandyb) `#D1837` 12c022b + - fzf-completion: remove `noquote` (reported by MK-Alias) `#D1889` 0c6291f + - fzf-initialize: check directory existence before adding it to `PATH` (reported by Strykar) `#D1904` 09bb4d3 + - fzf-key-bindings: fix a problem that `modifyOtherKeys` is not reflected (reported by SuperSandro2000) `#D1908` 486564a + - fzf-completion: quote only with `filenames` when `ble/syntax-raw` is specified (reported by christianknauer) `#D1978` 8965b61 +- integration/zoxide + - complete, contrib: add completion integration with `zoxide` (reported by ferdinandyb) `#D1838` a96bafe + - zoxide: update `contrib/integration/zoxide` for zoxide v0.8.1 `#D1907` 3bc3bea + - zoxide: adjust `zoxide icanon` (reported by linwaytin) `#D1993` dc7de6b +- README: update description on `_ble_contrib_fzf_base` (reported by Strykar) `#D1904` 09bb4d3 +- colorglass: add color filter `#D1902` 88e74cc + - colorglass: add `bleopt colorglass_{saturation,brightness}` (motivated by auwsom) `#D1906` 40625ac +- add `histdb` `#D1925` 44d9e10 + - histdb: support auto-complete source `histdb-word` `#D1938` 00cae74 + - histdb: automatically upgrade histdb version `#D1940` 4fac1e3 + - histdb: support auto-complete source `histdb-history` `#D1941` 4fac1e3 + - histdb: handle multiple exec lines for `histdb_ignore` `#D1942` 36e1c89 + - histdb: kill orphan `sqlite3` processes `#D1943` 36e1c89 + - histdb: back up the database `#D1944` 36e1c89 + - histdb: fix miscellaneous SQL query errors `#D1947` 46ac426 + - histdb: output error messages to tty `#D1952` 651c70c + - histdb: fix remaining debug function name "assign{2 => }" in bash <= 3.2 `#D1953` 651c70c + - histdb: fix a problem that the background process fails to start in bash-3.0 `#D1956` 651c70c + - histdb: fix a bug that history search fails with a single quote in the commandline `#D1957` 651c70c + - histdb: fix `histdb-word` completions in the middle of the commandline `#D1968` adaec05 + - histdb: support `bleopt histdb_remarks` `#D1968` adaec05 + - histdb: support timeout of background processes `#D1971` e0566bd + - histdb: enable database timeout for transactions `#D1982` a5b10e8 + - histdb: fix `.timeout` not set for background `sqlite3` `#D1982` 20b42fa + - histdb: suppress color codes in the default `histdb_remarks` `#D1968` 20b42fa + - histdb: disable timeout of background processes in Bash 3.2 `#D1992` 20b42fa + - histdb: rewrite to use `ble/util/bgproc` `#D2017` 7803305f +- integration: move `fzf` and `bash-preexec` integrations to subdir `#D1939` 86d9467 + + +# ble-0.4.0-devel2 + +2020-01-12 -- 2020-12-02 (`#D1215`...`#D1426`) c74abc5...276baf2 + +## New features + +- complete: support `bleopt complete_auto_wordbreaks` (suggestion by dylankb) `#D1219` c294e31 +- main: check `~/.config/blesh/init.sh` `#D1224` a82f961 +- progcolor: support programmable highlighting `#D1218` 0770234 `#D1244` 9cb3583 `#D1245` 8e8a296 `#D1247` 154f638 `#D1269` fa0036c +- decode/kbd: support U+XXXX, @ESC and @NUL for keynames `#D1251` 441117c ef23ad1 +- syntax: support `coproc` `#D1252` 7ff68d2 +- vi/nmap: support readline widgets for M-left, M-right, C-delete, # and & `#D1258` 846e0be +- complete: add `compopt -o quote/default` for `fzf` (motivated by dylankb) `#D1275` 58e1be4 +- util (`ble-import`): support an option `-d` (`--delay`) `#D1285` 9673e4e +- syntax: support parameter expansion of the form `${var/#pat}`, `${var/%pat}` `#D1286` e2f4809 +- edit: support `bleopt editor line_limit_{type,length} history_limit_length` `#D1295` 2f9a000 +- edit: support widgets `{vi,emacs}-editing-mode` `#D1301` 0c6c76e +- syntax: allow unquoted `[!` and `[^` in `simple-word` (reported by cmplstofB) `#D1303` 1efe833 +- util (`ble/util/print-global-definitions`): support arrays and unset variables (test-util) 6e85f1c +- util (`ble/util/cat`): support NUL and multiple files (test-util) d19a9af +- edit: support Bash 5.1 `READLINE_MARK` and `PROMPT_COMMANDS` `#D1328` e97a858 `#D1338` 657bea5 + - edit, main: support array PROMPT_COMMAND in bash-5.1 `#D1380` b852a4f +- syntax: support confusing parameter expansions like `${#@}`, etc. `#D1330` b7b42eb +- contrib: add contrib for user settings `#D1335` f290115 +- syntax: support `${var@UuLK}` in Bash 5.1 `#D1336` 04da4dd +- main: add an option `--test` `#D1340` 1410c72 +- util (`ble/builtin/trap`): support `return` in `INT`/`EXIT`/`WINCH` `#D1347` `#D1348` 3865488 +- history: support timestamp (reported by rux616) `#D1351` 4bcbd71 `#D1356` 350bb15 `#D1364` 1d8adf9 +- edit: support Bash 4.4 `PS0` `#D1357` 23a1ac5 +- vi: support `bleopt keymap_vi_mode_{update_prompt,show,name_*}` (suggested by Dave-Elec) `#D1365` 76be6f1 +- prompt: support prompt sequence `\q{...}` `#D1365` 76be6f1 +- edit: support `bind 'set show-mode-in-prompt'` `#D1365` 76be6f1 + - prompt: fix a bug that mode string is not shown in `auto_complete` and other sub-modes (reported by tigger04) `#D1371` f6fc7ff + - prompt: redraw prompts on the prompt content change (reported by tigger04) `#D1371` 1954a1e +- prompt: support `bleopt prompt_{{ps1,rps1}{_final,_transient}}` (suggested by Dave-Elec) `#D1366` 06381c9 + - prompt: fix a bug that prompt are always re-insntiated for every rendering `#D1374` 0770cda + - prompt: fix a bug that rprompt is not cleared when `bleopt prompt_rps1` is reset `#D1377` 1904b1d + - prompt: fix a bug that prompts updated by `PROMPT_COMMAND` are not reflected immediately (reported by 3ximus) `#D1426` bbda197 +- edit: support Bash 5.1 widgets `#D1368` e747ee3 +- color: support `TERM=*-direct` `#D1369` 0d38897 `#D1370` f7dc477 +- complete: support `bleopt complete_auto_menu` `#D1373` 77bfabd + - complete: fix a problem of frequent bells with auto-menu activated `#D1381` 3b1d8ac +- complete: support `bleopt complete_menu_maxlines` `#D1375` 8e81cd7 +- prompt: support `_ble_prompt_update` `#D1376` 0fa8739 +- prompt: support `bleopt prompt_{xterm_title,screen_title,status_line}` `#D1378` 5c3f6fe + - prompt: check `TERM` for prompt window titles when `_ble_term_TERM` is unavailable `#D1388` 3c88869 +- syntax: support options `bleopt highlight_{syntax,filename,vartype}` to turn off highlighting (requested by pjmp) `#D1379` 0116f8b +- complete: support `shopt progcomp_alias` `#D1397` d68afa5 +- complete: generate completions of options based on man pages `#D1405` 8183455 + - complete (mandb): fix a bug that `bleopt complete_menu_style` is globally changed `#D1412` b91fd10 +- highlight: support colon separated lists of paths `#D1409` 2f40422 + - highlight: fix a bug that non-simple words are always highlighted as `syntax_error` (reported by cmplstofB) `#D1411` 46e2ac6 + - highlight: fix a bug that words are sometimes unhighlighted `#D1418` 4395484 + - highlight: fix a bug that non-existent directories are not highlighted in the command name context `#D1419` 4395484 +- highlight: support options `#D1410` 2f40422 + - highlight: support highlighting of `declare` command options `#D1420` f0df481 + - highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` a32962e + +## Changes + +- highlight: highlight symlink directories as symlinks `#D1249` 25e8a72 +- auto-complete: bind `insert-on-end` to `C-e` `#D1250` 90b45eb +- edit (`widget/shell-expand-line`): not quote expanded results by default `#D1255` a9b7810 +- decode: refactor + - decode: delay bind until keymap initialization `#D1258` 0beac33 + - decode: read user settings from `bind -Xsp` `#D1259` eef14d0 + - decode: fix a bug of `ble-bind` with uninitialized cmap `#D1260` 5d98210 + - decode: fix error messages of BSD `sed` rejecting unencoded bytes from `bind -p` (reported by dylankb) `#D1277` 0cc9160 +- edit: provide proper `$BASH_COMMAND` and `$_` for PS1, PROMPT_COMMAND, PRECMD, etc. `#D1276` 7db48dc +- edit (quoted-insert): insert literal key sequence `#D1291` 420c933 +- decode: support `decode_abort_char` for `modifyOtherKeys` `#D1293` ad98416 +- edit (edit-and-execute): disable highlighting of old command line content `#D1295` 2f9a000 +- util (`bleopt`): fail when a specified bleopt variable does not exist (test-util) 5966f22 +- builtin: let redefined builtins return 2 for `--help` `#D1323` 731896c +- edit: preserve `PS1` when `internal_suppress_bash_output` is set `#D1344` 6ede0c7 +- complete: complete param expan in additional contexts `#D1358` 3683305 +- main: reload on ble-update when ble.sh is already updated `#D1359` a441d4d +- main (`ble-update`): clone github repository if the original repository is not found `#D1363` 6e3b3b5 +- util (bleopt): change output format d4b12cd +- syntax: allow `time -- command` for Bash 5.1 `#D1367` 00d0e93 +- menu: preserve columns with `{forward,backward}-line` `#D1396` 3d5a341 +- syntax: rename `ble_debug` to `bleopt syntax_debug` `#D1398` 3cda58b +- syntax: change a style of buffer contents in `bleopt syntax_debug` `#D1399` 3cda58b +- complete: change to generate filenames starting from `.` by default (motivated by cmplstofB) `#D1425` 987436d + +## Fix + +- util (ble/builtin/trap): fix argument analysis for the form `trap INT` (reported by dylankb) `#D1221` db8b0c2 +- main: fix an error message on ristricted shells `#D1220` b726225 +- edit: fix a bug that the shell hangs with `source ble.sh --noattach && ble-attach` (reported by dylankb) `#D1223` 59c1ce4 3031007 +- edit: fix a bug that the textarea state is not properly saved (reported by cmplstofB) `#D1227` 06ae2b1 +- syntax: support hexadecimal literals for arithmetic expression (reported by cmplstofB) `#D1228` 90e4f35 +- history: fix a bug that history append does not work with `set -C` (reported by cmplstofB) `#D1229` 604bb8b +- decode (`ble/builtin/bind`): fix widget mapping for `default_keymap=safe` `#D1234` 750a9f5 +- main (ble-update): fix a bug that the check of `make` does not work in Bash 3.2 `#D1236` 08ced81 +- syntax: fix a infinite loop for variable assignments and parameter expansions `#D1239` 327661f +- complete: clear menu on history move `#D1248` 06cc7de +- syntax: fix a bug that arguments of `eval` are not highlighted `#D1254` 5046d14 +- decode: fix error message `command=${[key]-}` for mouse input `#D1263` 09bb274 +- [ble-0.3] reload: fix a bug that the state is broken by `ble-reload` `#D1266` f2f30d1 +- decode (`ble/builtin/bind`): remove comment from bind argument `#D1267` 880bb2c +- decode: use `BRE` instead of `ERE` for `POSIX sed` (reported by dylankb) `#D1283` 2184739 +- decode: fix strange behaviors after `fzf` (convert DEL to C-?) `#D1281` 744c8e8 +- edit: work around Bash rebinding on `TERM` change `#D1287` ac7ab55 7a99bf3 +- term: work around terminfo/termcap entry collisions in `tput` (reported by killermoehre) `#D1289` f8c54ef +- complete: clear menu on discard-line (reported by animecyc) `#D1290` fb794b3 `#D1315` 99880ef +- vi (vi-command/nth-column): fix a bug in arithmetic expansion (reported by andychu) `#D1292` da6cc47 +- complete: fix a bug that insert-word does not for with ambiguous candidates `#D1295` 2f9a000 +- complete: fix a bug that menu-filter is only partially turned off by `complete_menu_filter` `#D1298` b3654e2 +- decode: fix error messages for unsupported readline functions `#D1301` 91bdb64 +- global: work around `shopt -s assoc_expand_once` `#D1305` 31908e1 +- global: work around `TMOUT` for `builtin read` `#D1306` 1c22a9d +- syntax: fix failglob errors of heredocs of the form `<<$(echo A)` `#D1308` 3212fd2 +- decode (`ble-bind`): fix an error message `#D1311` c868b6d +- util (`bleopt`): fix a bug that a new setting is not defined with `name:=` (test-util) `#D1312` c757b92 +- util (`ble/util/{save,restore}-vars`): fix a bug that `name` and `prefix` cannot be saved/restored (test-util) 5f2480c +- util: fix `ble/is-{inttype,readonly,transformed}` (test-util) 485e1ac +- util (`ble/path#remove{,-glob}`): fix corner cases (test-util) ccbc9f8 +- history: fix a problem that the history is doubled by `history -a` in `bashrc` `#D1314` 34821fe +- util (`ble/variable#get-attr`): fix an error message with special variable names such as `?` and `*` `#D1321` 557b774 +- util (has-glob-pattern): fix abort in subshells (test-util) `#D1326` dc292a2 +- edit: fix a bug that `set +H` is cancelled on command execution `#D1332` 02bdf4e +- syntax (`ble/syntax/parse/shift`): fix a bug of shift skip in nested words `#D1333` 65fbba0 +- global: work around Bash-4.4 `return` in trap handlers `#D1334` aa09d15 +- util (`ble-stackdump`): fix a shift of line numbers `#D1337` a14b72f d785b64 +- edit (`ble-bind -x`): check range of `READLINE_{POINT,MARK}` `#D1339` efe1e81 +- main: fix a bug that `~/.config/blesh/init.sh` is not detected (GitHub #53 by rux616) 61f9e10 +- util (`ble/string#to{upper,lower}`): work around `LC_COLLATE=en_US.utf8` (test-util) `#D1341` 1f6b44e `#D1355` 4da6103 5f0d49f +- util (encoding, keyseq): fix miscelleneous encoding bugs (test-util) 435bd16 + - `ble/util/c2keyseq`: work around bash ambiguous keyseq `\M-\C-\\` + - `ble/util/c2keyseq`: fix a bug that `C1` characters are not properly encoded + - `ble/util/keyseq2chars`: fix a bug that `\xHH` is not properly processed + - `ble/encoding:UTF-8/b2c`: work around Bash-4.2 arithmetic crash + - `ble/encoding:UTF-8/b2c`: fix a bug that `G0` characters lose its seventh bit + - `ble/encoding:UTF-8/c2b`: fix a bug that the first byte gets redundant bits +- edit: work around `WINCH` not updating `COLUMNS`/`LINES` after `ble-reload` `#D1345` a190455 +- complete: initialize `bleopt complete_menu_style` options before `complete_load` hook (reported by rux616) `#D1352` 8a9a386 +- main: fix problems caused by multiple `source ble.sh` in bashrc `#D1354` 5476933 +- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` 4760409 +- complete: quote `#` and `~` at the beginning of word `#D1362` f62fe54 +- decode (`bind`): work around `shopt -s nocasematch` (reported by tigger04) `#D1372` 855cacf +- syntax (tree-enumerate): fix unmodified `wtype` of reconstructed words at the end `#D1385` 98576c7 +- complete: fix a bug that progcomp retry by 124 caused the default completion again `#D1386` 98576c7 +- complete: fix bugs that quotation disappears on ambiguous completion `#D1387` 98576c7 +- complete: fix a bug of duplicated completions of filenames with spaces `#D1390` 98576c7 +- complete: fix superlinear performace of ambiguous matching globpat `#D1389` 71afaba +- prompt: fix extra spaces on line folding before double width character `#D1400` d84bcd8 +- prompt: fix a bug that lonig rps1 is not correctly turned off `#D1401` d84bcd8 +- syntax (glob bracket expression): fix a bug of unsupported POSIX brackets `#D1402` 6fd9e22 +- syntax (`ble/syntax:bash/simple-word/evaluate-path-spec`): fix a bug of unrecognized `[!...]` and `[^...]` `#D1403` 0b842f5 +- complete (`cd`): fix duplicate candidates by `CDPATH` (reported by Lennart00 at `oh-my-bash`) `#D1415` 5777d7f +- complete (`source:file`): fix a bug that tilde expansion candidates are always filtered out `#D1416` 5777d7f +- complete: fix a problem of redundant unmatched ambiguous part with tilde expansions in the common prefix `#D1417` 5777d7f +- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` 1066653 +- complete: fix a problem that the user setting `dotglob` is changed `#D1425` 987436d + +## Compatibility + +- main: work around cygwin uninitialized environment `#D1225` `#D1226` b9278bc +- global: work around Bash 3.2 bug of array initialization with SOH/DEL `#D1238` defdbd4 `#D1241` 1720ec0 +- term: support `TERM=minix` `#D1262` ae0b80f +- msys2: support2 MSYS (motivated by SUCHMOKUO) `#D1264` 47e2863 + - edit: support `\$` in `PS1` for MSYS2 `#D1265` f6f8956 + - msys2: work around MSYS2 Bash bug of missing CR `#D1270` 71f3498 + - cygwin, msys2: support widget `paste-from-clipboard` `#D1271` cd26c65 +- msys1: support MSYS1 `#D1272` 630d659 + - msys1: work around missing named pipes in MSYS1 `#D1273` 6f6c2e5 +- term: support contra `SPD` `#D1288` 1e65f2c +- decode: work around Bash-4.1 bug that locale not applied with `LC_CTYPE=C eval command` (test-util) b2c7d1c +- util (`ble/variable#get-attr`): fix a bug that attributes are not obtained in Bash <= 4.3 (test-util) b2c7d1c +- decode: work around Bash-3.1 bug of `declare -f` rejecting special characters in function names (test-util) b2c7d1c +- edit (`ble/widget/bracketed-paste`): fix error messages on `paste_end` in older version of Bash (test-util) b2c7d1c +- decode: work around Bash-4.1 arithmetic bug of array subscripts evaluated in discarded branches `#D1320` 557b774 +- complete: follow Bash-5.1 change of arithmetic literal `10#` `#D1322` 557b774 +- decode: fix a bug of broken cmap cache found in ble-0.3 `#D1327` 16b56bf +- util (strftime): fix a bug not working with `-v var` option in Bash <= 4.1 (test-util) f1a2818 +- complete: work around slow `compgen -c` in Cygwin `#D1329` 5327f5d +- edit: work around problems with `mc` (reported by onelittlehope) `#D1392` e97aa07 + - highlight: fix a problem that the attribute of the last character is applied till EOL `#D1393` 2ddb1ba `#D1395` ef09932 + +## Internal changes and fixes + +- util: merge `ble/util/{save,restore}-{arrs => vars}` `#D1217` 6acb9a3 +- internal: merge subdir `test` into `memo` `#D1230` f0c38b6 +- ble-measure: improve calibration `DD1231` d3a7a52 +- vi_test: fix a bug that test fails to restore the original state `#D1232` 4b882fb +- decode (ble/builtin/bind): skip checking stdin in parsing the keyseq `#D1235` 5f949e8 +- syntax: delay load of `ble/syntax/parse` for syntax highlighting `#D1237` bb31b11 +- memo: split `memo.txt` -> `note.txt`, `done.txt` and `ChangeLog.md` `#D1243` 31bc9aa 8b0fe34 419155e +- global: check isolated identifiers and leak variables `#D1246` 19cc99d 2e74b6d +- util: add `ble/function#{advice,push,pop}` to patch functions (motivated by dylankb) `#D1275` fbe531a +- util (`ble/util/stackdump`): output to `stdout` instead of `stderr` `#D1279` 9d3c50d +- complete (`ble-sabbrev`): delay initialization `#D1282` dfc4f66 +- test: update `lib/test-{core => util}.sh` (reported by andychu) `#D1294` e835b0d +- edit: improve performance of bracketed-paste `#D1296` 0a45596 `#D1300` 3f33dab `#D1302` 5ee06c8 10ad274 +- decode: improve performance of `ble-decode-char` `#D1297` 0d9d867 +- ext: update `mwg_pp.awk` (for branch osh) 978ea32 +- test: add `lib/core-test.sh` `#D1309` 68f8077 +- global: do not use `local -i` `#D1310` f9f0f9b +- global: normalize calls of builtins `#D1313` b3b06f7 +- test: refactor test `#D1316` `#D1317` 6c2f863 +- util (`ble/util/openat`): change to open unused fds `#D1318` 6c2f863 +- util: rename `ble/{util/openat => fd#alloc}` `#D1319` 6c2f863 +- util (`ble/function#advice remove`): restore original command 149a640 +- edit: rename `ble-edit/prompt/*` -> `ble/prompt/*` `#D1365` 76be6f1 +- main: use `PROMPT_COMMAND` in bash-5.1 for prompt attach `#D1380` b852a4f +- main: unset `BLE_VERSION`, `_ble_bash`, etc. on `ble-unload` `#D1382` 6b615b6 +- util: revisit `ble/variable#is-global` implementation `#D1383` 6b5468f +- cmap: recognize SS3 O as blur `#D1384` 445a5ad +- edit (`ble/widget/{accept-line,newline}`): automatically switch widgets by the keymap `#D1391` 5bed6e6 +- complete: perform filter in `ble/complete/cand/yield` `#D1404` 7c6b67b 83fa830 + - complete: fix a bug that `ble/cmdinfo/complete:cd` candidates are unfiltered (reported by cmplstofB) `#D1413` 5c17a31 + - complete: fix unfiltered tilde expansions `#D1414` 5777d7f + - complete: fix candidate filter failure in dynamic sabbrev expansion (reported by darrSonik) `#D1423` dabc515 +- syntax, edit: use `type -a -t -- cmd` to get command types hidden by keywords `#D1406` ef2d912 +- edit, complete: replace some external commands with Bash builtin `#D1407` 5386e93 + + +# ble-0.4.0-devel1 + +2019-03-21 -- 2020-01-12 (#D1015...#D1215) df4feaa...c74abc5 + +## New features + +- emacs: support widgets `forward-byte` and `backward-byte` `#D1017` b2951ef +- emacs: support arguments of word wise operations `#D1020` 719092c +- emacs: support widgets `{capitalize,downcase,upcase}-xword` `#D1019` 719092c +- emacs: support widgets `alias-expand-line` and `history-and-alias-expand-line` `#D1024` fdaf579 +- emacs: support keyboard macros `#D1028` 284668a + - decode: workaround recursive charlog/keylog `#D1030` ea421a3 +- complete: define `menu` keymap `#D1033` abfd060 +- emacs: support widgets `kill{,-graphical,-logical}-line` `#D1037` 3bb3d33 +- emacs: support a widget `re-read-init-file` `#D1038` ebe2928 +- emacs: support widgets `readline-dump-{functions,macros,variables}` `#D1039` 49256a9 +- emacs: support widgets `character-search-{for,back}ward` and `delete-forward-char-or-list` `#D1040` 2b20c88 +- emacs: support widgets `insert-comment` and `do-lowercase-version` `#D1041` 7aae37b +- main: support options `--version` and `--help` `#D1042` b5ab789 +- main: read `.inputrc` as `ble.sh` settings `#D1042` b5ab789 + - decode: fix a bug of error messages on reading `.inputrc` `#D1062` e163b9a +- complete: support widget `menu-complete insert_braces` `#D1043` 3d29c8d + - complete (insert_braces): reimplement range contraction `#D1044` dc586da + - complete (insert_braces): remove empty quotations `#D1045` `#D1046` dc586da + - complete (insert_braces): fix support of replacement of existing part `#D1047` dc586da +- complete: support `complete context=dynamic-history` `#D1048` 4f7b284 +- emacs: support a widget `edit-and-execute-command` `#D1050` ca5fe08 +- emacs: support widgets `insert-{last,nth}-argument` `#D1051` 24458be +- complete: support `menu-complete backward` `#D1052` 2b0c7e8 +- emacs: `history-nsearch-{for,back}ward-again` `#D1053` 60dde2c +- emacs: support widgets `tab-insert`, `tilde-expand` and `shell-expand-line` `#D1054` 156b76e +- emacs: support a widget `transpose-{c,u,s,f,e}words` `#D1055` d72c2d4 +- emacs: support `bleopt decode_error_cseq_{abell,vbell,discard}` `#D1056` ab1b8b0 + - decode: fix a bug that cmap cache update is not triggered for `#D1073` f1e7674 +- emacs: support a widget `universal-arg` `#D1057` 8b1dd07 +- emacs: support kill ring and a widget `yank-pop` `#D1059` 8c9b6e8 +- highlight: support job names by `auto_resume` `#D1065` ce46024 +- decode: add support for `S8C1T` key sequences `#D1083` 9b7939b +- history: support `bleopt history_share` `#D1100` `#D1099` 305b89f `#D1193` 4838a46 +- history: support full multiline history `#D1120` 8cf17f7 + - history: do not synchronize multiline resolution on "history -p" `#D1121` 9e56b7b + - history.mlfix: suppress errors on Bash 3 `#D1122` 4fe7a0c + - history: suppress error messages trying to kill background worker on reattach `#D1125` f045fec +- highlight: support dirname colors with pathname expansion, failglob and command names `#D1134` edaf495 +- util: introduce `blehook` `#D1139` d1a78fb + - blehook: support `blehook PRECMD PREEXEC POSTEXEC CHPWD ADDHISTORY` `#D1142` bedc2ba + - blehook: add `blehook/eval-after-load` `#D1145` c1f7aa9 + - blehook: fix a bug that the definition of specified hooks are not printed `#D1146` a4a7cbc +- highlight: highlight word with the form of URL `#D1150` f48f2d7 +- syntax: support syntax/globpat in param expansions `#D1157` `#D1158` 051222e `#D1160` 57b42ba + - syntax: fix attr of nested extglob in param expansions `#D1159` 2d019f0 +- decode: support `ble-bind -T kspecs timeout` for timeout and `lib/vim-arpeggio.sh` (request by divramod) `#D1174` 272344e +- complete: use `WORD*` pathname expansion for candidates on failglob with `WORD` `#D1177` c1b0532 +- edit: support `bleopt accept_line_threshold` `#D1178` a3385f6 82a1e0b +- complete: support `bleopt complete_allow_reduction` `#D1181` 03040b7 +- edit: support `bleopt exec_errexit_mark` `#D1182` 6adc2df +- color: support true colors `#D1184` bd631ce 5dd6b03 +- color (`ble-color-setface`): support reference to another face (reported by cmplstofB) `#D1188` 1885b54 `#D1206` 7e31ad3 +- edit: support `shopt -u promptvars` `#D1189` 269ba09 +- highlight: highlight variable names and numbers according to its state `#D1210` `#D1211` 93dab7b +- highlight: support `${var@op}` (for bash 4.4) `#D1212` a85bdb8 + +## Changes + +- edit: erase in page on `SIGWINCH` `#D1016` 7625ebe +- edit: the widgets `{kill,copy,delete}-region-or` now receives widgets as arguments `#D1021` bbbd155 +- edit: disable aliases for builtins and keywords `#D1023` 61da093 +- edit: disable `rps1` in secondary textareas `#D1027` b86709a +- edit: support `$?` in `PROMPT_COMMAND` and `PS1` evaluation `#D1074` 43f2967 +- main: change default attach strategy to `--attach=prompt` `#D1076` 197f752 +- main: change exit status of `ble-update` when it is already up to date `#D1081` d94f691 +- progcomp: improve treatment of `COMP_WORDBREAKS` `#D1094` f6740b5 `#D1098` 6c6bae5 +- history: replace builtin `history` `#D1101` 655d73e + - history: synchronize undo/mark/dirty data with history changes `#D1102` `#D1103` `#D1104` 5367360 + - history: improve performance of `history -r` `#D1105` `#D1106` f204bc7 + - history: fix a problem that history file is doubled with `history -cr` in `PROMPT_COMMAND` `#D1110` e64edb7 + - history: suppress errors on new history file `#D1111` e64edb7 `#D1113` 91f07b6 + - history: fix a problem that `_ble_edit_history` is not synchronized with `history -r` `#D1112` e64edb7 + - history: do not process `_ble_edit_history` in detached state `#D1115` bf3b014 + - history: move history item on delete of current item with `history -d` `#D1114` bf3b014 + - history: fix a problem that history before load of ble.sh is lost `#D1126` 37cd154 + - history: fix problems of history output after `ble-reload` `#D1129` 9c8d858 +- history: improve performance of `erasedups` `#D1107` 518e2ee +- history: correctly handle `HISTSIZE` overflow `#D1108` 7be255c +- sabbrev: support sabbrev expansion in wider contexts (reported by cmplstofB) `#D1117` ca6e03d +- main: change loading point of `.inputrc` `#D1127` af758e5 +- highlight: do not split command names with `:` and `=` `#D1133` 8a1bd8f +- decode: support DA1 responses sent by some terminals (reported by miba072) `#D1135` 362ab05 +- highlight: make brace expansions active for RHS of variable-assignment-form arguments `#D1138` 93cc8da +- main: adjust readline variables for `ble.sh` `#D1148` 36312f7 +- edit: update prompt after execution of command through `ble-bind` `#D1151` 27208ea +- blehook: replace builtin `trap` `#D1152` d6c555e 7d4fd03 + - blehook: suppress extra `DEBUG` trap calls `#D1155` 25c3e19 +- syntax: allow `},fi,done,esac,then,...` after subshell `()` `#D1165` fdb49f3 +- edit: support options `--help` for `read` and `exit` `#D1173` faccc6b +- color (`ble-color-{set,def}face`): list faces without arguments `#D1180` 50327c3 +- complete: search completion settings through alias expansion `#D1187` c472809 +- history (`ble/builtin/history`): support an option `--help` `#D1192` d4c26c5 + +## Fixes + +- decode: workaround Poderosa that returns `DSR` instead of `CPR` in reply to `DSR(6)` `#D1018` 8e22c17 +- isearch: fix a bug to match with the old content of the current line `#D1025` 605dcd0 +- vi: fix a bug that quoted-insert is not properly recorded with `qx...q` `#D1026` 06698a4 +- decode: fix a bug that chars from nested widgets are not processed immediately `#D1028` c79d89b +- menu: fix a bug that fails to retrieve menu item description `#D1031` c936db8 +- menu: fix a bug that menu item color is disabled `#D1032` c936db8 +- vbell: fix a bug that persistent vbell is not erased before next vbell `#D1034` a3af6c0 +- menu-complete: fix a bug that candidates from menu only contained visible ones `#D1036` 275779f +- menu-complete: fix a bug that original texts were lost on cancel `#D1049` 3bbfef6 +- edit: fix a bug that rendering is caused twice `#D1053` c7599a2 +- color (layer:region): fix a bug that highlighting is cleared without dirty ranges `#D1053` 23796bc +- edit (nsearch): fix a bug that the search range is narrowed after fail `#D1053` 3b2237e +- edit (nsearch): fix a bug of messages on search fail `#D1053` 3b2237e +- util: fix a bug that SGR of visible-bell remains 799f6d3 +- decode: fix a bug of infinite loops on `ble-reload` `#D1077` 0f01bcf `#D1079` fee22b1 +- decode: workaround a bash-5.0 bug of `bind -p` `#D1078` b52da28 +- complete: workaround slow command candidates generation in Cygwin `#D1080` 376bfe7 +- syntax: fix false error highlighting of commands after `}`, `fi`, `done` or `esac` `#D1082` 4ce2753 +- decode: fix a bug that modifyOtherKeys did not work at all 1666ec2 +- edit: fix a problem that status line vanishes on window resize `#D1085` 467b7a4 + - edit: recalculate prompts after resize `#D1088` b29f248 + - edit: fix the position of cursor after resize `#D1089` b29f248 +- decode: fix a bug that `ble-update` breaks keymap cache `#D1086` ab8dad2 +- edit (`ble/builtin/read`): suppress noisy job messages and delay caused by vbell `#D1087` 309b9e4 +- edit (`ble/builtin/read`): workaround failglob crash on vbell inside `read` `#D1090` 2e6f44c +- edit: workaround a bash bug that history entries are removed by `history -p` `#D1091` 146f9e7 +- edit (self-insert): workaround Bash-3.0 bug that ^? cannot be handled properly `#D1093` e09c7b5 +- highlight: fix a bug that quoted tilde expansions are processed for filename highlighting `#D1095` 3f1f472 +- menu-complete: fix a bug that word is expanded on cancel `#D1097` 001b914 +- highlight: fix a problem that empty arguments are highlighted as errors `#D1116` 64ae8ce +- sabbrev: fix a bug that menu-filter is not canceled on some sabbrev expansion `#D1118` 30cc31c +- main: fix a bug that `source ble.sh --noattach` in `ble.sh` sessions hangs `#D1130` d35682a caa46c2 `#D1199` +- syntax: workaround bashbug 3.1/3.2 that `eval` ending with \ + LF causes error messages `#D1132` a4b7e00 +- term: workaround `cygwin` console glitches `#D1143` b79c35f `#D1144` ef19d17 +- main: fix a bug that error messages for unsupported shells are not printed `#D1149` 34bd6f8 +- main: workaround `set -ex` `#D1153` 06ebf9f +- main: workaround shell variable `FUNCNEST` `#D1154` fa2aa47 +- highlight: fix error messages on the command line `a=[` `#D1156` b159ea2 +- util: fix a bug of "ble/builtin/trap" not recognizing "-" `#D1161` 11fddba +- init-bind: workaround a bash-5.0 bug that `bind '"\C-\\": ...'` does not work `#D1162` 80edf44 +- init-bind: do not use workaround of `C-x` in vi mode `#D1163` e6a3d33 +- vi_test: fix test for the macro playing `#D1164` 636517c +- exec: fix a problem that the shell hangs with failglob in pipe `#D1166` ac8ba6e +- complete: fix a problem of delay with path `//` in Cygwin `#D1168` 2cf8cc7 +- prompt: fix the expansion of `\w` and `\W` in `PS1` for working directories with double slashes `#D1169` d1288dd +- exec: workaround termination of command execution on syntax error in array subscripts `#D1170` 4f442d0 +- history: fix a bug that garbage `__ble_edt__` is added in front of history entries 61f4bd1 +- decode: remove debug messages for `ble-bind -s` 64a17c3 +- syntax: fix highlighting of `${!var@}` `#D1176` 161ed80 +- term: fix `Ss` (`DECSCUSR`) 0c773da +- term: workaround linux console CSI \>, CSI M, CSI L `#D1213` `#D1214` 0ec6f0c +- edit: fix exit status of Bash by key binding C-d `#D1215` a9756e9 + +## Support macOS, FreeBSD, Arch Linux, Solaris, Haiku, Minix + +- util: fix the error message "usage: sleep seconds" on macOS bash 3.2 `#D1194` (reported by dylankb) 6ff4d2b +- decode: recover the terminal states after failing the default keymap initialization `#D1195` (reported by dylankb) 846f284 +- main (`ble-update`): use shallow clone `#D1196` 2a20d9c +- main (`$_ble_base_cache`): use different directories for different ble versions `#D1197` 55951d1 +- edit (`ble/builtin/read`): fix argument analysis with user-provided `IFS` in Bash 3.2 (reported by dylankb) `#D1198` 7411f06 +- global: fix subshell detection in Bash 3.2 `#D1200` ca8df8a +- syntax: workaround Bash-4.1 arithmetic bug `#D1201` f248c52 +- Makefile: fix "install" for BSD sed `#D1202` 32c2e1a +- term: support "tput" based on termcap `#D1203` `#D1204` 161af07 +- global: adjust for FreeBSD and Arch Linux `#D1205` 6ac5b8c +- global: workaround Solaris awk `#D1207` 74d438d +- util: support Haiku `#D1208` e3de373 + - ble/util/msleep: do not use `read -t time` for Haiku + - ble/term/stty: check available character settings + - init-cmap: check termcap settings for home +- util: support Minix `#D1209` 49e6457 + - ble/util/msleep: do not use `read -t time -u FD` in Minix + - ble-edit/prompt: does not abbreviate IPv4 address for `\h` + - Makefile: create directory `dist` for `make dist` + +## Internal changes + +- complete: isolate menu related codes `#D1029` 43bb074 +- global: use `builtin echo` explicitly `#D1035` a6232c2 +- decode: re-implement rlfunc2widget without fork `#D1063` d2e7dbe +- blerc: add descriptions `#D1064` d61b6af +- decode: decode mouse events `#D1084` 51fae67 +- history: move history related codes to `src/history.sh` `#D1119` 1bfc8eb e5b1980 + - history: move codes related to history prefixes and history searches to `history.sh` `#D1136` 1cda6ff 20024d2 + - history: use common "_ble_history_onleave" for different histories `#D1137` ec19d51 +- keymap/vi: deal with textarea local data properly `#D1123` 2ea7cfd +- edit: remove `ble-edit/exec:exec` `#D1131` 0cb9c6d +- global: distinguish exit status 147 and 148 `#D1141` d1a78fb +- global: follow bash syntactic changes on arithmetic command 16e0f0e +- decode: check `bind -X` first to store the original bindings `#D1179` 4057ff0 +- complete: resolve collision of flag chars with `shopt -s nocaseglob` `#D1186` 550fb14 +- color: change return variable of `ble/color/{,i}face2{g,sgr}` to `ret` `#D1188` 1885b54 +- global: workaround `shopt -s xpg_echo` `#D1191` e46f9a3 + + +# 2019-03-21 + +2019-02-09..2019-03-21 (#D0915...#D1015) 949e9a8...df4feaa + +## New features + +- auto-complete: support end at the end of line a374635 +- decode: replace builtin `bind` for `ble.sh` settings `#D0915` 90ca3be `#D0918` e0cdd15 + - decode: update mapping of rl-functions and widgets for vi_imap and vi_nmap `#D1012` 7fec4b6 + - decode: support `bind [-psPSX] [-quf arg]` `#D1013` 9265f8a +- edit: support C-x C-g, C-M-g for `bell` and `cancel` `#D0919` 2e83120 +- syntax: support `set +B` `#D0931` 12f80dd +- syntax: support aliased keywords `#D0936` 7054e28 +- complete: support `ble-sabbrev -m key=function` `#D0942` bcdf843 +- complete: support description of candidates `#D0945` `#D0946` 0fa73bf `#D0977` 96fe498 + - canvas: use ... instead of … when unicode is not available `#D0979` 51e600a + - canvas (`ble/canvas/trace`): support `opts=truncate:confine` `#D0981` 79916d2 +- complete: support insertion of ambiguous common part `#D0947` 3644a8e +- complete: support three levels of ambiguous matching `#D0948` 3644a8e +- complete: support menu item highlight of ambiguous matching `#D0949` 3644a8e +- complete: support menu pages `#D0958` ff43e01 a488e01 `#D0990` 32aeef0 + - menu-complete: show page numbers with `visible-bell` `#D0980` 6297e65 + - menu-complete: fix a bug that height of `menu` is too large (<= bash-4.1) `#D0983` 129a1f0 +- edit: support `bleopt rps1=` for the right prompt `#D0959` 90a8915 `#D0964` fa2a874 `#D0970` 87c8348 + - rps1: fix coordinate calculations for rps1 `#D0982` 129a1f0 + - canvas (`ble/canvas/trace`): fix a bug that `measure-bbox` does not work (<= bash-3.1) `#D0988` 7f880de + - canvas (`ble/canvas/trace`): fix a bug that `x1` and `y1` is not properly updated `#D0988` 7f880de + - edit: support `bleopt rps1_transient` `#D0993` 44edd38 + - edit: fix a bug that `rps1` is cleared on execution of the command `#D1003` 5780154 + - edit: erase trailing spaces after newlines when `rps1_transient` is enabled `#D1004` 5780154 + - edit: support multiline `rps1` (Note: still restricted to fit in lines of `PS1`) `#D1005` 5780154 +- complete: support "bleopt complete_menu_style=desc-raw" `#D0965` 1fd7a3e +- complete: support prior, next, home, end in `menu_complete` keymap `#D0966` b729d23 +- edit: support `bleopt prompt_eol_mark=$'\e[94m[ble: EOF]\e[m'` `#D0968` 6c8b52a +- complete: highlight active ranges of `menu-filter` `#D0969` 500f702 `#D0971` aae8b26 + - menu-filter: cancel `menu-filter` when the word ends `#D0974` 6ce2ad2 + - menu-filter: improve highlight `#D0975` b89f39f +- isearch: show progress bar using unicode chars `#D0978` 51e600a +- main: support `ble-reload` ef51490 +- complete: support `source:sabbrev` `#D0994` 5c9e579 +- complete: clear menu on C-g `#D0995` e0f93a2 +- vi_imap: support `bleopt keymap_vi_imap_undo=more` `#D0996` 50f8ad2 +- util: support `bleopt vbell_align` and `ble-color-setface vbell{,_flash,_erase}` for vbell `#D0997` 325883e + - vbell: fix a bug that garbages remain on short messages just after longer messages `#D1010` 3e9ff85 +- decode: support "bleopt decode_abort_char=28" `#D0998` b110cb9 +- complete: support `visible-stats` and `mark-directories` `#D1006` b389b3b +- complete: support `mark-symlinked-directories`, `match-hidden-files` and `menu-complete-display-prefix` `#D1007` fd66194 +- canvas: support `bleopt char_width_mode=auto` `#D1011` 3978df3 + +## Changes + +- prompt: support correct handling of escapes `#D0923` 22f9b56 +- util (`ble/util/sleep`): adjust delay `#D0934` `#D0935` 5fd5cd6 ad1208b 188cd98 +- complete: use candidates in menu if present `#D0939` 52eaf01 + - complete: fix a bug that menu-complete is disabled after `menu-filter` `#D0951` 08cba07 + - complete: fix a bug that wrong action is performed after `menu-filter` `#D0952` 08cba07 + - complete: fix a bug that extra TAB is needed to enter `menu-complete` `#D0956` aa6bd73 + - complete: fix a bug that candidates are not regenerated on function name completions `#D0961` bbea72e + - complete: fix a problem that the menu style is reset on `menu-complete` `#D0972` 47c28ff + - menu-filter: explicitly call `ble/complete/menu-filter` (<= bash-3.2) `#D0986` 1b14b11 +- syntax: allow variable assignment in arguments of `eval` `#D0941` 2f2f0eb +- highlight: do not highlight overwrite modes when mark is active `#D0950` 4efe1a9 + - highlight: disable `layer:menu_filter` (<= bash-3.2) `#D0987` 1b14b11 +- complete: disable `auto-complete` inside the active range of `menu-filter` `#D0957` +- util (visible-bell): truncate long messages to fit into a line `#D0973` e55ff86 +- edit: render prompt immediately on newline `#D0991` cdb8acb `#D1003` 5780154 +- syntax: detect syntax errors of `CTX_CMDX1` immediately followed by terminating keywords `#D1001` 7ea02b7 +- complete: improve support of `bind 'completion-ignore-case on'` `#D1002` 25ebc55 +- complete: preserve original path specifications on ambiguous completion `#D1014` a39d1ac +- complete: append `,` instead of ` ` after completion in brace expansions `#D1015` df4feaa + +## Fixes + +- main: workaround `set -evx` `#D0930` 698517d +- edit (widget `delete-horizontal-space`): fix a bug that spaces before the cursor is not removed `#D0932` 9290adb +- bleopt: fix a bug that false error messages are output on reload when `failglob` is set `#D0933` 64cdcba c62db26 +- decode: fix a bug that \\ cannot be input after reattach `#D0937` a46ada0 +- reload: fix a bug that `PS1` is lost on reload with `--attach=prompt` `#D0938` 1107ca8 +- main (`--attach=prompt`): workaround rewrite of `PROMPT_COMMAND` `#D0940` 863fd7b +- vi_nmap (`/`, `?`, `n`, `N`): fix search progress `#D0944` f20f840 +- complete: fix a problem of slow ambiguous filename matching in nested directories `#D0960` 7b3ee55 +- util: improve performance of `ble/{util/{mapfile,assign-array},string#split-lines}` (<= bash-3.2) `#D0985` ae176b2 `#D0989` 36b9a8f f199215 +- sabbrev: fix a bug that sabbrev is disabled (<= bash-3.2) `#D0985` 840af29 +- util (ble/util/msleep): suppress warnings from `usleep` `#D0984` 8e4180c +- util: fix a problem that C-d cannot be input in nested Bash 3.1 `#D0992` 88a1b0f +- edit: fix a bug of a redundant newline on `read -e` `#D0999` 700bc91 + +## Internal changes + +- [refactor] info: rename info type `raw` -> `esc` `#D0954` ac86f10 +- [refactor] do not use brace expansions for `VARNAMES` `#D0955` 711e7df +- [refactor] `ble-{highlight,complete,syntax}` -> `ble/*` 7aaa660 ae6be66 8ea903c +- [refactor] `ble-edit/info/.construct-text` -> `ble/canvas/trace-text` `#D0973` e55ff86 +- rename `ble/complete/action:*/getg` -> `ble/complete/action:*/init-menu-item` `#D1006` b389b3b + + +# 2019-02-09 + +2018-10-05 -- 2019-02-09 (#D0858..#D0914) 6ed51e7..949e9a8 + +## New features + +- color (`ble-color-setface`): support various spec such as SGR params `#D0860` 82fe96d `#D0861` 257c16d `#D0864` 2eaf2a9 +- syntax: `bleopt filename_ls_colors` に対応 `#D0862` c7ff302 `#D0863` 3c5bacf ec31aab +- vi_omap: support v, V, C-v `#D0865` 54942e0 `#D0866` a9a1638 `#D0867` d3d8ea3 `#D0868` eb848dc +- main: improve support of `[[ -o posix ]]` `#D0871` 07ae3cc `#D0872` 513c543 +- main: do not load ble.sh when bash is started by `bash -i -c command` `#D0873` fc23a6d +- main: support `ble-update` `#D0874` fc45be6 `#D0875` 0b50974 `#D0891` d010300 `#D0910` 4743c00 2dc3a3f +- vi_nmap: support C-d, C-u, C-e, C-y, C-f, next, C-b, prior `#D0886` +- isearch: use previous needle for empty string search `#D0889` 362fce3 +- vi_imap: add a function `ble-decode/keymap:vi_imap/define-meta-bindings` `#D0892` a21d22f +- progcomp: support `complete -I` for Bash 5.0 `#D0895` `#D0896` +- progcomp: support candidates which replace the original text before the cursor `#D0897` 41b8cbb +- progcomp: support `compopt -o nosort|noquote|plusdirs` `#D0898` cc48539 +- edit: support M-* `#D0899` 3fd7d6e +- edit: support M-g, C-x *, C-x g `#D0902` 41797c6 +- progcomp: support `COMP_WORDBREAKS` `#D0903` 7cfe425 +- complete: support completion of tilde expansion `#D0907` b4fc40c `#D0908` 9fafdb3 +- main: support `BLE_VERSION` and `BLE_VERSINFO` (suggested by cmplstofB) `#D0909` +- global: support `--help` for public functions `ble-*` (suggested by cmplstofB) `#D0911` 77d459d f4d03f6 1d191c7 1209ac6 `#D0913` 92d9038 + +## Changes + +- edit: change cursor position after u `#D0877` 9d5c945 +- edit: handle panel layouts `#D0878`--`D0882` 6a26894 `#D0888` c8e0d28 +- vi_nmap: support z z, z t, z b, z ., z RET, z C-m, z +, z - `#D0886` +- emacs: change M-m M-S-m from `beginning-of-line` to `non-space-beginning-of-line` f77f1aa +- bleopt: rename internal settings to `internal_{ignore_trap,suppress_bash_output,exec_type,stackdump_enabled}` fd042d8 +- vi_nmap: change the behavior of C-home, C-end to match with those of vim 8682f98 +- util (`ble/util/unlocal`): add workaround for Bash-5.0 `localvar_unset` `#D0904` 8677a71 +- sabbrev: quote key in printing definitions by `ble-sabbrev` `#D0912` 2994d80 + +### Fixes + +- info: fix a bug that coordinates calculation breaks with Japanese text `#D0858` 67c77dc +- syntax (`extract-command`): fix a bug that extraction of nested commands always fails `#D0859` c3270f6 +- complete: fix a bug that the settings `complete -c` does not work `#D0870` 1ca5386 82bb154 +- main: fix a bug that the determination of `_ble_base` fails when loaded as `source ble.sh` without specifying the directory of `ble.sh` 201deae +- util: `ble/util/assign` が正しい戻り値を返さないバグの修正 bd14982 +- util: `ble/util/assign-array` の入れ子の呼び出しで内容が混ざり合う問題の修正 bd14982 +- progcomp: fix a bug that bash-completion does not work properly due to wrong `COMP_POINT` `#D0897` 41b8cbb +- global: fix leak variables `#D0900` 244f965 `#D0906` b8dcbfe 9892d63 +- progcomp: fix a problem that completion functions can consume stdin `#D0903` 7cfe425 + +## Internal changes + +- global: properly quote rhs of `[[ lhs == rhs ]]` f1c56ab +- syntax: rename variables `BLE_{ATTR,CTX,SYNTAX}_*` -> `_ble_{attr,ctx,syntax}_*` 1fbcd8b (ref #D0909) + + +# 2018-10-05 + +2018-09-24 -- 2018-10-05 (#D0825..#D0857 6ed51e7) + +## 新機能 + - highlight: 変数代入の右辺及び配列要素の着色に対応 `#D0839` 854c3b4 + - nsearch: (非インクリメンタル)履歴検索に対応 C-x {C-,}{p,n} `history-{,substring-,n}search-{for,back}ward` `#D0843` e3b7d8b 0d31cd9 253b52e + - isearch: 検索前に選択状態でがあれば検索後に復元する `#D0845` 93f3a0f + - decode: 貼り付け時など大量の入力があった時に処理の進行状況を表示 `#D0848` c2d6100 + - decode: 貼り付け時などの高速化の為に一括の文字列挿入に対応 (`batch-insert`) `#D0849` 48eeb03 + - decode: `bleopt decode_isolated_esc=auto` でキーマップに応じて単独 ESC の取扱を切り替え `#D0852` 9b20b45 edd481c + - complete: `bleopt complete_{auto_complete,menu_filter}=` で自動補完・候補絞り込みの無効化に対応 `#D0852` 4425d12 + - vi: テキストオブジェクト単語の再実装 (reported by cmplstofB) `#D0855` 9f2a973 ad308ae 3a5c456 6ebcb35 + - vi: オペレータ `d` の特殊ルールに対応 `#D0855` fa0d3d3 + +## バグ・問題修正 + - decode: `ble-bind -d` に於いて `-c` 及び `-x` の引数の引用符が二重になっている問題の修正 `#D0850` + - auto-complete: 構文エラーが自動補完により解決される時 RET でコマンド実行が抑止されない問題の修正 `#D0827` daf360e + - highlight: `shopt -s failglob` で配列の指示初期化子がエラー着色される問題の修正 (reported by cmplstofB) `#D0838` d6fe413 + - complete: プログラム補完に対して曖昧補完が効かない時の対策 `#D0841` 713e95d + - isearch: ユーザ入力による割り込みで検索位置の記録に失敗していたバグの修正 `#D0843` + - isearch: キャンセル時に位置とマークが正確に復元されない問題の修正 `#D0847` + - isearch, dabbrev: 検索処理中にユーザが何か入力するまで現在行が更新されない問題の修正 `#D0847` + - decode: 未ロードのキーマップに対して `ble-bind -m -P` `ble-bind -m kmap -f kspecs -` が使えない問題の修正 66e202a + - auto-complete: C-j が単なる "確定" になっていたのを "確定して実行" に修正 `#D0852` 01476a7 + - edit: M-S-f, M-S-b を束縛するべきところ M-C-f, M-C-b を束縛している箇所を修正 `#D0852` c68e7d7 + - color: Bash 3.0 で算術式内の `<()` がプロセス置換と解釈される問題の対策 `#D0853` 520184d + - syntax: コメント上の単語が何故か除去されないバグの修正 (reported by cmplstofB) `#D0854` 641583f + - vi: Bash 3.1 及び 3.2 で C-d 受信の為のリダイレクトに失敗する問題の修正 `#D0857` d4b39b3 + +## 動作変更 + - sabbrev, vi_imap: `sabbrev-expand` を C-x ' ではなく C-] から束縛 `#D0825` e5969b7 + - core: `bleopt` に設定名を指定子て設定内容を表示させる時、設定名の存在を確認する `#D0850` 725d09c + - isearch: C-d で現在の選択範囲を削除する様に変更 `#D0826` c3bb69e `#D0852` db28f74 + - isearch: C-m (RET) で確定した時は選択範囲を解除する様に変更 `#D0826` c3bb69e + - decode: `ble-bind` のオプションを再構成 `#D0850` f7f1ec8 64ad962 + - decode: 組み込みコマンド `bind` を上書きして `ble.sh` の動作が阻害されない様に引数をチェックして実行 `#D0850` + - complete: autoload `ble-sabbrev` (`core-complete.sh`), `ble-syntax:bash/is-complete` (`core-syntax.sh`) `#D0842` df0b769 + - isearch: 編集関数 `isearch/accept-line` が RET 以外から束縛されていても RET を実行する様に変更 `#D0843` + - vi, [in]search: mark 名を整理 (`char`/`line`/`block`/`search` に接頭辞 `vi_` 付加し、新しい mark 名を `search` とする) `#D0843` + - edit: 関数名変更 `ble/widget/accept-single-line-or/accepts` → `ble-edit/is-single-complete-line` `#D0844` + - isearch: 空文字列で検索した時の振る舞いを再考 `#D0847` d05705e + - decode: 入力のキー復号の各種調整 `#D0850` dc013ad + - dabbrev: C-m, RET で展開終了、C-j, C-RET でコマンド実行 `#D0852` 01476a7 + +## 内部的変更 + - isearch, dabbrev: `ble/util/fiberchain` による再実装 `#D0843`, `#D0846` 2c695cf bdf8072 95268c1 + - edit, vi: 選択範囲の種類を表す mark 名を整理 a1a6272 + - edit: 関数名変更 `ble/widget/accept-single-line-or/accepts` → `ble-edit/is-single-complete-line` `#D0844` 63ec9fe + - refactor: ファイルの整理 5e07e7f 1a03da2 673bd1d 55c4224 9ce944c 9a47c57 25487a7 5679ffc b7291a7 + - refactor: 関数名・変数名の整理 `#D0851` d1b780c 9129c47 4d1181a + + +# 2018-09-23 + +2018-09-03 -- 2018-09-23 (#D0766..#D0824 8584e82) + +### 補完: 新機能 + - complete: 自動補完において履歴からの検索に対応 `#D0766`, `#D0769` `#D0784` (fix) + - complete: 自動補完時の M-f C-f 等に対応 `#D0767` + - complete: `"$hello"` などの引用符中のパラメータ展開がある場合でも補完に対応 `#D0768` + - complete: 配列要素代入の右辺での補完に対応 `#D0773` + - complete: ブレース展開の途中での補完に対応 `#D0774` + - auto-complete: `ble/widget/auto_complete/accept-and-execute` 対応 `#D0811` + - complete: 補完関係の設定をする為の load hook の追加 `#D0812` + - complete: 種類を指定した補完に対応 `#D0820` `#D0819` (fix) + - complete: 静的略語展開に対応 (`ble-sabbrev key=value` で設定) `#D0820` + - complete: 動的略語展開に対応 `#D0820` + +## 補完: バグ・問題点修正 + - complete: 一意確定した直後の補完ですぐにメニュー補完に入るバグの修正 `#D0771` + - complete: `function fun [` 直後の補完で `[\[` が挿入される問題の修正 `#D0772` + - complete: 曖昧補完で補完を実行しようとすると入力済みの部分が削除されるバグの修正 `#D0775` + - complete: 自動補完が起動しなくなっているバグの修正 `#D0776` + - complete: プログラム補完関数が `failglob` で失敗するとシェルが終了する問題の対策 (reported by cmplstofB) `#D0781` + - complete: `failglob` の時コマンド補完候補に `*` が含まれてしまう問題の修正 (reported by cmplstofB) `#D0783` + - complete: 候補一覧にて入力済み範囲の強調が絞り込みにより無効化されるバグの修正 `#D0790` + - complete: 自動補完を抜けた後のマーク位置が誤っているバグの修正 `#D0798` + - complete: `for a in @` や `do @` の位置の補完でエラーメッセージが表示されるバグの修正 `#D0810` + +## 補完: 動作変更 + - complete: 入力済み部分の評価方法の内部変更 `#D0777` + - complete: 自動補完の着色の変更 `#D0780` `#D0792` + - complete: プログラム補完で提供するコマンドライン (`COMP_*`) にて、補完開始点に単語の切れ目を入れる様に変更 `#D0793` + - auto-complete: C-RET で補完を確定してコマンド実行 `#D0822` + +## 他: 新機能 + - edit: `IGNOREEOF` に対応 `#D0787` + - edit: コマンド `exit` にて、ジョブが残っている場合はユーザに尋ねて終了 `#D0789`, `#D0805` (bugfix) + - term: 256色対応のない端末での減色の実装 `#D0824` + +## 他: バグ・問題点修正 + - isearch: 非同期検索ができなくなっていたバグの修正 + - color: `ble-color-setface` の遅延初期化順序のバグを修正 (reported by cmplstofB) `#D0779` + - decode: CentOS 7 で `LC_ALL=C.UTF-8` に対してエラーメッセージが出る問題の対策 `#D0785` + - edit: ジョブがある時の終了 C-d について `bleopt allow_exit_with_jobs` 対応 (request by cmplstofB) `#D0786` + - edit: Bash 3.* で C-d によるプログラム実行 (`ble-edit/exec:gexec`) が遅延するバグの修正 + - syntax: Bash 3.2--4.1 の算術式バグによる関数定義の構文解析に失敗する問題の対策 `#D0788` + - highlight: `region` レイヤーの着色範囲が改行を跨ぐ場合に既定の着色になるバグの修正 `#D0791` + - isearch: 空の検索文字列による一致に C-h で戻った時に全体が選択されるバグの修正 `#D0794` + - decode: `failglob` の時 `ble-bind -d` に失敗する問題の修正 `#D0795` + - edit: `command-help` のコマンド名抽出に失敗するバグの修正 (reported by cmplstofB) `#D0799` + - syntax: 履歴展開の置換指示子の解析が正確でない問題の修正 (report by cmplstofB) `#D0800` + - edit: Bash 3.0 で履歴展開 `:&` が使えない問題の修正 `#D0801` + - idle: 負の `sleep` を試みてエラーメッセージが出る問題の修正 `#D0802` + - bind: `ble-detach` 時に、Bash 3.0 の " のバインディングを破壊するバグの修正 `#D0803` + - edit: `ble-detach` 直後にコマンドラインに設定される `stty sane` が表示されない問題の対策 `#D0804` + - core: Bash-3.0 で補完候補がない場合にエラーメッセージが表示されるバグの修正 `#D0807` + - edit: コマンド実行中にウィンドウサイズが変更された時にプロンプトが表示されてしまう問題の解消 `#D0809` + - edit: widget 内で `read -e` を使用した時・`read -e` がタイムアウトした時に表示が乱れる問題の解消 `#D0809` + - edit: `read -e` でタイムアウトが効かないバグの修正 `#D0809` + - term: 16色の端末で色が化けるバグの修正 `#D0823` + +## 他: 動作変更 + - edit: `read -e` がキャンセル・タイムアウトによって終了した時に入力文字列を灰色で再表示 `#D0809` + - decode: キーマップの既定の初期化を最初の `ble-bind` 時に確認する様に変更 `#D0813` + - core: `ble/util/clock` 導入 `#D0814` + - edit: `ble-edit/read -e -t timeout` において、タイムアウトをより高精度で処理 (`ble/util/clock`) `#D0814` + - color: `face` が定義されていない時のエラーメッセージの表示方法を変更 `#D0815` + - edit: コマンド実行時に現在のカーソル位置より下に表示されている端末の内容を上書きする様に変更 `#D0816` + - edit: `accept-line` において、ちらつき防止の為、実際のコマンド実行が伴わない時は info の再描画を行わない `#D0816` + - edit: `ble/widget/history-expand-line` は C-RET ではなく M-^ から束縛される様に変更 `#D0820` + - edit: `ble/widget/magic-space` で履歴展開が行われなかった時、現在位置で静的略語展開を試みる様に変更 `#D0820` + - isearch: RET でコマンド実行ではなく検索を終了するだけに変更。C-RET でコマンド実行 `#D0822` + +## 他 + - Makefile: 依存ファイルを `.PHONY` target として出力 `#D0778` + - core: `ble/util/assign` をリエントラントに修正 `#D0782` + - 議論 complete: `#D0770` edit: `#D0796` vi: `#D0796` + - `blerc` の更新 + +## 以下は widget 名変更の一覧 + - `menu_complete/accept` → `menu_complete/exit` + - `auto_complete/accept` → `auto_complete/insert` + - `auto_complete/accept-on-end` → `auto_complete/insert-on-end` + - `auto_complete/accept-word` → `auto_complete/insert-word` + - `auto_complete/accept-and-execute` → `auto_complete/accept-line` + - `isearch/accept` → `isearch/accept-line` + + +# 2018-09-02 + +2018-07-29 - 2018-09-02 (#D0684..#D0765 0c28ed9) + +## 補完: 新機能 + - complete: 曖昧補完 `#D0707` `#D0708` `#D0710` `#D0713` `#D0743` (fix) + - complete: Readline 設定 `completion-ignore-case` に対応 `#D0709` `#D0710` + - complete: `ble/cmdinfo/complete:$command_name` 対応 `#D0711` + - complete: `path:...` などと入力した時の続きの補完に対応 `#D0715` + - complete: 引用符内のエスケープなどを適切に処理する `#D0717` + - complete: 自動補完に対応 `#D0724`, `#D0728`, `#D0734` & `#D0735` (vim-mode), `#D0766` (history) + - complete: カーソルの右側に補完結果の一部が含まれる時にスキップする機能 (`bind set skip-completed-text`) `#D0736` + - complete: 引用符の中で補完した時に引用符を閉じる機能 `#D0738` + - complete: 算術式内部での変数名の補完に対応 `#D0742` + - complete: 候補一覧表示の整列と着色 `#D0746` `#D0747` `#D0762` `#D0765` + - complete: menu-completion (メニュー補完) 対応 `#D0749` `#D0757` `#D0764` + - complete: menu-filter (候補絞り込み) 対応 `#D0751` + - complete: vi_cmap に於ける補完 `#D0761` + +## 補完: バグ修正・対策 + - complete: Cygwin でのコマンド名補完に於いて `.exe` の途中まで入力した時に正しく補完できない問題の修正 `#D0703` + - complete: `complete` によって登録されたプログラム補完に対して変数 `COMP_*` が正しく設定されない問題の修正 `#D0711` + - complete: `"` や `'` を含むファイル名の補完が正しくできない問題の修正 `#D0712` `#D0714` + - complete: 補完中に特殊キーを入力しても中断しない問題の解消 `#D0729` + - complete: クォートを認識しないプログラム補完関数に対する対策 `#D0739` + - complete: 引数の途中からのプログラム補完の不整合の修正 `#D0742` `#D0744` + - complete: パラメータ展開 `${var}` 直後からの補完が正しく実行できる様に修正 `#D0742` + +## 補完: 動作変更 + - complete: 補完候補生成直前の `shopt -s force_fignore` を参照して候補を制限する様に変更 `#D0704` + - complete: `FIGNORE` はエスケープされた挿入文字列に対してではなくて、候補文字列に対して判定する様に変更 `#D0704` + - complete: 関数名補完を `/` で区切られた単位で行う `#D0706` `#D0724` (曖昧一致の時は抑制) + - complete: パラメータ展開で厳密一致で一意確定の時は他の補完文脈を使うように変更 `#D0740` + - complete: パラメータ展開の補完後に挿入する文字を文脈に依存して変更 `#D0741` + - complete: パラメータ展開の直後に補完で挿入する際のエスケープを文脈に依存して変更 + - complete: プログラム補完による生成候補でディレクトリ名を省略 `#D0755` + +## 他: 新機能 + - edit (`RET`): 文法的に不完全のときに改行を挿入 `#D0684` + - core (`ble/util/idle`): 簡易タスクスケジューラの実装 `#D0721` + - core: add a function `ble/function#try` `#D0725` + - idle: `ble/util/idle` でバックグラウンドジョブ待ち機能を実装 `#D0731` `#D0745` (history bugfix) + - base: `--attach=prompt` 対応 `#D0737` + - base: 初回初期化時の順序の変更と過程の info による表示 + - decode: modifyOtherKeys 対応の改善 `#D0752` `#D0756` `#D0758` `#D0759` + - core (`ble/util/assing`): 第3引数以降にコマンドに対する引数を指定できるように変更 `#D763` + +## 他: バグ修正・対策 + - highlight: 単語着色が乱れるバグの修正 `#D0686` + - syntax: bash-3.2 以下で `_ble_syntax_attr: bad array subscript` のエラーが出るバグの修正 `#D0687` + - prompt: PS1 で \v が空文字列になるバグの修正 `#D0688` + - highlight: 上書きモードにおいてコマンドをキャンセルしても `disabled` レイヤーの着色が無視されるバグの修正 `#D0689` + - core (ble/term/visible-bell): 横幅の計算を誤っているバグの修正 `#D0690` + - decode: "set -o vi/emacs" で編集モードを切り替えた直後に "stty" が変になる問題の修正 `D0691` + - core: LANG=C とすると動かなくなる問題の対処 `#D0698` `#D0699` `#D0700` + - history: Cygwin で履歴の初期化に時間がかかる問題の対策 `#D0701` + - history: bashrc 読み込み直後に謎の待ち時間が発生する問題の対策 `#D0702` + - emacs: 貼り付け (bracketed paste) で文字列が二重に挿入されるバグの修正 `#D0720` + - main: POSIXLY_CORRECT が設定されている時の対策 `#D0722` `#D0726` `#D0727` + - edit: POSIXLY_CORRECT を用いた組み込みコマンド上書き対策 `#D0722` + - decode: 連想配列に依る実装のバグを修正し bash-4.0, 4.1 においても連想配列を使用 '#D0730' + - decode: `ble-bind -c` でシェルの特殊文字を含むコマンドが正しく実行できないバグの修正 + - edit: 履歴項目の数が倍増するバグの修正 `#D0732` + - vi: キーボードマクロで特殊キーが再生されないバグの修正 `#D0733` + - isearch: 現在位置の表示時の 0 除算のバグの修正 + - vi: `!!` をキャンセルしても操作範囲を示す着色が消えないバグの修正 `#D0760` + +## 他 + - refactor: `#D0725` `#D0750` `#D0753` `#D0754` + - bash-bug: Bash に対するバグ報告 `#D0692` `D0695` `D0697` + + +# 2018-03-15 + +2018-03-15 (#D0644..#D0683 7d365d5) + +## 新機能 + - undo: vi-mode `u` `` `U` (`#D0644` `#D0648`); emacs `#D0649`; `#D0662` + - vi-mode (nmap/xmap): `f1` で `command-help` 呼び出し + - vi-mode (nmap): `C-a` `C-x` 対応 (nmap `#D0650`, xmap `#D0661`) + - vi-mode (operator): 各種オペレータ対応 `#D0655` (`gq`, `gw` `#D0652`; `!` `#D0653`; `g@` `#D0654`) + - vi-mode (operator): 追加入力のあるオペレータで作用対象を着色 `#D0656` + - vi-mode (registers): registers `"[0-9%:-]` `#D0666` `#D0668`, `:reg` `#D0665` + - vi-mode (smap): 選択モード `#D0672` + - emacs: 主要なコマンドで引数に対応 `#D0646` + - emacs: 複数行モードの時にモード名を表示。引数も表示。 `#D0683` + - edit: `safe` keymap + - edit: 絵文字の文字幅 `bleopt emoji_width=2` `#D0645` + - core: 誤った `PATH` に対する対策 `#D0651` + +## 動作修正 + - vi-mode (nmap/xmap/omap ``): 引数を無視するように変更 + - vi-mode (map `/` `?` `n` `N`): 検索の一致の仕方を vim と同様のものに変更 `#D0658` + - vi-mode (omap): `g~?` で検索して一致した範囲まで大文字・小文字を切り替えるように変更 `#D0659` + - vi-mode (map): 最終行付近で `+` `_` `g_` などを呼び出したときの振る舞いを vim と同様のものに変更 `#D0663` + - vi-mode (xmap): テキストオブジェクト `[ia]['"]` の xmap での正しい振る舞い `#D0670` + - vi-mode (nmap): `Y` で行頭に動かないように変更 `#D0673` + - vi-mode (xmap): 矩形範囲抽出の効率化 `#D0677` + - core: `ble.sh` ロード時間の改善 `#D0675`, `#D0682`, (遅延読込 `#D0678` `#D0679` `#D0680`, 裏で履歴読込 `#D0681`) + +## バグ修正 + - vi-mode (omap): `cw` や `y?` が動かなくなっていたバグの修正 + - vi-mode: マクロで記録される内容に空白が挿入されるバグの修正 `#D0667` (テスト追加 `#D0669`) + - vi-mode: 行指向の貼り付けが動かなくなっていたバグの修正 `#D0674` + - complete: コマンド名によって第一引数の補完が正しく実行されないことがあるバグの修正 `#D0664` + - syntax: ヒアストリングで $ret を指定するとエラーメッセージが現れたバグの修正 `#D0660` + - syntax: bash-3.0 でコマンドの着色が常にエラーになっていたバグの修正 `#D0676` + - decode: ble-decode-unkbd があらゆる文字について ESC を返す様になっていたバグの修正 `#D0657` + - Makefile: 削除したファイル isearch.sh が要求されるバグの修正 + - Makefile: 最新の gawk で動かないバグの修正 + + +# 2017-12-03 + +## 新機能 + - edit, vi-mode: bracketed paste mode に対応 `#D0639` + +## 動作修正 + - core: 端末の状態設定・復元とカーソル形状の内部管理 `#D0638` + - 外部コマンドを呼び出すときに既定のカーソル形状にする + - 外部コマンドから戻ったときにカーソル形状を復元する + - syntax (extract-command): より下の構文階層にいてもコマンドを見つけられるように修正 `#D0635` + これによりリダイレクトの単語などの上でも `command-help` (nmap `K`, emacs `f1`) が動くように。 + - syntax (チルダ展開): 変数代入の形式を持つ通常単語内部でのチルダ展開に対応 `#D0636` + - syntax: [...] 内部でチルダ展開が起こったとき [...] は意味を失う `#D0637` + - vi-mode (cmap ``): imap `` と同様に vim の動きに変更 + +## バグ修正 + - complete: 補完候補がない時に空文字列で確定するバグの修正 `#D0631` + - complete, highlight: `failglob` 周りのバグの修正 (3) `#D0633` `#D0634` + - vi-mode: `ret` グローバル変数が汚染されていたバグの修正 `#D0632` + - highlight: 読み取り専用の変数名を入力するとエラーメッセージが出るバグの修正 + - decode: `__defchar__` から呼び出された widget が 125 を返したとき + `__default__` から呼び出された widget にキー列が渡されないバグの修正 + - core: set -u にすると全く動かないバグの修正 `#D0642` + - edit: ble.sh ロード中に `read -e` が動かないバグの修正 `#D0643` + + +# 2017-11-26 + +## バグ修正 + - general: failglob で問題が生じるバグの修正 `#D0630` + - keymap/vi (nmap q): bash-3.0 で動かなかったバグの修正 + - keymap/vi (cmap): C-d で終了してしまうバグを修正 `#D0629` + - edit (ble/widget/command-help): エイリアスの上でヘルプを実行しようとすると無限ループになるバグを修正 + - edit (ble/util/type): "-" で始まる名前のコマンドの種類の判定に失敗し着色されなかったバグの修正 + - complete: 変数代入の右辺やリダイレクト先で補完できないことがあるバグの修正 `#D0627` + - complete: 補完する単語にパラメータ展開が含まれるとき ble.sh のローカル変数の値を参照している問題の修正 `#D0628` + +## 動作変更 + - bind/decode: 孤立 ESC の読み取り方法を変更。 で単体 が入力されるように修正 + - bind/decode: input_encoding=C の時の孤立 ESC および C-@ の読み取りに対応 + - complete: 重複して列挙される候補を統合する `#D0606` + - complete: 厳密一致するディレクトリ名が何故かコマンド候補に現れる問題の修正 `#D0608` + - edit (command-help): 幾つかの組み込みコマンド・予約語について man bash の正しい位置に移動するように修正 `#D0609` + - edit (command-help): クォートなどを除去してからコマンドのヘルプを探索するように変更 `#D0610` + - core: 条件コマンドの比較で右辺をクォートし忘れていた箇所を修正 `#D0618` + - highlight: `shopt -s failglob` の時、失敗する単語にエラー着色をする `#D0630` + +## 構文解析変更 + - syntax: `> a.txt; echo` は構文エラーではないことに対応 `#D0591` + - syntax: 変数代入・リダイレクトの後では予約語は意味を失いコマンドとして扱われることに対応 `#D0592` + - syntax: `time` や `time -p` は構文的に正しいことに対応 `#D0593` + - syntax: `echo $(echo > )` などの `>` の引数がない構文エラーにより `$()` が閉じず別の構文エラーを引き起こしていたのを抑制 `#D0601` + - syntax: `function hello (())` は bash-4.2 未満では構文エラーとして扱うように変更 `#D0603` + - syntax: `time -p -- command` を独立した文脈で解析するように変更 `#D0604` + - complete: これにより `time` の引数のコマンド補完ができなかった問題は解消した `#D0605` + - syntax: extglob 内部のプロセス置換 `@(<(echo))` に対応 `#D0611` + - syntax: `[...]` によるパターンの解析に対応 `#D0612` + - syntax: 変数代入の右辺にある不活性になった extglob の入れ子 `@(@())` も不活性にする `#D0613` + - syntax: `shopt -u extglob` の時でも `*` や `?` を着色する `#D0616` + - syntax: ブレース展開の着色に対応 `#D0622` + - syntax: チルダ展開の着色に対応 `#D0626` + - syntax: `for var in args...` の `args` におけるリダイレクトの禁止 `#D0623` + - highlight: ヒアストリングの場合はパス名展開・ブレース展開を行わない `#D0624` + - highlight: リダイレクト先ファイル名が複数語に展開されたらエラー着色 `#D0625` + +## 構文解析修正 + - syntax: `$({ echo; })` や `$(while false; do :; done)` において `}`, `done` 等の後にコマンドがないと構文エラーになっていたバグの修正 `#D0593` + - syntax: `-` で始まる名前のコマンド・関数名が正しく着色されないバグの修正 `#D0595` + - syntax: `if :; then :; fi $(echo)` などの構文エラー着色が実行されないバグの修正 `#D0597` + - syntax: 先読みによる不整合が起こるバグの修正・先読みの枠組みの整備 `#D0601` + - プロセス置換周りで部分更新により不整合が生じるバグを修正 + - `function hello (())` としておいて `) (` を挿入して `function hello () (())` にすると不整合が生じるバグを修正 `#D0602` + - syntax: 途中で `shopt -u extglob` にしても `_ble_syntax_bashc` が更新されないバグの修正 `#D0615` + + +# 2017-11-09 + +## 新機能 + - vi-mode (nmap): `*` `#` `qx...q` `@x` + - vi-mode (cmap): 履歴 + - core: bleopt 変数 `pager` (既定値 `''`) に対応。`ble.sh` の使うページャとして `${bleopt_pager:-${PAGER:-適当に探索}}` を使用する。 + - vi-mode (nmap `K`): `ble/cmdinfo/help:$cmd`, `ble/cmdinfo/help` に対応。 + +## バグ修正 + - vi-mode (cmap ``): コマンドラインモードをキャンセルするキーマップが `bell` で上書きされていたバグの修正 + - decode: `shopt -s failglob`, `shopt -s nullglob` で `unset` が正しく動かないバグの修正 + - vi-mode (nmap `K`): `MANOPT=-a` で操作できなくなるバグの修正 + +## 動作変更 + - edit (`ble/widget/command-help`), vi-mode (nmap `K`): カーソル位置のコマンドの `man` を表示するように変更 + - base: キャッシュディレクトリ・一時ディレクトリの決定で、それぞれ `XDG_CACHE_HOME`, `XDG_RUNTIME_DIR` を参照するように変更 + - Makefile: インストール先ディレクトリで、`XDG_DATA_DIR` を参照するように変更 + - isearch: 実際に必要になるまでコマンド履歴のロードを遅延するように変更 + - vi-mode (nmap `K`): 組み込みコマンド・キーワードは `man bash` を表示する。 + - vi-mode (nmap `K`): シェル関数は関数定義を表示する。 + + +# 2017-11-05 + +## 新機能 + - vi-mode (exclusive motion): `:help exclusive-linewise` 特別規則 (exclusive -> inclusive, exclusive -> linewise) に対応 + - vi-mode (omap): `C-c` `C-[` で明示的にキャンセル + - vi-mode: keymap/vi_test.sh 追加。regression が酷いので vi-mode の動作テストを自動化 + - complete: bleopt 変数 `complete_stdin_frequency` (既定値 `50`) 追加 + +## 動作変更 + - vi-mode (nmap `e`, `E`): 移動先が最終行の最後の文字の空白のとき、omap なら bell を鳴らさないように変更 + - vi-mode (omap/xmap ``, ``, ``): 改行の数え方を変更 + - vi-mode (nmap `cw`, `cW`): 単語の最後の文字、および空白の上にいるときの振る舞いの変更 + - decode (ble-bind): `ble-bind -D` でキーマップの内部状態も出力するように変更 + - term: `_ble_term_SS` の既定値を空文字列に変更 + - complete: `shopt -s no_empty_cmd_completion` では補完を (コマンドの補完以外も) 全く行わないように変更 + - edit (ble/widget/exit): 編集中の文字列が残っているとき、灰色で再描画してから exit するように変更 + + +# 2017-11-03 + +## 破壊的変更 + - vi-mode (widget): 名称変更 blw/widget/vi-insert/* → ble/widget/vi_imap/* + - vi-mode (bleopt 変数): 名称変更 bleopt keymap_vi_normal_mode_name → keymap_vi_nmap_name + - vi-mode (imap): vi-insert/magic-space 廃止。代わりに magic-space を直接用いる。 + +## 新機能 + - vi-mode (xmap): `o` `O` + - vi-mode (nmap): `.` 取り敢えず完成? + - vi-mode (xmap/nmap): `gv` + +## バグ修正 + - vi-mode (mark `` `x `` `'x`): オペレータが呼び出されないバグの修正 + - vi-mode (txtobj `[ia]w`): 英数字と _ の連続ではなく英字と _ だけの連続を単語としていたバグの修正 + - vi-mode (imap): `{count}i...` において `x` `x` が正しく繰り返されなかったバグの修正 + - vi-mode (imap): `{count}i...` において繰り返しが有効になっていたバグの修正 + - vi-mode (nmap `{N}%`): 目的の行に移動しなくなっていたバグの修正 + - vi-mode (nmap `_`): `d_` 及び `d1_` が linewise になっていないバグの修正 + - vi-mode (xmap `I` `A`): 動かなくなっていたバグの修正 + - vi-mode (xmap `I` `A`): 実行後のカーソル位置がずれていたバグの修正 + - vi-mode (xmap `I` `A` `c` `s` `C`): 矩形挿入の後の編集範囲 `` `[`] `` から1行目が抜けているバグの修正 + - vi-mode (xmap `?`): 検索 `?` が operator `g?` になっているバグの修正 + - vi-mode (xmap `/` `?` `n` `N`): ビジュアルモードの選択範囲が検索の一致範囲で上書きされるバグの修正 + - vi-mode (xmap `/` `?` `n` `N`): 現在の履歴項目の中で一致しない時、別の履歴項目にビジュアルモードのまま移動するバグの修正 + - lib/vim-surround (nmap `cs` `cS`): nmap `.` 対応時に引数とレジスタが効かなくなっていたバグの修正 + - lib/vim-surround (xmap `S`): `v` によるビジュアルモードで改行が前後に挿入されていたバグの修正 + +## 動作変更 + - vi-mode (imap ``): vim の単語区切り (`w`) による削除に変更 + - vi-mode (nmap `[rRfFtT]x`): `` でキャンセルするように変更 + - vi-mode (nmap `w` `b` `e` `ge`): 非英数字 ASCII の連続と、Unicode 文字の連続 をそれぞれ別の単語と扱うように変更 + - vi-mode (xmap `c` `s` `C`): `I`, `A` と同様の矩形挿入に対応 + + +# 2017-10-30 + +## 破壊的変更 + - vi-mode: キーマップの名称変更 vi_command -> vi_nmap, vi_insert -> vi_imap + - vi-mode: 一部の widget の名称変更 + - ble/widget/{no,}marked -> ble/widget/@{no,}marked + - ble/widget/vi-command/* (一部) -> ble/widget/vi_nmap/* + - vi-mode: ble/widget/vi-insert/@norepeat 廃止。別の方法 (_ble_keymap_vi_imap_white_list) を用いる。 + +## 新しい機能 + - vi-mode (nmap): . は実装途中 (現状 nmap/omap におけるオペレータ経由の変更のみ記録) + - vi-mode (mode): bleopt 変数 `term_vi_[inoxc]map` + - decode: 孤立 ESC のタイムアウトに対応 + - edit: shopt -s histverify, shopt -s histreedit に対応 #D0548 + +## バグ修正 + - vi-mode (xmap): `p`, `P` が正しく動作しないバグを修正 + - vi-mode (imap): 挿入モードに入るときに指定した引数 (繰り返し回数) が常にキャンセルされていたバグの修正 + - vi-mode (txtobj; nmap `gg`, `G`): レジスター指定が消失していたバグの修正 + - lib/vim-surround (nmap ds): 引数が内部使用のオペレータ `y`, `d` に正しく渡っていなかったバグの修正 + - prompt: `PROMPT_COMMAND` で設定された `PS1` が永続化されていなかったバグの修正 + - decode: bind -x で曖昧な登録があって bash_execute_unix_command エラーになっていた問題の修正 #D0545 + - decode: `vi.sh`, `emacs.sh` において `default.sh` が多重に呼び出されていた無駄の修正 #D0546 + - core: bash-3.0 において ble/util/assign が壊れていたバグの修正 + +## 動作変更 + - vi-mode (nmap `x`, ``, `s`, `X`, `C`, `D`): support registers + - source ble.sh において無事にロードされたときに終了ステータス 0 を返すことを保証 + - widget marked, nomarked を @marked, @nomarked に改名。元の widget は非推奨 (削除予定) + - ble.sh: Linux 以外でも (`readlink -f` が動かないときも) シンボリックリンクを通したロードに対応 #D0544 + + +# 2017-10-22 + +## 新機能 + - vi-mode (mark): `mx` `x 'x (`x` = [][<>`'a-zA-Z"^.]) + - vi-mode (nmap): `gi` `` (空文字列のとき exit) `"x` (registers) + - vi-mode (xmap): `I` `A` `p` `P` `J` `gJ` `aw` `iw` + - lib/vim-surround.sh: nmap `yS` `ySS` `ySs` `cS`, xmap `S` `gS` + - タブ・インデントの制御 + - bleopt tab_width= (タブの表示幅) + - bleopt indent_offset=4 (`>` や `<` のインデントの幅) + - bleopt indent_tabs=1 (`>` や `<` のインデントにタブを用いるかどうか) + - 既定のインデントの幅は 8 から 4 に変更 + +## バグ修正 + - vi-mode: 挿入モードに繰り返し回数を指定したとき `ESC ?` も一緒に繰り返されていたバグの修正 + - vi-mode: オペレータ `g?` が動かなくなっていたのを修正 + - vi-mode (nmap `/` `?`): 検索対象の入力中に `C-c` してもキャンセルされないバグの修正 + - vi-mode (xmap `r` (visual char/line)): 全体を置換したものが選択範囲に挿入されていたバグの修正 + - vi-mode (xmap `$`): 行末で `$` をしたときに表示が更新されないバグの修正 + - vi-mode (motion `0`): オペレータを認識していなかったバグを修正 + - isearch: 一度一致したら同じものに一致し続けるバグを前回の `/` `?` `n` `N` 対応の際に埋め込んでいたので修正 + - complete: `complete -F something -D` で登録されている補完関数が正しく実行されていなかったのを修正 + - prompt: PROMPT_COMMAND によって設定された PS1 を拾っていなかったバグを修正 + - textarea: 端末の下部で複数行編集時に `C-z` (`fz`) すると描画高さを正しく確保できていないバグの修正 + +## 動作変更 + - vi-mode (operator `<` `>`): Visual block での正しい振る舞い + - vi-mode (nmap `:` `/` `?`): 文字列入力中に空文字列で DEL or C-h することでキャンセルできるように修正 + - vi-mode (nmap `J`, `gJ`): 引数に対応 + - vi-mode (nmap `p`): 最後の行で挿入するときに余分な行が入らないように修正 + - vi-mode (xmap `Y` `D` `R`): 記録するビジュアルモードの種類を修正 + - lib/vim-surround.sh: タグ名入力中に '>' で確定するように修正 + - widget (.SHELL_COMMAND): 実行しないコマンドに色がついているのはややこしいのでグレーアウトする様に変更 + +## 他の変更 + - magic-space: 空白を挿入してから履歴展開していた順番を逆転 + +---- + +# 2015-03-06..2017-10-09 (Git Commit Log) + +## 2017-10-09 +* keymap/vi: support specialized handling of keys for cmap + - vi (nmap / ?): treatment of C-h and DEL on input of search targets + - vim-surround.sh (nmap ys cs): treatment of > on input of tag names + +## 2017-10-07 +* keymap/vi_xmap: add tentative text object implementation +* lib/vim-surround: accept user input of tag names with the replacement being t, T, < +* keymap/vi_command: support search / ? n N + +## 2017-10-05 +* keymap/vi_command: fix behavior of yy, dd, D, etc. on the last line with count arg +* keymap/vi_xmap: support x C D X R Y +* keymap/vi_xmap: support r s +* keymap/vi-command: support : and few commands +* ble-core: fix a bug that conditions for assotiative arrays are inverted + +## 2017-10-04 +* [refactor] ble-edit (ble-edit/render -> ble/textarea): support "ble/textarea#{save,restore,clear}-state" +* [refactor] ble-edit (text/update/positions -> ble/textmap): support any time updates of text positions +* keymap/vi_command: support _ g0 g g^ g$ g gm go g_ ge gE +* check: fix "local lines=()" in vi_digraph.sh and update "check" +* (ble-highlight-layer:region): fix a bug that the "region" face is sometimes applied to intervals between selections + +## 2017-10-03 +* keymap/vi (visual mode): support previous selections +* keymap/vi (nmap p, P for block): convert HTs under inserting points to spaces +* (ble-decode-key/dump): fix a bug that pathname expansions internally occurred +* ble-core: add ble/string#split-lines +* keymap/vi (visual block): improve performance of block extraction +* keymap/vi_command (linewise operator d): go to the previous line on deleting the last line +* keymap/vi (operator d c g~ gu gU g?): support block +* keymap/vi (nmap p, operator y): support block + +## 2017-10-02 +* keymap/vi_xmap: support count arg for operators +* keymap/vi_command: fix a bug that linewise < > operators produce an error +* keymap/vi_command: perform EOL fix on history traveling with normal mode +* keymap/vi_xmap: support block selection + +## 2017-10-01 +* keymap/vi_xmap: support visual mode swithing +* keymap/vi: support visual mode + +## 2017-09-28 +* ble-edit: add a condition to accept-single-line-or +* keymap/vi_command: support gj gk + +## 2017-09-27 +* ble-edit: restore BASH_REMATCH +* ble-edit: do not execute pasted multiline texts +* ble-edit: support scrolling +* bleopt: implement value checking on assignment + +## 2017-09-24 +* ilb/vim-surround.sh: do not refer bleopt "vim_surruond_{char}" for digit replacement char +* keymap/vi: show configurable string (defaulted to be ~) on the normal mode +* keymap/vi_command: support % N% +* keymap/vi_command: support indentation for o O +* keymap/vi_command: reimplement text object is as +* keymap/vi (linewise-range.impl): fix a bug that the line ranges are reverted, fix behavior to go to nol + +## 2017-09-23 +* keymap/vi_command: support text object ip ap +* keymap/vi_command: support text object is as +* keymap/vi_insert: support indentation for C-m, C-h, DEL +* ble-edit: erase garbage input echo during initialization of ble.sh +* ble-edit (bleopt char_width=emacs): fix a bug that U+2000 - U+2600 are always treated as width 1 +* keymap/vi: fix a bug that selection is not cleared on entering the normal mode during isearch + +## 2017-09-22 +* keymap/vi_command (r, gr): highlight on waiting replacement +* keymap/vi_command: support text object it at + +## 2017-09-20 +* ble-edit/exec: fix handling of $? and $_ and add a workaround for "set -o verbose" + +## 2017-09-18 +* lib/vim-surround: support configurable replacements with bleopt vi_surround_45:=tmpl vi_surround_q:=tmpl +* (bleopt): support the form "var:=value" which skips existence checks of variables +* lib/vim-surround: support ds cs +* ble-decode: fix stty settings for command execution +* keymap/vi_omap: fix mode transition from vi_omap to vi_insert +* [m] lib/vim-surround: remove redundant codes + +## 2017-09-17 +* keymap/vi (text object i[bB]): exclude newlines around the range and transform to linewise +* [m] keymap/vi (text object i"): behave the same as a" with arg >= 2 specified +* [m] keymap/vi: rename functions +* keymap/vi_insert: change the default of C-k to kill-forward-line +* keymap/vi_command: support digraphs for arg of f, F, t, T, r, gr +* keymap/vi: support digraph +* (ble-bind): support "ble-bind -@f kspec command" +* (ble-decode-kbd): fix a bug that keys "*" and "?" cannot be properly encoded + +## 2017-09-16 +* keymap/vi_command (operators): fix a bug that arg is cleared before the use +* lib/vim-surround: support b B r a C-] C-} as replacements +* keymap/vi: rename operator flag for < and > +* (ble/widget/self-insert): explicitly return 0 +* ble-decode (ble-decode-key/.invoke-command): propagate exit status of widgets +* keymap/vi_omap: decompose M-* +* add ilb/vim-surround.sh, support operator "ys" and "yss" +* keymap/vi: add new keymap "vi_omap" + +## 2017-09-15 +* keymap/vi_command: support operators < > +* keymap/vi_command: support g~~ guu gUU g?? +* keymap/vi_command: handle meta flags of input keys +* keymap/vi_command: support ~ +* keymap/vi_command: fix the text object "aw" +* keymap/vi_command: rename widgets + +## 2017-09-13 +* ble-edit/info: fix cursor position calculations in rendering +* (ble-form/panel#set-height-and-clear.draw): fix to add lines on an increased height +* keymap/vi_command: support text objects [ia][][{}()<>bBwW'"`] + +## 2017-09-12 +* add ble-form.sh and introduce ble-form/panel +* ble-edit: rename functions +* keymap/vi_command: support text object iw +* ble-edit/info: show default contents at the end of bind +* ble.pp: fix PATH if standard utilities are not found on load +* keymap/vi_command: add operators g~ gu gU g? +* keymap/vi_command: refactor ydc operators +* ble-decode (ble-bind): fix check of redundant "ble/widget" prefix + +## 2017-09-11 +* ble-edit (ble/widget/clear-screen): show info after the clear +* keymap/vi_command (C-o): fix cusor positions after first-non-space commands +* keymap/vi: fix the initial position of "-- INSERT --" +* keymap/vi_command: support C-o +* ble-core: add string functions +* keymap/vi_insert: change mode names on "insert" +* keymap/vi: show current modes in the info area +* ble-edit: support ble-edit/info/set-default +* ble-edit: clear info on exit +* memo.txt: add comments from @B-bar +* ble-decode: check existence of keymaps + +## 2017-09-10 +* keymap/vi_command: fix C D +* keymap/vi_command: support arg for insert modes +* ble-decode: fix ble-decode-key and support __before_command__ and __after_command__ +* keymap/vi_command: update bindings and support z{char} clear screens + +## 2017-09-09 +* keymap/vi_command: fix R and support gR +* keymap/vi_command: support f F t T ; , +* ble-edit: suppress unnecessary history loads on history-next +* ble.pp: support loading ble.sh from inside of functions +* keymap/vi_command: support J gJ o O +* fix leak variables +* keymap/vi_command: support r gr + +## 2017-09-08 +* keymap/vi_command: fix mode change widgets and support gI +* keymap/vi_command: support G H L gg +* keymap/vi_command: fix behavior of [dcy][-+jk] +* keymap/vi_command: update memo.txt and support K +* keymap/vi_command (RET, C-m): fix to behave as + if the line contains LF +* keymap/vi_command: support w W b B e E + +## 2017-09-07 +* keymap/vi_command: support s S +* ble-edit: rename ble-edit/text/getxy -> ble-edit/text/getxy.out +* keymap/vi_command: support C-h DEL SP +* (ble/widget/vi-command/{forward,backward}-line): fix +* keymap/vi_command: return to insert mode on accept-line +* keymap/vi_command: support | +* keymap/vi_command: clear arg on mode changes +* keymap/vi_command: support I +* keymap/vi_command: support Y D C +* keymap/vi_command: support x X +* keymap/vi_command: support p P +* keymap/vi_command: check unknown flags +* keymap/vi_command: support A +* keymap/vi_command: add basic bash operations +* keymap/vi_command (+ -): travel history +* keymap/vi_command: support ^ + - $ +* keymap/vi_command: fix behavior of "yh" and "yl" +* keymap/vi_command: support dd yy cc 0 +* ble-edit: partial revert 35098f0 where necessary ble-edit/history/load calls were removed +* ble-edit (ble/widget/{for,back}ward-line, etc): fix a bug that the destination cursor pos was based on possible old layout +* keymap/vi.sh: support hjkl +* ble-edit: remove redundant ble-edit/history/load calls +* (ble/widget/.bell): fix exit status + +## 2017-09-06 +* check: add check codes for bashbug workarounds +* (ble-edit/text/get*): check if the cached text positions are up to date + +## 2017-09-05 +* keymap/vi: support mode switching +* (ble/widget/.goto-char): simplify +* (ble-edit/load-keymap-definition): workaround for bash-3.0 +* (ble-decode-key): accept multiple keys +* ble-edit: support the value bleopt_default_keymap=vi + +## 2017-09-04 +* add keymap/vi.sh and switch keymap on editing mode change +* ble-decode: split and refactor external settings +* ble-decode: support bleopt_default_keymap=auto + +## 2017-09-03 +* ble.pp: remove the check enforcing "set -o emacs" +* ble-decode (ble-decode-{attach,detach}): support attached editing modes +* ble-decode: update spacing of an awk script +* ble.pp: fix "set -o emacs" checks +* ble-syntax: fix a bug that here strings are interpreted as here documents +* complete.sh: suppress error messages on internal compgen calls + +## 2017-08-30 +* ble-edit: check editing mode + +## 2017-08-19 +* cmap/default.sh: disable modifier keys "CAN @ ?" which is ambiguous with "C-x C-x" +* ble-edit: support "bleopt delete_selection_mode=1" + +## 2017-06-09 +* ble-syntax: workaround for the bash-4.2 arithmetic bug resulting in segfaults + +## 2017-05-20 +* ble.pp: guard double ble-attach + +## 2017-04-21 +* bind.sh: bash-4.4 workaroud: fix a bug C-x ? is not bound + +## 2017-03-17 +* README: update color settings and translate tips +* README: add a hint on editing multiline commands + +## 2017-03-16 +* (ble-color-gspec2g): change to recognize 0 padded color indices as decimal numbers +* README: bump release 0.1.7 + +## 2017-03-15 +* README: update heading syntax of GitHub flavored markdown + +## 2017-03-13 +* suppress error messages caused by incorrect user LC_*/LANG values + +## 2017-03-06 +* complete: fix a bug that backquotes, newlines and tabs in completed words were not escaped + +## 2017-03-05 +* ble.pp ($_ble_init_original_IFS): \minor, fix unset +* ble-core.sh ($ble_util_upvar_setup): add "local ret" declartion +* (ble-syntax:bash/ctx-heredoc-word): use ctx-redirect to read keyword of here documents +* ble-color: move deprecated "ble-highlight-layer:adapter" codes to layer/adapter.sh as a sample +* save/restore IFS to protect ble functions from user's IFS +* memo.txt: assign numbers of the form "#D????" to old items +* (ble-syntax:bash): :new: support "select var in ..." +* (ble-syntax:bash): fix a recent bug that semicolons after "for (())" was not allowed +* (ble-syntax:bash): :new: support here documents + +## 2017-03-04 +* (ble-syntax:bash): fix a bug that semicolons are not allowed after "}", "fi", "done", etc. +* (ble-syntax:bash): support the construct with the form "for name do ...; done" +* (ble-syntax:bash): accept "do" immediately after "for (())" without semicolons +* Makefile: add a prerequisite "install" +* (ble-edit-attach): output CR before showing prompt + +## 2017-03-02 +* (ble-syntax:bash): allow `then, elif, else, do' after `}, etc.' +* (ble-syntax:bash): improve checks of quotes in parameter expansion and arithmetic expansion + - change so that quotes are processed always in the syntax level + - introduce new nest-types, ntype='$((' and ntype='$[', for CTX_EXPR (arithmetic expressions) + - introduce a new nest-type ntype='NQ(' to support nesting in quote-removal-less contexts + - fix so that quotes '...' in parameter expansions such as `${var#text}' are always enabled +* \clean: format memo.txt and document comments, etc. +* (ble-syntax:bash): add a work around of a bash-4.2 bug in arithmetic expressions + +## 2017-03-01 +* (ble-edit/info/draw-text): change to truncate overflow contents +* ble-edit: fix bugs that line representation is broken at the last line of terminals + - \fix, use IND to ensure size of the edit area + - \fix, clear _ble_line_{beg,end}{x,y} on newline + - ble-edit.sh: add a function ble-edit/draw/put.ind + - ble-edit.sh: add a function ble/widget/.insert-newline + - (ble/widget/redraw-line): \clean, 無駄な _ble_line_cur 初期化を削除。ble-edit/render/invalidate を呼び出すだけで充分。 + - (ble-edit/exec/.adjust-eol): \clean, 無駄な _ble_line_x=0 _ble_line_y=0 を消去。元からそうなっている前提である。 + - (ble-edit/exec/.adjust-eol): \fix, 直接 stderr に出力していたのを ble/util/buffer に出す様に変更。 +* (ble-syntax:bash): support `} }', etc. +* (ble-syntax:bash): :new: support `for ((;;)) { ... }' +* (ble-syntax:bash): support `((echo)>/dev/null)' and `$((echo)>/dev/null)' +* complete: support completion of "in" keywords for "for var in"/"case arg in" +* (ble-syntax:bash): :new: support `for var in ...' and `case arg in' +* (ble-syntax:bash/ctx-command): [refactor] split into functions, use arrays for ctx settings +* (ble-syntax:bash): fix a bug that redirection accepted comments +* (ble-highlight-layer:syntax): fix a bug that causes error on a word beginning with # + - Note: words beginning with '#' can be formed when `shopt -u interactive_comments' +* (ble-syntax:bash): fix a bug that beginning of process substitutions splitted words + +## 2017-02-28 +* ble-edit: [refact] rename ble/edit/prompt/update/update-cache_wd -> ble-edit/prompt/update/update-cache_wd +* ble-edit: [refact] rename ble/widget functions +* ble-edit: [refact] rename ble-edit functions +* ble-edit: use ble/util/buffer to suppress flicker +* ble-core: add variable "ble_util_upvar{,_setup}" + +## 2017-02-25 +* (ble-syntax/parse/shift): fix a bug that caused duplicated shifts +* (ble-syntax/print-status/.dump-arrays): add consistency checks + +## 2017-02-14 +* ble-syntax.sh: fix a bug that attempts "continue" out side of loop + +## 2017-02-13 +* ble-edit (ble/widget/isearch): fix a bug that isearch does not work in bash-4.4 + +## 2016-12-21 +* ble-edit (exec): default value of the parameter "$_" is "$BASH" +* ble-edit (exec): support parameter "$_" + +## 2016-12-06 +* ble-core (ble/string#split): add a work around for "shopt -s nullglob" + +## 2016-11-08 +* Makefile: detect correct path of gawk for mwg_pp.awk + +## 2016-11-07 +* ble-core.sh: add a work around of bashbug to accept inputs of hankaku kana + +## 2016-09-20 +* (ble/util/sleep in Cygwin): check parent processes of blocking process substitutions + +## 2016-09-16 +* README: update +* (ble/util/upvar): fixed a bug that array elements cannot be exported + +## 2016-09-14 +* ble-core: add a function ble/util/upvar +* _ble_edit_str.replace: improve error correction of _ble_edit_ind and _ble_edit_mark + +## 2016-09-11 +* (ble/widget/isearch/cancel): return to the original position, i.e. restore _ble_edit_{ind,mark} +* (ble-syntax:bash/check-dollar): fixed a bug that isolated dollars generate syntax errors +* (ble/widget/accept-and-next): fixed a bug that the next line is not loaded on accepting the last histentry +* ble.sh (ble-edit/history/add): fixed a bug that erasedups is performed even if a new entry is rejected by ignorespace +* isearch: fixed a bug that words in the current line is not matched incrementally + +## 2016-08-24 +* complete.sh: recognize dangling symbolic links in completion and syntax-highlighting + +## 2016-08-08 +* term.sh: fixed a bug that xenl cap was always disabled. + +## 2016-08-07 +* ble-edit/prompt: improved admin privileges checks on Cygwin + +## 2016-08-05 +* (ble-edit/history/add): fixed a bug that history entries are not registered after certain operations. +* syntax: fixed a bug that causes an fatal error for param expansions with offset in quotes like "${v:1}" +* (ble/util/sleep): do not use /dev/tcp which generates error messages on Win10 Cygwin. + +## 2016-07-16 +* (ble/util/array-push): \refactor, rename, support multiple elements to append. + - rename ble/util/array-push -> ble/array#push + - rename ble/util/array-reverse -> ble/array#reverse + +## 2016-07-15 +* complete: enable completion of variable names in "..." and ${...}. +* complete.sh: insert '=' after the completion of variable name of assignment. + - (ble/widget/complete): + completion-context にて source の引数をコロン区切で指定できるように拡張する。 + - ble-complete/source/variable: + 引数に応じて確定時に挿入する接尾辞を選択する様に変更する。 + - ble-syntax.sh (ble-syntax/completion-context): + 文脈に応じて variable 候補源に引数 '=' を指定して、補完確定時に何を挿入するべきか指定する。 +* complete.sh: fixes and clean up; a new fn ble/string#split. + - ble-core.sh: a new function ble/string#split to replace "GLOBIGNORE=* IFS=... eval 'arr=(...)'". + - complete.sh: (ble-complete/.fignore/filter): fixed a bug that local variable pat was leaked. + - complete.sh: (ble/widget/complete): fixed a bug that "shopt -s force_fignore" was ineffective. + +## 2016-07-14 +* (ble/util/sleep): add fallbacks to sleepenh and usleep for bash-3.*. +* isearch: fixed a bug that a new range overlapped with the current match cannot be matched incrementally. +* (bleopt): fixed a bug in printing variables. + +## 2016-07-09 +* (ble/history/add): work around for bash-3.0 to add history entries to bash command history. +* (ble/history/add): fixed a bug that command history was always disabled under bash-3.2. + +## 2016-07-08 +* ble-syntax.sh, complete.sh (shopt -q autocd): fixed a bug that error messages were output to stderr on completions in bash-3.*. +* ble-edit (prompt): :new: support shell variable PROMPT_DIRTRIM for PS1 instantiation. +* ble-edit: Now, the history index \! in PS1 is the index of the editted line. + - isearch: also, the position shown while isearch is changed to the history index. + +## 2016-07-07 +* README: move language options to the top. add icons of the languages. +* update README and LICENSE +* ble-edit.sh (ble-edit/isearch/backward): improve the performance (work around for slow bash arrays). + +## 2016-07-06 +* ble-edit.sh (_ble_edit_history_edit): changed to hold the whole editted history data. +* ble-syntax: glob patterns are not active in variable assignments. +* ble-edit.sh: 修正: ジョブ状態の変更を標準出力に確実に出力 + - fixed a bug that job state changes are not output when PS1 contains '\j'. + - fixed a bug that the changes are not output immediately. +* minor fixes in visible-bell and check-stderr. + - ble-core.sh (ble-term/visible-bell): fixed a bug in subsecond treatment. + - ble-edit.sh (.ble-edit/stdout/check-stderr): fixed a bug that lines without LF were not processed. + +* (ble/util/joblist): use ble/util/joblist for internal usage of jobs. + - ble-core.sh (ble/util/joblist): bugfix: + 誤って _ble_util_joblist_jobs を _ble_util_joblist_list として使用している箇所が 4 箇所。 + - ble-core.sh (ble/util/joblist): bugfix: + - (直前のジョブ) や - (一つ前のジョブ) の変化も変化として検知していた。 + - これはジョブ状態の本質的な変化とは言いがたいので無視する。 + - ble-core.sh (ble/util/joblist): bugfix: add ble/util/joblist.clear + bash 自身によってジョブ状態の変化が報告された後に、 + 二重に状態変化が報告される場合があるので、その様な場合にはキャッシュを消去する。 + - ble-edit.sh の各 jobs を呼び出すところで、ble/util/joblist を代わりに呼び出す。 + - ble-syntax.sh, ble-color.sh で jobs を使用してジョブの存在確認している箇所では、 + 先に ble/util/joblist を呼び出してジョブの状態変更を確認してから目的の jobs 呼び出しを行う。 +* ble-core.sh: add a new function ble/util/joblist. + +## 2016-07-05 +* ble-core: add option bleopt_stackdump_enabled + - bleopt_stackdump_enabled が非零の値に設定されている時にだけ + stackdump を出力する様にする。既定では 0 (出力しない) とする。 + +## 2016-07-04 +* ble-decode.sh (ble-decode-attach): fixed a bug that makes C-{u,v,w,?} ineffective after the second ble-attach. + - 2回目以降の ble-attach でも ble-decode-bind/uvw が動作する様に + ble-decode-attach で source "~.bind" した直後に _ble_decode_bind__uvwflag をクリアする。 + +## 2016-06-27 +* ble-core.sh ($_ble_base/cache): move to _ble_base_cache="$_ble_base/cache.d/$UID" for user separation. +* ble-core.sh ($_ble_base_tmp): change to use /tmp/blesh/$UID if it is available. + - 今迄は ble.sh と同じディレクトリに一時ファイルを配置していた。 + しかし、ble_util_assign.tmp などのファイルは速度を考えれば tmpfs (RAM上) に配置したい。 + 従って、一時ファイルは /tmp の上に配置するように変更する。 +* ble-core.sh: add ble/util/sleep to provide subsecond sleep. + +## 2016-06-25 +* ble-edit.sh (_ble_edit_str.replace debug codes): resume from wrong state. + +## 2016-06-23 +* ble-core.sh (ble/util/array-reverse): improve performance. + +## 2016-06-22 +* ble-edit/isearch: show progress of search. + +## 2016-06-19 +* ble-edit/isearch: ble/widget/isearch/prev cancel a task in que, ble/widget/isearch/accept is not effective while a search. + - ble/widget/isearch/prev: 現在実行中のタスク (_ble_edit_isearch_que) がある場合には一つずつキャンセルする。 + - ble/widget/isearch/accept: 現在実行中のタスクがある場合には bell を鳴らすだけで動作をスキップする。 + - ble-edit/isearch/.goto-match: 一致があった場合には is-stdin-ready でも強制的に描画を実行する。 +* ble-edit/isearch: check is-stdin-ready on history search to suspend. + +## 2016-05-21 +* update README.md for v0.1.5 +* ble-edit.sh: bugfix, incorrect _ble_edit_ind caused by the inconsistensy of history/isearch targets. + - _ble_edit_history を履歴検索して _ble_edit_history_edit をロードしていた事による _ble_edit_ind 不整合 + これにより、dirty-range の不整合が生じエラーが発生していた。長年の謎のバグがこれで潰れたと思われる。 + +## 2016-04-07 +* ble-syntax.sh (ble-syntax/parse/shift.impl2): bugfix 制御構造の欠陥による shift 漏れ。 + +## 2016-01-24 +* ble-syntax.sh: \debug add debug codes for dirty-range bug + - ble-edit.sh: dirty range checks + - ble-syntax.sh (ble-syntax/parse): remove readonly flag of `beg' and `end' for dirty-range bug + +## 2015-12-30 +* modify README: use -O option for curl; release v0.1.4. + +## 2015-12-26 +* (ble-color/faces): preserve orders of addhook-onload, and ble-color-{def,set}face. + - ble-color/faces 初期化前に呼び出した ble-color/faces/addhook-onload, + ble-color-defface, ble-color-setface を独立に記録していた為、 + 実際に呼び出された順序と異なる順序で処理が実行されてしまっていた。 + 記録を一つの配列 _ble_faces_lazy_loader にまとめ、順序が保存される様にした。 + +## 2015-12-25 +* (ble-color) \change ble-color-{def,set}face の処理も遅延する。 +* functions/getopt.sh: \add description. + +## 2015-12-24 +* (ble-syntax:bash): :new:, support option `-p` for keyword `time`. +* (ble-syntax:bash): \new, support `a=([key]=value)` and `a+=([key]+=delta)`. + * (ble-syntax): \new local variable `parse_suppressNextStat` in ble-syntax/parse. + * (ble-syntax:bash): \bugfix, correct resume for `var+`, `arr[...]+` -> `var+=`, `arr[...]+=`. + * (ble-syntax:bash): \new, support `a=([key]=value)` and `a+=([key]+=delta)`. +* (ble-syntax:bash): \new context CTX_CASE. +* (ble-syntax:bash): \new CTX_COND{X,I}; \change unexpected '(' is treated as extglob '@(' instead of sub-shell '('; + * ble-syntax.sh: `CTX_VAL{X,I}` から `CTX_COND{X,I}` を分離。 + * ble-syntax.sh: コマンド中に現れる '(' を extglob の括弧として取り扱う事にする。 + 今迄は暫定的に sub-shell として取り扱っていたが、 + エラーが多く出てうるさいのでエラーの少ない extglob 括弧として取り扱う事にする。 +* ble-edit.sh: \bugfix histexpand condition [[ -o histexpand ]] inverted. + * \bugfix 履歴展開が効かなくなっていた。 + 条件判定の誤りだった: [[ -o histexpand ]] → [[ ! -o histexpand ]] + * \bugfix 履歴展開に失敗した時に : が実行される。 + 履歴展開が失敗すると history -p は標準出力に何も出力しないためであった。 + 失敗した時は echo "$BASH_COMMAND" により手動で出力する。 +* (ble-syntax:bash): \support shopt -s extglob; \bugfix error on {delimiter after redirect,'<' redirect}; + * extglob 対応: `CTX_GLOB`, `ATTR_GLOB`, `ctx-glob`, `check-glob` 追加。 + * \bugfix redirect 直後に redirect/delimiter があった時に解析データ書き込み違反。 + * \cleanup: 共通の正規表現の整理: + `$_ble_syntax_bash_rex_spaces`, + `$_ble_syntax_bash_rex_IFSs`, + `$_ble_syntax_bash_rex_delimiters`. + * \bugfix `$_ble_syntax_bash_rex_redirect`: < が抜けていた。 + +## 2015-12-23 +* (ble-syntax:bash): special treatment of arguments of `declare`. + * (ble-syntax:bash): declare, typeset, local, export, alias コマンドの引数を文法的に特別に扱う。特に配列構文 =() を許容する。 + その為に新しい文脈値 `CTX_ARGVX`, `CTX_ARGVI` を追加する。 + * (ble-syntax:bash): `CTX_ARGVI` に対する補完候補は変数名。等号 '=' 以降の部分についてはファイル名の補完候補を列挙する。 + * (ble-syntax:bash): 通常の代入構文における配列構文の動作を変更。 + 今迄は a=(1 2 3)echo などとすると a=(1 2 3) を配列代入と解釈し echo の部分をコマンドと解釈する様にしていた。 + その為に配列構文の nest-pop 時にすぐに単語を抜けて cxt==CTX_CMDXV になる様に構成していた。 + しかし、実際の bash の動作を確認してみると、a=(1 2 3)echo は a='(1 2 3)echo' の様に、全体が代入文の右辺と解釈される様である。 + 実際の bash の動作に合わせて、nest-pop 時に特別な動作を特にしない様に変更した。 + +## 2015-12-21 +* (ble-syntax:bash): 算術式終了条件修正、bash-3.0 で += 無効; (completion-context): a+= 直後の補完候補生成。 + * ble-syntax.sh (ble-syntax:bash): 算術式の終了条件を修正する。 + $((...)) ((...)) の中では '(', ')' を数えて終了判定を行う。 + $[...]、${arr[...]} arr[...]= の中では '[', ']' を数えて終了判定を行う。 + ${var:...:...} では '}' が来たらすぐに終了する。 + * ble-syntax.sh (completion-context): a+= の直後でも補完候補生成を行う。 + * ble-syntax.sh (ble-syntax:bash): disable += under bash-3.1. +* ble-edit.sh: bugfix failure of catch C-d in bash-3.0. + +## 2015-12-20 +* (ble-highlight-layer:syntax): color of special files, permission of files in redirection. + - ble-syntax.sh: bugfix of assertion test in ble-syntax/parse/tree-append. + - ble-syntax.sh (ble-highlight-layer:syntax): color filenames of block device, character device, pipe, and socket. + - ble-syntax.sh (ble-highlight-layer:syntax): redirection: check permissions. +* (ble-syntax:bash): bugfix, tree-structure corruption on edit of array subscripts in array-element assignment. + - ble-syntax.sh: 配列添字の書き換え時に解析木の破壊が起こる。 + 配列添字の終了 ']=' において nest-pop を先頭位置で行っていた。 + これが為に、過去の解析結果を書き換えている事になっていた為に、 + shift の際に設置した情報が消滅したりしていた。 +* ble-edit.sh: add support `set +o history`; ble-syntax.sh: check file existence on '<' redirection. + - ble-edit.sh: add support `set +o history` + - ble-syntax.sh (ble-highlight-layer:syntax): check filename of `<` redirections. + - ble-syntax.sh (constants): refact, + definition of `local rex_redirect` -> global `_ble_syntax_bash_rex_redirect`. + rename `_BLE_SYNTAX_CSPACE` -> `_ble_syntax_bash_cspace`. + - ble-edit.sh: refact, rename functions `.ble-edit[./]history[./]*` -> `ble-edit/history/*`. +* complete: 候補生成箇所の追加・修正、コマンド補完候補としてサブディレクトリも列挙 + - ble-syntax.sh (complete): bugfix, 単語の間の空白で complete を実行しようとしても候補が生成されなかった。 + - ble-syntax.sh (complete): generate filenames after `VAR='. + - ble-syntax.sh (complete): generate filenames just after the redirection. + - complete.sh: コマンドの補完候補として現在のディレクトリのサブディレクトリも列挙する様に修正する。 + サブディレクトリにある実行属性のファイルを実行したい場合がある為である。 + +## 2015-12-19 +* complete.sh: support `FIGNORE`, `shopt -s force_fignore`. + - Makefile: bugfix, remove `ble-getopt.sh` from the required files to generate ble.sh. + - complete.sh: support `FIGNORE` and `shopt -s force_fignore`. +* functions/*: move unused file ble-getopt.sh to `functions/`. Add new impl of getopt. +* ble-syntax.sh (ble-syntax:bash): redirections: bugfix '<<<', support '>|', overwrite check of files, etc. + - ble-syntax.sh (ble-highlight-layer:syntax): Support `set -o noclobber`; Check overwrites of target files of redirections for '>', '&>', and '<>' redirect. + - ble-{core,decode,edit}.sh, bind.sh, term.sh, emacs.sh: change redirection '>' -> '>|' for the case of the noclobber option on. + - ble-syntax.sh (ble-syntax:bash): support the redirect using `>|`. + - ble-syntax.sh (ble-syntax:bash): bugfix false syntax error of `<<<`. + - ble-syntax.sh (ble-syntax:bash): bugfix redundant skip on unexpected termination of redirect by an end of command or another redirection. + - ble-syntax.sh (ble-syntax:bash): bugfix, do not allow newline after the redirection introducers. +* ble.pp, ble-core.sh: Check and modify dependencies on external commands. + - ble.pp (ble/.check-environment): Remove tput (POSIX UP option) which is not necessarily required. + - ble-core.sh (ble-term/visible-bell): Add a function `ble/util/getmtime` to get modified time of files in a compatible way. + - ble-edit.sh (ble/widget/command-help): Select available pager from any of $PAGER, less, more, and cat. +* ble-syntax.sh: syntax: quotations in words in parameter expansion (shopt -u extquote, etc.). + - ble-syntax.sh: support single quotation in parameter expansion. + - ble-syntax.sh: support shopt -u extquote. +* clean up & minor behavior change: Check bash opts --{posix,noediting,restricted}, Unset mark on accept-line. + * bug fix + - ble-syntax.sh (ble-syntax:bash/extract-command/.construct-proc): remove a debug code which prints the message "clear words". + * minor behavior change + - ble-edit.sh (ble/widget/accept-line): redraw without mark. + - ble.pp (startup check): do not load ble.sh for bash --posix, --noediting, or --restricted. + * clean up + - ble-decode.sh (ble-decode-byte:bind/EPILOGUE): use ble/util/is-stdin-ready instead of the direct use of `read`. + - ble-core.sh (ble/util/is-stdin-ready): use LANG instead of LC_ALL. + - ble-edit.sh, ble-syntax.sh: use [[ -o histexpand ]] rather than [[ $- == *H* ]]. + - ble-syntax.sh (test): remove unused functions `.ble-shopt-extglob-push`, and `.ble-shopt-extglob-pop` for test. + - ble-edit.sh: remove old complete functions: + - .ble-edit-comp.initialize-vars + - .ble-edit-comp.common-part + - .ble-edit-comp.complete-filename + - ble/widget/complete + - ble/widget/complete-F + - ble-syntax.sh, complete.sh: no need of redirection for `shopt -q optname`. + +## 2015-12-09 +* Refactoring ble-edit.sh/ble-line-prompt. + * .ble-line-prompt -> ble-edit/prompt. + * `_ble_cursor_prompt`, `_ble_line_prompt` -> `_ble_edit_prompt`. +* Refactoring ble-core.sh, ble-color.sh, cmap/xterm.sh. + * ble-core.sh: .ble-text.* -> ble/util/*. + * ble-color.sh: .ble-color.* -> ble-color/.*. + * cmap/xterm.sh: .ble-bind.function-key.* -> ble-bind/cmap:xterm/*. +* Refactoring ble-decode.sh. + * ble-core.sh: .ble-term.{visible,audible}-bell -> ble-term/{visible,audible}-bell. + * ble-decode.sh: .ble-stty.* -> ble-stty/*. + * ble-decode.sh: .ble-decode-* -> 適切な名称に変更。 +* Refactoring and clean up. + * ble-edit.sh, etc: 'ble-edit+' -> 'ble/widget/. + * 'ble-edit.sh: ble-edit/exec 関数名整理。 + * ble-decode.sh: ble-decode-byte 関数名整理、ble-edit 依存性分離。 + * README-ja_JP.md: 日本語説明修正。 + * README.md: 英語修正。 + * ble-syntax.sh: コードコメント @fn -> 関数 に統一。 + +## 2015-12-06 +* ble-core.sh: Add function ble/util/cat to replace /bin/cat. + - ble-core.sh: 関数 ble/util/cat。command cat の単純な呼出と同じ機能を builtin read で実装。 + - ble-decode.sh (ble-bind --help): 外部コマンドの cat を呼び出していたが、bash の組込コマンドで実現できるので置き換え。 + - README.md: gmake/make について説明を追加。 +* Update README-ja_JP.md +* ble-bind: New option `-L, --list-functions`, ble-color.sh bugfix initialization of faces:region,disabled,overwrite_mode. + - ble-color.sh: bugfix, 色初期化 (region disabled overwrite_mode) 遅延ロードに登録していなかった。 + - ble-decode.sh (ble-bind): New option `-L, --list-functions` to list edit functions. + +## 2015-12-03 +* Changed default value of bleopt_char_width_mode from `emacs` to `east`. +* Update README-ja_JP.md. +* Add README-ja_JP.md. 日本語の説明。 +* optimization: lazy init of faces (ble-{syntax,color}.sh), removal of temporary files (ble-core.sh). + * ble-syntax.sh, ble-core.sh: lazy initialization of `_ble_faces_*`. + * minor: modify messgese: initialization message, the header of the script ble.sh. + * ble.pp: Add pp switch `measure_load_time` to identify the initialization bottle neck. + * ble-core.sh (`_ble_base_tmp.wipe`): optimization, use parameter expansion instead of regex captures. +* Support here string, shopt -q progcomp; Bugfix ble-syntax/parse/nest-equals. + * ble-syntax.sh: support here string. + * ble.htm: comment out outdated descriptions. + * ble-syntax.sh (ble-syntax/parse/nest-equals): bugfix, 前回の bugfix で onest[3]<0 の場合を考えていなかった。 + * complete.sh: shopt -q progcomp によるプログラム補完の有効・無効の切り替え。 +* update version numbers. +* ble-syntax.sh (ble-syntax/parse/nest-equals): fatal bugfix, misjudge on nest equality test causing nest structure corruption. + * Note: _ble_syntax_nest の要素に含まれている nest 開始位置は相対位置で記録されているにも拘わらず、絶対位置の変数に直接代入していた事が原因であった。 + * 他 ble-syntax.sh, ble-color.sh: compatibility fix., fgrep to command grep -F. +* README.md: correct download links. +* `*.sh`: Add `command` for external command execution. +* (ble-edit/stderr for bash-3.0): Add ignoreeof-message.txt for C-d message i18n. +* `*.sh`: New marker `__ENCODING__` for 文字コード依存部分 + +## 2015-11-30 +* complete.sh (ble-complete/source/argument): minor bugfix, default behavior using comp_opts exported by func .../.compgen. + * 他 ble.pp: check chmod. +* Makefile: a phony target `dist`. +* memo.txt: todo 整理. +* complete.sh: bugfix, completion doesn't work on an argument without complete -D spec. +* ble-edit.sh (ble-edit+isearch/next): bugfix, didn't match locally on self-insert of forward isearch. +* ble-decode.sh (generate-source-to-unbind-default): bugfix, need of LANG=C. + * LANG=C を設定しないと bind -sp の出力に変なバイトが含まれている為に解釈に失敗する。 + (utf-8 の様な ASCII 文字を含まない様な文字コード体系の場合にはこれで問題ないが。 + memo.txt に Note(2015-11-30) として追加する。) +* Update README.md +* ble-edit.sh: remove dependency on GNU awk. + * ble.pp: 念の為 gawk に戻す事ができる様に use_gawk (PP変数) を用意する。 + * ble.pp (ble/.check-environment): check awk. + * ble-core.sh (ble/util/array-reverse):(awk scripts): + + uninitialized variable `decl` を初期化する。 + + locale dependent な /[a-z]/ の類を POSIX 括弧 (/[[:alpha:]]/, /[[:alnum:]]/) に置き換え。 + * ble-edit.sh (.ble-edit/history/generate-source-to-load-history):(awk scripts): uninitialized variable `n`. + * ble-decode.sh (.ble-decode-bind/generate-source-to-unbind-default):(awk scripts): + + 引数名と大域変数が被らない様にする。 + + gawk 特有の機能 (/\y/, match 第三引数) を使わない。 + + bugfix, gsub の対象の変数が指定されていない箇所があった。 + * それぞれ gawk --lint 及び nawk でも動作を確認した。 + +## 2015-11-29 +* ble-edit/isearch: 現在のコマンド内も検索対象に。 + * 旧来の履歴項目検索機能を改名: + - ble-edit+isearch/forward -> ble-edit+isearch/history-forward, + - ble-edit+isearch/backward -> ble-edit+isearch/history-backward, + - ble-edit+isearch/self-insert -> ble-edit+isearch/history-self-insert. + * 検索履歴 (_ble_edit_isearch_arr) に一致範囲も記録する様に変更 + * 現在の位置からコマンド内を検索する関数を追加・旧関数を置換: + - ble-edit+isearch/forward, + - ble-edit+isearch/backward, + - ble-edit+isearch/self-insert. +* ble-edit.sh (+isearch/next): 一致範囲を囲む。 + * ble-edit.sh (+isearch/next), set region to matched range. + * ble-edit.sh: pattern matching using [[ text == pattern ]] instead of case statement. + * ble-color.sh (ble-syntax-layer:region/update): bugfix, PREV_UMIN/PREV_UMAX out of range due to the shift failure of omin/omax. +* ble-core.sh: full support for bleopt_input_encoding=C + * ble-core.sh: Add functions: ble-text-b2c+C, and ble-text-c2b+C. + * ble-core.sh (.ble-text.c2bc): rename .ble-text.c2bc -> ble-text-c2bc. + * .gitignore: 古い物を整理。/wiki 追加。 + +## 2015-11-28 +* Update README.md +* ble-decode.sh, ble-edit.sh: support `bind -xf`. + * ble-core.sh: Add functions ble/string#common-{prefix,suffix}. + * ble-decode.sh, ble-edit.sh: support `bind -xf COMMAND`. + * ble-edit.sh:714: ^M が直接埋め込まれていると GitHub が改行位置を勘違いする様なので $'\r' に修正する。 + * complete.sh: embedded sed scripts, POSIX compliance. +* ble-color.sh: Add a function ble-color-show. +* README.md: Add animation gif. +* README.md: settings for syntax highlighting. +* README.md: Add some description of settings. + +## 2015-11-27 +* Create LICENSE.md +* Update README.md + +## 2015-11-24 +* ble-edit.sh (+magic-space): bugfix, 現在のカーソル位置よりも前の部分に対して履歴展開する。 +* complete.sh: behavior of source/argument, compopt -o/+o, bugfix. + - complete.sh (ble-complete/source/argument): complete -o ..., compopt -o option +o option の読み取り。 + - complete.sh (ble-complete/util/escape-regexchars): bugfix. + - complete.sh: Add action/plain, action/argument, action/argument-nospace. + - complete.sh: Add source/dir. + - complete.sh (ble-complete/source/argument): support -o nospace, -o dirnames. +* complete.sh (ble-complete/source/argument): bugfixes. + * ble-complete/source/argument/.compgen-helper-prog: Export `COMP_LINE` `COMP_POINT` `COMP_KEY` `COMP_TYPE` + * ble-complete/source/argument/.compgen-helper-{prog,func}: Pass arguments `command`, `cur`, and `prev` for program/function. + * ble-complete/source/argument: Fix option -F, -C interruption failure. + * ble-complete/source/argument: Fix -F <-> -C miss arrangement. + * ble-complete/source/argument: Correct IFS when compgen is called. + * ble-complete/source/argument: `return 1` if no candidates are generated. + * ble-complete/source/argument: Evaluate `compgen` in the original shell (i.e., not in a sub-shell). + * ble-complete/source/argument: Filter and modify candidates generated by `compgen` using `sed`. + +## 2015-11-23 +* ble-edit.sh (ble-decode): show the message to run "stty sane" after "ble-detach". +* ble-syntax (ble-syntax:bash/extract-command): bugfix, 出力用の変数が local 指定になっていたのを削除。 + - 他: complete.sh: compgen -F prog -C cmd の際に compgen が警告を出すので compgen 2>/dev/null とする。 +* complete.sh: complete -p による補完の基本実装。 + * ble-core.sh: Create function ble/util/array-reverse. + * ble-decode.sh (.ble-decode-keys, .ble-decode-key/invoke-command): bash-3.0 workaround, local -a keys=(), local -a KEYS=() を2行に分ける。 + * ble-syntax.sh: complete 用の整備。 + * 関数追加 ble-syntax/tree-enumerate-break: "((tprev=-1))" は意図が分かりにくいので。 + * 関数追加 ble-syntax:bash/extract-command: + * ble-syntax/tree-enumerate: シェル変数 iN の既定値を _ble_syntax_text の末端に。 + * ble-syntax/completion-context: CTX_VALI, CTX_VALX に対応。 + * ble-syntax/completion-context: 一部の補完文脈を file から argument に変更。 + * complete.sh: complete -p 設定に基づく補完。 + * ble-complete/source/argument: 追加 + +## 2015-11-22 +* ble-syntax.sh: bash 文法関連の関数名整理。 + * ble-decode.sh (ble-bind): error message に . を追加。古いコメントを削除。 + * ble-syntax.sh (ble-syntax/parse/{check,ctx}-*): bash 文法特有の関数の名称を整理。 + +## 2015-11-21 +* cmap/cmap+*.sh: Update for current ble-decode.sh. +* ble-edit.sh (ble-edit+magic-space): Add edit function magic-space. + +## 2015-11-19 +* Support of PROMPT_COMMAND, and function bleopt. + * ble-edit.sh: easy support of PROMT_COMMAND. + * ble-core.sh: bleopt 関数追加。 + * ble-decode.sh (.ble-decode-initialize-cmap): POSIX sed BRE does not support the quantifiers: \+, \?. +* ble-syntax.sh: 履歴展開をより正確に。 + * histchars に応じた履歴展開の解析 + * extglob が設定されている時は !( は履歴展開と解釈しない + * 文字列 "~" 中の履歴展開は " の直前で終わる +* ble-core.sh: workaround for bash-3.0 regex in _ble_base_tmp.wipe. + +## 2015-11-17 +* `ext/mwg_pp.awk`: Include mwg_pp.awk in ext; Makefile (listf): renamed to list-functions and modified. +* ble-syntax.sh (ble-syntax/parse/nest-equals): bugfix (operater associativity), incorrect break of loops. + +## 2015-11-09 +* ble-core.sh (_ble_base_tmp.wipe): bugfix, correct iteration of old tmp files. + +## 2015-11-08 +* complete.sh: ユーザ入力があった時の候補列挙の中断に対応 (bash-4.0 以降); ble-syntax.sh: コメント判定の修正。 + * ble-core.sh (ble/util/is-stdin-ready): 関数追加。標準入力に未処理の文字が残っているかどうかを判定。ユーザの入力が待ち状態になっているかどうかを判定する為の物。 + * ble-syntax.sh (ble-syntax/parse/check-comment): コマンドライン解析時 shopt -u interactive_comments の時にはコメントは無効とする。 + * ble-syntax.sh (ble-syntax/parse/check-comment): bugfix コメント開始判定(単語頭)。単語開始の判定が単語頭ではなく「単語頭または単語内部の解析開始点の位置」という事になっていた。 + * complete.sh (ble-complete/source/command/gen, ble-edit+complete): コマンド候補の列挙・一致判定には時間が掛かるので ble/util/is-stdin-ready を用いて中断の判定を実行する。 + +## 2015-11-07 +* Update README.md +* ble.pp: check environment for required commands, ble-edit.sh: 'M-\'. + * ble.pp: check required commands. + * ble-core.sh: remove dependencies on `touch' command. + * ble-edit.sh, keymap/emacs.sh: Add edit function: delete-horizontal-space ('M-\'). + +## 2015-11-06 +* ble-syntax.sh: cleanup debug codes. +* ble-syntax.sh (ble-syntax/parse/shift.nest): bugfix, parse error by shift failure of _ble_syntax_nest. + +## 2015-11-25 +* Create README.md + +## 2015-08-25 +* m, bugfixes. + * PS1 の '!' の処理、 + * PS1 の \w の処理、 + * (bash-3.0) history '!1' &>/dev/null によるチェックでエラーメッセージが漏れていた。 +* bugfix, specify explicit collation order for regs and globs. + * Character ranges in regular expressions and glob patterns are dependent on collation order. + * To obtain the desired results for ascii characters, `local LC_COLLATE=C' should be explicitly specified. + +## 2015-08-24 +* ble-edit.sh (.ble-edit.history-add): bugfix, handling of HISTCONTROL. + +## 2015-08-19 +* bin/ble-edit.sh: bugfix for bash-3.0, history -s が正しく動作しないので修正。 + +## 2015-08-18 +* bugfix and cleanups. + * ble-core.sh (ble-assert): bugfix, correct return value. + * ble-edit.sh, ble-synta.sh: bash-3.0 bugfix, `local arr=(...)' form cannot be used in bash-3.0. + * ble-edit.sh (hist_expanded.initialize): renamed to `ble-edit/hist_expanded.initialize'. + +## 2015-08-16 +* 消滅単語に対する色解除の対策(暫定)。 + * ble-syntax.sh (ble-syntax/parse): 消滅単語の範囲集計。 + * ble-syntax.sh: 範囲更新・並進の整理。関数 ble/util/[uw]range#{update,shift} の追加。 +* 表示系統 bug fixes. + * ble-edit.sh (ble-edit/dirty-range/update): bugfix, endA0 の読み出しに誤り、変数名 delta/del に誤り。 + * ble-syntax.sh (ble-highlight-layer:syntax/update-attribute-table): bugfix in umin/umax update, umax の更新に使う変数名を誤っていた。 +* 組込コマンド上書き対策。ble-syntax shift bufgix for bash-4.2 算術式。 + * ble-syntax.sh (bash-4.2): bugfix, ble-syntax/parse/shift.{tree1,nest} の算術式で bash-4.2 をクラッシュされる形式の物が見付かった。 + * ble-core.sh: ble/util/set 関数を追加。 + * ble-edit.sh: builtin 上書きを防ぐ為に unset -f builtin を実行 (builtin, unset 両方上書きされると駄目だが)。 + * ble-edit.sh: return/break/continue も上書きを禁止する。 + * ble-*.sh: test の代わりに [[ ]] を使用。 +* 貼付時の再描画抑制 (read -t 0 による判定)。\x80-\x9F を M-^? で表示。 + * ble-edit.sh: 編集文字列内の \x80-\x9F の表示を M-^? に。表示が乱れていた。 + * ble-edit.sh (ble-decode-byte:bind): 次の文字が来ている時に再描画を抑制。 + * ble-edit.sh: exec/gexec 周りの関数名を整理。 + * ble-edit.sh: 関数削除 .ble-edit-isearch.create-visible-text + +## 2015-08-14 +* 構文 function ... に対応、履歴展開 bugfix. + * ble/src: .srcoption 追加。 + * ble-syntax.sh: defface 関数の色の変更。 + * ble-syntax.sh: 構文 `function ...` に対応。 + * ble-syntax.sh: `function ...`, `hoge ()` の直後に来るコマンドを compound-commands に制限。 + * ble-edit.sh: bugfix, set +H の時も履歴展開が有効になっていた。history -p は set +H と関係なく展開を行う。 + * ble-edit.sh: bugfix, 関数 echo を定義するとコマンドがそれ以上実行できなくなる。echo/printf を builtin を介して呼び出す様に変更。 +* ble/util/assign cleanup, ble/util/type add, .ble-line-prompt/update bugfix. + * ble-core.sh (ble/util/assign): cleanup, ble/util/sprintf, ble/util/type, ble/util/isfunction でも仕様, + * ble-core.sh: ble/util/type 追加。$(type -t) はこれを用いて処理する様に変更, + * ble-edit.sh (.ble-line-prompt/update): bugfix, 地の文の '$' や '`' が escape されてしまい展開されない. +* ble-edit.sh: プロンプト更新最適化。 +* ble-core.sh (ble/util/assign): $(...) 高速化用関数。 +* shift 高速化、入れ子構造を考慮に入れた単語着色に対応。 + * ble-syntax.sh (ble-syntax/parse/shift): 入れ子構造を考慮に入れた shift, + * ble-syntax.sh (_ble_syntax_tree): 単語毎の着色情報をデータ配列内に保持するように変更, + * ble-syntax.sh (ble-highlight-layer:syntax/update-word-table): 入れ子構造を考慮に入れた着色. +* leak variables: g cs +* cleanup, leak variables 処置. +* ble-syntax.sh: 終端していない節も列挙対象に含める。他整理。 + * ble-syntax.sh (ble-syntax/print-status): prints unterminated nodes. + * ble-syntax.sh: add new functions ble-syntax/tree-enumerate, ble-syntax/tree-enumerate-children. + * ble-syntax.sh: rename shell variable: _ble_syntax_word -> _ble_syntax_tree. + * ble-syntax.sh: cleanup. + +## 2015-08-13 +* ble-syntax.sh: clenup, print-status/dump-tree. +* ble-syntax.sh (_ble_syntax_stat): 解析状態に tchild, tprev (兄・子へのoffset情報) を追加。 +* ble-syntax.sh (_ble_syntax_word): 形式変更。兄・子へのoffset情報はその場で計算する暫定方式。 + +## 2015-08-12 +* memo.txt: _ble_syntax_word 形式変更の計画, ble-syntax.sh: clean up + +## 2015-08-11 +* ble-syntax.sh (`_ble_syntax_nest[]`): 形式変更 → "ctx wlen wtype nlen type" +* ble-syntax.sh (`_ble_syntax_stat[]`): 形式の変更 → "ctx wlen wtype nlen" +* ble-syntax.sh (`_ble_syntax_word[i]`): 要素の形式を wtype wbegin から wtype wlen に変更 +* ble-edit.sh (.ble-line-info.draw): 制御文字も入れられる様に, +* ble-syntax.sh (ble-syntax/print-status): Added, +* ble.pp: 二重起動対策, +* ble-edit.sh: history load. + +## 2015-08-08 +* ble-syntex.sh (ble-syntax/completion-context/check-prefix): completion at redirect filenames. + +## 2015-07-10 +* memo.txt: Added todos. + +## 2015-06-15 +* modified complete.sh + +## 2015-03-22 +* ble-decode.sh: bugfix, bash-4.1 でも ESC [ を翻訳しないと駄目 +* ble-decode.sh: bugfix, bash-4.1 でも ESC * に登録しないと駄目 +* ble-core.sh, etc.: 一時ファイルを tmp/$UID に置く事にする。 + +## 2015-03-12 +* ble-syntax.sh (ble-syntax/parse): stat の設定されていない箇所に word があり、shift されていなかった。 + +## 2015-03-08 +* ble-edit.sh (ble-edit/draw/trace): bugfix, LC_COLLATE を設定して正規表現を使用する様に修正。 +* bashbug related bugfix: 幾つかの bugfix, 全て bash のバグが関係していた…。 + - `` bash-4.1 以下でカーソルの表示位置がずれている。 + - `` bash-4.2, 4.0, 3.2, 不完全な編集内容に対してエラーが出る + - `` bash-4.0, 4.1 でプロンプトが表示されない + - `` bash-4.1 以下でプロンプトの色が着かない +* ble-decode.sh (.ble-decode-char): control/alter/meta/shift/super/hyper prefix が、 + その場で自身に適用されて出力されていた。 +* ble-core.sh (ble/util/declare-print-definitions): 連想配列に対応 +* ble-decode.sh, 他: オプション名 ble_opt を bleopt に統一 +* ble-decode.sh: .ble-decode-char 再実装 + - 修飾機能を send-modified-key (旧 sendkey-mod) に合流 + - C-x @ S 等、ESC 以外の修飾にも対応 + - .ble-decode-char/csi/* による CSI sequence の解釈 + - 新実装に対応する様に cmap/default.sh を書き直し + +## 2015-03-06 +* ble-decode.sh (stty): -icanon の設定。 +* ble-edit.sh (PS1): bugfix, job count, 時刻その他の更新。 +* ble-edit.sh (.ble-line-text/update/postion) + - bugfix: ascii printable characters の行末で \n を付加した時 ichg に登録していなかった。 + - bugfix: _ble_util_string_prototype の長さ指定に 0 を指定していた + - bugfix, 行末付近での tab の取り扱い + - 制御文字も追い出しの対象に。 + - xenl の時、行末で必ず \n を追加する (追い出しの場合なども含め)。 + - 追い出しがあった場合にそれを記録する。 +* ble-edit.sh (.ble-line-text/getxy.cur): カーソル位置を取得する為の getxy を新規作成。 +* ble-edit.sh (ble-edit/draw/trace): 描画属性 + - term.sh: 描画属性について terminfo から読み取る様に。 + - ble-color.sh: 描画属性の点滅、不可視、イタリック、打ち消し線に対応。 + - ble-color.sh: sgr 構築で term.sh の結果を利用する様に変更。 + - ble-edit.sh (.ble-line-prompt): ble-color-g2sgr で端末に依存しない PS1 を書ける様に変更。 +* ble-decode.sh (ble-decode-kbd): bugfix, 複数キーがある場合に正しく処理できていなかった +* overwrite-mode に対応 +* ble-syntax.sh, ble-color.sh: layer:syntax による色付けを face を介した物に変更。 +* ble-decode.sh, ble-edit.sh: 条件コマンドの統一。test や [ 等を [[ に統一。 + +---- + + +# Old ChangeLog + +## 2015-03-03 + + * ble-edit.sh, ble-edit.color: discard-line の際に着色 + * ble-edit.sh, ble-core.sh, etc: echo を builtin echo に。 + * ble-edit.sh: bugfix, 複数行で上に行けない + * ble-edit.sh: bugfix, 複数行なのに空行の accept-line でのずれ量が1行になっている + * プロンプト再実装 + - ble-edit.sh (ble-edit/draw/trace): escape sequences が含まれている文字列の位置追跡。 + - ble-edit.sh (.ble-line-prompt/update): プロンプトの構築を再実装。$() がある場合なども正しい計算。 + * ble-complete.sh (source/command): shopt -s autocd の時にディレクトリ名も候補として列挙。 + * ble-complete.sh: 補完候補の選択の方法を変更。より近くの開始点の物を優先。 + +## 2015-03-01 + + * ble-edit.sh: .ble-edit-draw.goto-xy, .ble-edit-draw.put 廃止 + * complete.sh: 関数名に / が入っていると compgen -c で列挙されないので、別に列挙する。 + +## 2015-02-28 + + * 初期化の最適化 + - ble-decode.sh: ble-decode-kbd 書き直し、ble-bind 書き直し + - ble-getopt.sh: 多少最適化 + - ble-decode.sh: bash-4.3 でも ESC [ を utf-8 2-byte code で受信する様に変更。 + - ble-decode.sh (.ble-decode-bind/generate-source-to-unbind-default): awk 呼出を一回に統合。 + - ble-decode.sh (.ble-decode-key.bind/unbind): [[ ]] による書き換え、bugfix。 + - ble-decode.sh, bind.sh: bind -x を生成する為のコードを bind.sh に分離。 + - ble-edit.sh, keymap.emacs.sh: keymap 初期化部分の分離、キャッシュ化。 + - ble-edit.sh: history 遅延ロード対応 + * ble-core.sh, ble-color.sh: .ble-shopt-extglob-push/pop/pop-all 廃止 + * ble-edit.sh: bugfix, .ble-line-info.clear で位置がずれる + * ble-edit.sh: ble-edit/draw/put.il, ble-edit/draw/put.dl + * ble-color.sh (ble-highlight-layer/update/shift): 長さが変わらない場合でも shift する。 + * ble.pp (include ble-getopt.sh): 現在使っている所がないので取り敢えず外す。 + * ble-syntax.sh (completion-context): 簡単なパラメータ展開に対する対応。 + +## 2015-02-27 + + * [bug] TAB 等の変更文字があった場合に文字列が表示されなくなる + * bash-3.0, 3.1 対応 + "[bug] bash-3.1 日本語の色付け・描画が変だ" + - ble-edit.sh, 他: @bash-3.1 bashbug workaround, ${param//%d/x} などは効かないので %d を '' で囲む。 + - ble-syntax.sh, 他: @bash-3.1 bashbug workaround, x${#arr[n]} はバイト数を返す様なので一旦通常変数に入れて ${#var} とする。 + - *.sh: @bash-3.0: += 演算子の置き換え、配列宣言の修正。 + - term.sh: @bash-3.0: bashbug workaround, declare -p で出力すると誤った物になる。 + * ble-edit.sh (.ble-line-text/update/slice): bugfix, 変更文字がある時にもう存在しないローカル変数を参照していた。 + * ble-core.sh: ble-load, ble-autoload + * complete.sh:, ble-syntax.sh, ble-edit.sh: 文脈依存補完の実装 + +## 2015-02-26 + + * ble-syntax.sh: a+=( a=( に対応 + +## 2015-02-25 + + * ble/term.sh: TERM 依存の部分を分離。キャッシュ化。完全移行ではないが徐々に。 + * ble-decode.sh: + - [bug] $_ble_base/cache の代わりに $_ble_bash/cache を作成していた + - [bug] accept-single-line-or-newline が二回目以降常に accept + * ble-edit.sh: + - [bug] 複数行の編集時に履歴移動をすると表示が乱れる + - printf %()T を用いた実装の導入、PS1 \D{...} に対応 + - [bug] 表示の属性の更新がうまく行かない事がある。 + - [bug] 編集文字列の行数が変わった時に info.draw の内容がずれる + * カーソル移動 + - ble-edit: 複数行編集と項目内でのカーソル移動に対応 + - ble-edit.sh: 複数行コマンドの履歴に対応。 + * ble-syntax.sh: ble-syntax-highlight+syntax を ble-highlight-layer:syntax に書き換え + * ble-syntax.sh: + - 関数定義 func() の形式に対応、 + - 条件式 [[ ... ]] と配列初期化子内の文脈に対応。 + - コメントに対応。 + - $[...] の形式に対応 (何故か bash の説明には一切載っていないが使える)。 + - [bug] invalid nest " $()" の先頭に for を挿入した時 + +## 2015-02-24 + + * ble-edit.sh 出力の部分更新に対応 (描画ちらつき対策) + * ble-syntax.sh: _ble_syntax_word, _ble_syntax_stat の形式の変更 + * ble-syntax.sh: 今迄行っていた dirty-range 拡大の方法を止めて、単に stat の削除を行う。 + * ble-syntax.sh: 及び上記の変更に伴う数々の bugfix + - [bug] 文字削除時 invalid nest の assertion に引っかかる。 + - [bug] 編集内容が零文字になった瞬間に改行が起こって表示が消える。 + - [bug] 改行しても先頭がコマンドになっていない + - [bug] _ble_region_highlight_table で空欄になっている箇所がある。 + - [bug] 単語の属性適用が後ろに続く単語にも続いている。 + - [bug] _ble_syntax_attr の中に "BLE_ATTR_ERR" の文字列が混入している。 + - 残っている dirty 拡大と _ble_syntax_word[] の廃止された形式に対する処理の + コメントアウトされた部分を削除。dirty 拡大の変更に伴う効率化の確認と、 + shift が遅いという事の ToDo 項目の追加。 + * ble-decode.sh: [bug] $_ble_base/cache の代わりに $_ble_bash/cache を作成していた + * ble-edit.sh: ble-edit+delete-backward-xword の類の動作を変更。 + +## 2015-02-23 + + * ble-core.sh: ble-stackdump, ble-assert + * [bug] update-positions で dend-dbeg が負になると警告が出る + * [bug] info.draw で特殊文字が改行に跨っている時の座標計算 + +## 2015-02-22 + + * ble-edit.sh: [bug] .ble-line-info.draw を使った時行がずれる + * ble-syntax.sh: [bug] for や do に色が着かない? + * レイヤー化 + - ble-color.sh: レイヤーの仕組み、レイヤ region, adapter, plain + RandomColor + - ble-edit.sh: レイヤーに対応した表示文字列構築関数。古い構築関数の削除。出力関数の変更。 + - ble-syntax.sh: 多少の変更。 + +## 2015-02-21 + + * 描画の高速化 + - ble-syntax.sh: 属性値の変更範囲に応じて適用を行い、変更範囲を LAYER_MIN, LAYER_MAX に返す様に。 + - ble-edit.sh: 表示用の文字列の構築部分を書き直して部分更新に対応。 + - ble-syntax.sh: 内容に変化のあった word の範囲も記録する様に変更。 + - ble-syntax.sh (parse): _ble_syntax_attr_umin (属性値の変更範囲), + _ble_syntax_word_umin (word の変更範囲) の累積に対応する為に、これらについても shift を実行する。 + +## 2015-02-20 + + * ble-decode.sh: bind 周り + - bash-4.3 C-@ を utf-8 2-byte code で受信する様に変更 + - bash-3.1 ESC [ を utf-8 2-byte code で受信する様に変更 + - bugfix, \C-\\ \C-_ \C-^ \C-] に bind できなくなっていた。 + - bind の version 分岐について整理。 + - 既存の bind を ESC に関係なく bind -r する。 + * ble-decode.sh: .ble-decode-key 部分一致探索の処理の再実装。変な動作だった。 + * ble-decode.sh: bugfix, 8bit 文字を正しく bind できていない。c2s で8bit文字が符号化されていた。 + * ble-syntax.sh: 履歴展開は $- に H がある時のみ有効に。 + * ble-syntax.sh: bugfix, bash-4.2 のバグの work around。配列を参照する算術式の書き換え。 + * ble-core.sh: c2s を bash の機能だけで実装できたので fallback を replace。 + * ble-core.sh: bash-4.0 で .ble-text.s2c を連想配列でメモ化 + * ble-edit.sh: bugfix, bash-4.0 で ret に予め特定の値が入っていると c2w に失敗する。 + * ble-edit.sh: bugfix, bind -x 直前のプロンプトの取り扱いは bash-4.0 では bash-3 系と同じ。 + * ble-edit.sh (.ble-line-text.construct 周り): lc lg を後で計算する様に変更。一区切り。一旦 commit する。 + +## 2015-02-19 + * ble-syntax.sh: 履歴展開に対応。 + * ble-decode.sh: bugfix, bind -X から bind -x を生成するコード。 + bind -X の出力する形式は再利用不可能な形式でエスケープされているのでこれを変換。 + * ble.pp, etc: noattach 引数に対応。ble-attach/ble-detach 関数の定義。detach の bugfix。 + * ble-edit.sh: bug, bleopt_suppress_bash_output= にした時にプロンプトが二重になる + +## 2015-02-18 + + * ble.pp, ...: ディレクトリの構成を変更 + * ble-syntax.sh: 文法の対応 + - プロセス置換を単語として扱う様に変更 + - リダイレクトの後の引数に対応 + - リダイレクトの前の fd 部分に対応 + * bash-3.1 対応 + - ble-edit.sh: bash-3.1 で C-d を捕捉できる様に(結構無理のある方法だが)。 + - ble-edit.sh, ble-decode.sh: bugfix, bash-3 でカーソルキーの類が動かない。履歴が読み込まれていない。 + - ble-edis.sh: bash-3.1, bleopt_suppress_bash_output=1 の方が安定して動いているのでこちらで行く。 + - ble-edit.sh: bash-3.1, カーソルキーが効かない。例によって ESC [ ... に関係するコマンドで + keymap が見付からないエラーになっている。これは ESC [ を CSI (utf-8) に変換してから読み取る事にした。 + - ble-syntax.sh: bash-3.2.48 のバグの work-around, (()) 内で配列要素を参照すると制御が無条件に其処に跳ぶ。 + +## 2015-02-17 + * ble-edit.sh (ble-edit/dirty-range): 範囲更新の仕組みを追加。 + _ble_edit_dirty はプロンプト再描画の判定も兼ねているので取り敢えず残す。 + * ble-edit.sh: 変数リーク (グローバル変数の汚染) の修正。line i + * ble-syntax.sh (ctx-command/check-word-end): 単語終了判定の処理タイミングを変更。 + * ble-syntax.sh: context の追加。CTX_CMDXF CTX_CMDX1 CTX_CMDXV CTX_ARGX0 + より正確な文脈判定・エラー検知。 + * ble-syntax.sh: 他にも多くの修正がある。未だ修正が続きそうなので一旦 commit する。 + + * ble-edit.sh (accept-line): bug, - で始まるコマンドを実行できない。 + * ble-color.sh: [bug] bg=black を設定しても反映されない。 + "未設定" と "黒" を区別する様に修正。 + * ble-syntax (ble-syntax-highlight+syntax): 入れ子エラーの色の範囲 + * ble-syntax: m, ;& は ;; ;;& 等と同じ取り扱い + * ble-syntax, etc: bash-3 正規表現対策。bash-3/4 の正規表現の違いに依存しない書き方に変更。 + +## 2015-02-16 + * ble-syntax.sh: bugfix, incremental に更新した時に word の長さが更新されない。 + _ble_syntax_word への格納の際に失敗していた。 + +## 2015-02-15 + * ble-synatax.sh: bash の文法に従った incremental な解析と色付け。 + +## 2015-02-14 + * ble-edit.sh (.ble-line-info.draw): 表示が遅いので修正。 + ASCII 文字は特別扱いする様に改良。劇的に速くなった。 + +## 2015-02-13 + * ble-edit.sh (keymap emacs): 既定の keymap に emacs の名を付与。 + * ble-edit.sh (accept-line.exec): bugfix, C-c で再帰呼び出しのループから抜けられない。 + trap DEBUG を用いて再帰呼び出しから抜けられる様に exec 周りを整理・実装し直し。 + * ble-edit.sh: オプション名の変更、各オプションの整理・説明の追加。 + * ble-edit.sh (.ble-edit/gexec): グローバルな文脈でコマンドを実行する仕組み。 + 再帰呼出に対する C-c にも対応。bleopt_exec_type で実行の方法を切り替えられる様に。 + exec が従来の方法で gexec がこの新しい方法。 + +## 2015-02-12 + * ble-decode.sh: bugfix, exit 後に stty が壊れているのを修正 + これに伴って ble の detach 機能の実装も行った。 + * ble-decode.sh: bugfix, bash-4.3 で三文字以上のシーケンスが悉く聞かない。 + keymap が見付からないエラーになってしまうので全てのシーケンスについて bind -x する事にした。 + * ble-core.sh: bugfix, builtin printf \U.... の使えない環境で command printf fallback が働かない。 + printf のパスを修正。また ASCII に対しては printf は使わない様に変更。 + * ble-color.sh (ble-syntax-highlight+default): + 追加・修正。また選択範囲の反転を ble-syntax-highlight+region として実装し、それを呼び出す形に。 + * ble.pp: 起動時に interactive モードかどうかのチェックを行う様に。 + +## 2015-02-11 + * ble-edit.sh (_ble_edit_io_*): ちらつきを抑える為に stdout/stderr を切り替える事にした。 + ちらつくのは bash の既定の出力によって ble の表示がクリアされ、bash の表示したい物が表示されるから。 + これに対抗して ble は bash の出力の直後に上書き再描画して何とか表示していた。 + bash の既定の出力を抑える為に、exec で出力先を切り替える事にした。 + bash の出力はファイルに書き込まれる様にし向ける。出力先ファイルを逐次確認して、 + エラーが出力されていれば visible-bell で表示する事にした。 + `bleopt_suppress_bash_output=1` の時にこの新しい方法を実験的に用いる。 + `bleopt_suppress_bash_output=` の時は従来のちらつく方法。 + +## 2015-02-10 + * ble-edit.sh (accept-line.exec): bash-4.3 で内部からグローバル変数を定義できる様に + declare 及び typeset を上書きして -g オプションを指定する様に変更。 + また、これに関係する注意点を ble.htm に記述。 + * ble-edit.sh (history): ロードに時間が掛かるので最適化。 + * 全般: bugfix, 文字列分割で GLOBIGNORE='*' を設定していないとパス名展開されて危険 + * ble-color.sh (ble-syntax-highlight+default): より良い色づけ。 + * ble-edit.sh (accept-line.exec): ble-bind -cf で bind されたコマンドの実行コンテキストを変更。 + accept-line で実行されるのと同じコンテキストで実行する。 + * ble-edit.sh (keymap default): C-z M-z を fg に bind。 + +## 2015-02-09 + * git repos + * ble-edit: bugfix, locate-xword マクロが展開されていなかった + * ble-decode: bash-4.3 に対応する為に色々変更 + - bind 指定の場合分けを整理 + - bugfix, ESC ?, ESC [ ? に対して全て bind + - bugfix, 場合によって全く bind -r できていない + →"bind -sp | fgrep" が "バイナリ" という結果になる事がある様だ。 + fgrep に -a を指定する。 + - bugfix, 日本語が入力できない。8bit 文字が認識されない。 + →8bit 文字はエスケープシーケンスで bind に指定する様に変更。 + +## 2013-06-12 + * ble-edit: history-beginning, history-end, accept-and-next + +## 2013-06-12 + * ble-edit: + kill-forward-fword, kill-backward-fword, kill-fword, + copy-forward-fword, copy-backward-fword, copy-fword, + delete-forward-fword, delete-backward-fword, delete-fword, + forward-fword, backward-fword + * ble-edit: history-expand-line, display-shell-version + +## 2013-06-10 + * ble-edit: + kill-forward-uword, kill-backward-uword, kill-uword, kill-region-or-uword, + copy-forward-uword, copy-backward-uword, copy-uword, copy-region-or-uword, + forward-uword, backward-uword + + * ble-edit: + delete-forward-uword, delete-backward-uword, delete-uword, delete-region-or-uword, + delete-forward-sword, delete-backward-sword, delete-sword, delete-region-or-sword, + delete-forward-cword, delete-backward-cword, delete-cword, delete-region-or-cword + + * ble-edit: + 以下の編集関数を廃止: + delete-region-or-uword, kill-region-or-uword, copy-region-or-uword, + delete-region-or-sword, kill-region-or-sword, copy-region-or-sword, + delete-region-or-cword, kill-region-or-cword, copy-region-or-cword. + 代わりに以下の編集関数を用いる: + delete-region-or type, kill-region-or type, copy-region-or type. + +## 2013-06-09 + * ble-edit: kill-region, copy-region + * ble-edit: + kill-forward-sword, kill-backward-sword, kill-sword, kill-region-or-sword, + copy-forward-sword, copy-backward-sword, copy-sword, copy-region-or-sword + * ble-edit: + kill-forward-cword, kill-backward-cword, kill-cword, kill-region-or-cword, + copy-forward-cword, copy-backward-cword, copy-cword, copy-region-or-cword + * ble-edit: forward-sword, backward-sword, forward-cword, backward-cword + +## 2013-06-06 + * ble-edit-bind: 全ての文字・キーが入力可能に。 + * complete: 候補一覧の表示 (簡易版) + * ble-color.sh: 色付け機能を highlight.sh から移植 + +## 2013-06-05 + * ble-edit: history-isearch-backward, history-isearch-forward, + isearch/self-insert, + isearch/next, isearch/forward, isearch/backward, + isearch/exit, isearch/cancel, isearch/default, + isearch/prev, isearch/accept + * ble-edit: yank + * ble-bind -d で今迄に bind した物を表示できる様に。 + * ble-edit: complete, 取り敢えずファイル名補完だけ + * ble-edit: command-help + +## 2013-06-04 + * ble-edit: discard-line, accept-line + * ble-edit: history-prev, history-next + * ble-edit: set-mark, kill-line, kill-backward-line, exchange-point-and-mark + * ble-edit: clear-screen + * ble-edit: transpose-chars + * ble-edit: insert-string + +## 2013-06-03 + * ble-edit: bell, self-insert, redraw-line, + * ble-edit: delete-char, delete-backward-char, delete-char-or-exit, + delete-forward-backward-char + * ble-edit: forward-char, backward-char, end-of-line, beginning-of-line + * ble-edit: quoted-insert + * ble.sh: 取り敢えず簡単に文字列を入力できる程度までは完成 + +## 2013-06-02 + * ble-getopt.sh: bugfixes + * ble-getopt.sh: 無事に完了した場合に OPTARGS を unset する様に変更 + * ble-decode-kbd, ble-decode-unkbd + +## 2013-05-31 + * ble-getopt.sh: created + * ble-decode: 大枠が完成 + +## 2013-05-30 + * highlight.sh: 取り敢えず簡単な色付け + * ble.sh: + + -- 経緯 -- + highlight.sh の方針だと bash が表示する編集中の内容を消す事が出来ないし、 + カーソルの位置も bash が表示する物の場所を指している。 + 色を付けて表示した物は、補助的に bash が表示する物の下に並べて表示する + ぐらいしか方法がない。 + + また readline 関数をスクリプトから呼び出す事が出来ないので、 + 結局、色付けを更新したいタイミングで READLINE_LINE や READLINE_POINT の動作を + スクリプトの側で全て模倣して再現しなければならない。 + READLINE_LINE, READLINE_POINT の bash の仕様が変な所為で、日本語など + のマルチバイトで正しく処理する為に、色々と汚い事をしなければならない。 + + 以上の事から、文字列の編集などの操作からスクリプトの実行まで + 全部自分で好きな様に実装して bash readline の機能を全て上書きする事にした。 + その為に、スクリプトを新しく書き直す。zle を真似て ble (bash line editor) + と名付ける。 + + -- 方針としては -- + a. read -n 1 を用いて 1 文字ずつ標準入力から文字を取り出してそれを処理していく + b. bash の bind で全ての文字に ble のバイト受信関数を繋げて、 + バイト列を受信しながら処理する。 + + highlight.sh の延長線上で b. の方針にしたが、 + もしかすると a. の方針も可能かも知れない。 + +## 2013-05-29 + * highlight.sh: 作成 diff --git a/.local/share/doc/blesh/README-ja_JP.md b/.local/share/doc/blesh/README-ja_JP.md new file mode 100644 index 0000000..91bd275 --- /dev/null +++ b/.local/share/doc/blesh/README-ja_JP.md @@ -0,0 +1,882 @@ +[ Languages: [English](README.md) (英語) | **日本語** ] + +

ble.sh (/blɛʃ/) ―Bash Line Editor―

+

+[ README | 説明書 | +Q&A | +contrib | +逆引き ] +

+ +`ble.sh`†1 (*Bash Line Editor*) +はピュア Bash†2 +スクリプトで書かれたコマンドラインエディタで、標準の GNU Readline を置き換える形で動作します。 + +現在の開発バージョンは 0.4 です。 +このスクリプトは Bash 3.0 以降で利用できますが、速度・機能などの観点から 4.0 以降のリリース版 Bash でお使い頂くことがお薦めです。 +また POSIX の基本的なコマンドが存在することも想定しています。 +現時点では、文字コードとして `UTF-8` のみの対応です。 +このスクリプトは [**BSD License**](LICENSE.md) (3条項 BSD ライセンス) の下で提供されます。 + +## 簡単設定 + + +`ble.sh` を取得するには主に2つの方法があります: `git` を用いてソースを取得しビルドする方法と、 +`curl` または `wget` を用いて [nightly ビルド](https://github.com/akinomyoga/ble.sh/releases/tag/nightly)をダウンロードする方法です。 +試用とインストール方法の詳細に関しては [節1.1](#get-from-source) と [節1.2](#get-from-tarball) を、 +`~/.bashrc` の設定の詳細に関しては [節1.3](#set-up-bashrc) を御覧ください。 + +> [!NOTE] +> `fzf` を `ble.sh` と組み合わせてお使いの場合は互換性の問題を避けるため [節2.8](#fzf-integration) を必ず御覧ください。 + +
git を用いてソースを取得し ble.sh を生成 + +この方法では `git`, `make` (GNU make), 及び `gawk` が必要です。 +以下、GNU make が `gmake` として提供されているシステム (BSD など) では、`make` を `gmake` に置き換えて実行してください。 + +```bash +# 簡単お試し (インストールせずにお試しいただけます) + +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git +make -C ble.sh +source ble.sh/out/ble.sh + +# インストール & .bashrc 簡単設定 (動かない場合は節1.3を御参照下さい) + +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git +make -C ble.sh install PREFIX=~/.local +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +生成過程では、複数のBashスクリプトファイルを前処理・結合することで `ble.sh` を生成し、 +他の関連ファイルを正しく配置し、またソースコード中のコードコメントを削除してロードを最適化します。 + +※生成過程は、C/C++ のコンパイルも伴わずバイナリも生成しませんので、コンパイラを準備していただく必要はありません。 +
+ +
curl を用いて nightly ビルドをダウンロード + +この方法では `curl`, `tar` (オプション `J` に対応), 及び `xz` (XZ Utils) が必要です。 + +```bash +# 簡単お試し (インストールせずにお試しいただけます) + +curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +source ble-nightly/ble.sh + +# インストール & .bashrc 簡単設定 (動かない場合は節1.3を御参照下さい) + +curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +bash ble-nightly/ble.sh --install ~/.local/share +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +インストール後はディレクトリ `ble-nightly` は削除して問題ありません。 +
+ +
wget を用いて nightly ビルドをダウンロード + +この方法では `wget`, `tar` (オプション `J` に対応), 及び `xz` (XZ Utils) が必要です。 + +```bash +# 簡単お試し (インストールせずにお試しいただけます) + +wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +source ble-nightly/ble.sh + +# インストール & .bashrc 簡単設定 (動かない場合は節1.3を御参照下さい) + +wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +bash ble-nightly/ble.sh --install ~/.local/share +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +インストール後はディレクトリ `ble-nightly` は削除して問題ありません。 +
+ +
パッケージ管理システムを通じてパッケージをインストール (現在限られたパッケージのみ) + +この方法では対応するパッケージ管理ツールのみが必要です。 + +- [AUR (Arch Linux)](https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-AUR) `blesh-git` (devel), `blesh` (stable 0.3.4) +- [NixOS (nixpkgs)](https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs) `blesh` (devel) +- [Guix](https://packages.guix.gnu.org/packages/blesh/0.4.0-devel2/) `blesh` (0.4.0-devel2) +
+ +
既存の ble.sh を更新 + +```bash +# 更新 (ble.sh をロードした状態で) + +ble-update + +# 更新 (ble.sh 外部から) + +bash /path/to/ble.sh --update +``` +
+ +
ble.sh のパッケージ作成 + +`ble.sh` は単にシェルスクリプトの集合ですので環境に依存せずにお使いいただけます (いわゆる "`noarch`") ので、 +単にリリースページからビルド済みの tarball をダウンロードし中身を `/tmp/blesh-package/usr/local` など所定の位置に配置するだけで問題ありません。 +それでも何らかの理由により自前でビルドする必要がある場合には以下のコマンドをお使いください。 +ビルドの為には git リポジトリ (`.git`) が必要になることにご注意ください。 + +```bash +# ビルド & パッケージ作成用コマンド + +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git +make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local +``` + +スクリプトファイル、ライセンスファイル。ドキュメントファイルのインストール場所を詳細に指定する方法については、 +後ろの節 [インストール](#install) and [パッケージ作成](#package) を御参照ください。 + +スクリプトファイル `_package.bash` を `${prefix}/share/blesh/lib/_package.bash` に配置することで、 +`ble-update` で用いるパッケージ更新方法を指定することができます。 +詳細については節 [`_package.bash`](#_packagebash) を御参照ください。 + +```bash +# ${prefix}/share/blesh/lib/_package.bash + +_ble_base_package_type=XXX +function ble/base/package:XXX/update { + update-the-package-in-a-proper-way +} +``` +
+ +## 機能概要 + +- **構文着色**: `fish` や `zsh-syntax-highlighting` のような文法構造に従った着色を行います。 + `zsh-syntax-highlighting` のような単純な着色ではなく、構文の入れ子構造や複数のヒアドキュメントなども正しく解析して着色します。 + 着色は[全て設定可能](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A72-%E6%8F%8F%E7%94%BB)です。 +- **補完増強**: [補完](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C)を大幅に増強します。 + **文法構造に応じた補完**、クォートやパラメータ展開を展開した上でのプログラム補完、**曖昧補完**に対応しています。 + また、候補をカーソルキーや TAB, S-TAB で選択できる + [**メニュー補完**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-menu-complete)、 + `fish` や `zsh-autosuggestions` のような + [**自動補完**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-auto-complete) + (Bash 4.0 以上) の機能もあります。 + 更に、従来 `peco` や `fzf` を呼び出さなければならなかった補完候補の絞り込みも + [**メニュー絞り込み**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-menu-filter) + (Bash 4.0 以上) として自然な形で組み込んでいます。 + 他に、[**動的略語展開**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-dabbrev) + や、[*zsh abbreviations*](https://unix.stackexchange.com/questions/6152/zsh-alias-expansion)・[`zsh-abbr`](https://github.com/olets/zsh-abbr) のような + [**静的略語展開**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A77-%E8%A3%9C%E5%AE%8C#user-content-sec-sabbrev) + にも対応しています。 +- **Vim編集モード**: `set -o vi` による編集モードを増強します。 + 挿入・ノーマルモードの他に(行・矩形)ビジュアルモード、置換モードなどの各種モードに対応しています。 + テキストオブジェクト・各種レジスタ・オペレータ・キーボードマクロなどにも対応しています。 + 拡張として `vim-surround` も提供しています。 +- 他にも + [**ステータス行**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A74-%E7%B7%A8%E9%9B%86#user-content-bleopt-prompt_status_line), + [**コマンド履歴共有**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A74-%E7%B7%A8%E9%9B%86#user-content-bleopt-history_share), + [**右プロンプト**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A74-%E7%B7%A8%E9%9B%86#user-content-bleopt-prompt_rps1), + [**過渡的プロンプト**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A74-%E7%B7%A8%E9%9B%86#user-content-bleopt-prompt_ps1_transient), + [**xterm タイトル**](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A74-%E7%B7%A8%E9%9B%86#user-content-bleopt-prompt_xterm_title), + など様々な機能に対応しています。 + +注意: `ble.sh` は、(プロンプト (`PS1`)、エイリアス、関数などを提供する) 典型的な Bash 設定集と異なります。 +`ble.sh` はより低層の基盤を提供するもので、ユーザは自分でプロンプトやエイリアスを設定する必要があります。 +勿論 [`bash-it`](https://github.com/Bash-it/bash-it) や [`oh-my-bash`](https://github.com/ohmybash/oh-my-bash) の様な他の Bash 設定と一緒に使っていただくことも可能です。 + +> デモ +> +> ![ble.sh demo gif](https://github.com/akinomyoga/ble.sh/wiki/images/trial1.gif) + +## 来し方行く末 + +このプロジェクトは初めは `.bashrc` の片隅で行われた小さな実験からスタートしました。 +2013年5月に `zsh-syntax-highlighting` のとある記事に触発されたのがきっかけでした。 +初めは数百行のコードを書けば構文着色が簡単に実現できるのではないかと思って始めた実験ですが、 +すぐに行エディタを根本から書き直さなければ実現できないのではないかということが分かり、 +独立したファイルにコードを移動した後に `ble.sh` という名前を与えました。 +この名前は Zsh の行エディタ (*ZLE* (*Zsh Line Editor*)) を真似て、 +但しシェルで書かれているという事を意識して `.sh` という拡張子にしたように記憶しています。 +`ble.sh` の読み方について屡々訊かれるのですが、最初に書いたように特に定まった読み方はありません。 +最初の実験は2週間程コードを弄って原理的に行エディタを作れるという事を結論づけて終わりました。 +本格的な実装が始まったのは2015年2月の事で12月には公開しました。 +その時点で行エディタとしては普段遣いに堪える程度に完成していました。 +Vimモードの実装は2017年9月に始まり2018年3月に一先ず完成としました。 +続いて補完の拡張は2018年8月に始まり2019年2月には一通り完成しました。 +現在は漫然とメンテナンスしている所でいつになるかは分かりませんが、以下に挙げるような機能も加えたいと何となく考えています。 + +- 2013-06 v0.0 -- 実験 +- 2015-12 v0.1 -- 構文着色 [[v0.1.15](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.15)] +- 2018-03 v0.2 -- Vim モード [[v0.2.7](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.7)] +- 2019-02 v0.3 -- 拡張補完 [[v0.3.4](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.4)] +- 20xx-xx v0.4 (plan) -- プログラム着色 [[nightly build](https://github.com/akinomyoga/ble.sh/releases/tag/nightly)] +- 20xx-xx v0.5 (plan) -- TUI設定画面 +- 20xx-xx v0.6 (plan) -- エラー診断? + +## 制限および前提 + +`ble.sh` の実装形態から来る制限があります。 +ユーザー設定や他の Bash の枠組みとの干渉によって問題が起こる可能性があります。 + +- 既定では、実行コストの都合上、`ble.sh` は前回のコマンドライン実行後の `PIPESTATUS` を設定しません。代わりに `BLE_PIPESTATUS` を参照することができます。 + もし本当に `PIPESTATUS` 経由でこれらの値を利用する必要がある場合には設定 `bleopt exec_restore_pipestatus=1` を使用して下さい。 +- 既定では、よりなめらかな描画の為に、`ble.sh` は `PROMPT_COMMAND` および `PRECMD` フックが端末内のカーソル位置およびレイアウトを変更しないことを想定します。 + `PROMPT_COMMAND` および `PRECMD` で出力を行うまたはカーソル位置を変更する設定をお持ちの場合は、設定 `bleopt prompt_command_changes_layout=1` を使用してください。 +- `ble.sh` は一般的な変数名のシェル変数や環境変数 (`LC_*` など) がグローバルで読み込み専用変数になっていないことを想定します。 + Bash ではグローバル変数の読み込み専用属性は関数のローカルスコープに於いても制限を与えます。 + つまり、同名の異なるローカル変数さえ定義することができません。 + この問題は `ble.sh` 固有の制限ではなく、あらゆる Bash の枠組みがグローバルの読み込み専用変数に影響を受けます。 + 一般的にグローバルスコープに読み込み変数を設定することはセキュリティ的な理由がない限りは非推奨と考えられています (参照 [[1]](https://lists.gnu.org/archive/html/bug-bash/2019-03/threads.html#00150), [[2]](https://lists.gnu.org/archive/html/bug-bash/2020-04/threads.html#00200), [[3]](https://mywiki.wooledge.org/BashProgramming?highlight=%28%22readonly%22%20flag,%20or%20an%20%22integer%22%20flag,%20but%20these%20are%20mostly%20useless,%20and%20serious%20scripts%20shouldn%27t%20be%20using%20them%29#Variables))。 + また、`ble.sh` はビルトインコマンド `readonly` をシェル関数で置き換え、グローバル変数を読み込み専用にするのをブロックします。 + 例外として、全て大文字の変数 (`ble.sh` が内部使用するものを除く) および `_*` の形の変数 (`_ble_*` および `__ble_*` を除く) を読み込み専用にすることは可能です。 +- `ble.sh` は Bash のビルトインコマンド (`trap`, `readonly`, `bind`, `history`, `read`, `exit`) をシェル関数で上書きし、`ble.sh` と干渉しないようにその振る舞いを調整します。 + ユーザーまたは他の枠組みが元のビルトインを直接呼び出した場合、または `ble.sh` の定義したシェル関数を別のシェル関数で上書きした場合、正しい動作を保証できません。 +- シェル及び端末の設定はラインエディタ用とコマンド実行用で異なります。`ble.sh` + はラインエディタ向けに必要な調整を行い、ユーザが指定したコマンド実行用の設定 + をできるだけ復元します。但し、様々な理由により、一部の設定については意図的に + 復元しない場合や復元することができない場合があります。詳細については + [wiki](https://github.com/akinomyoga/ble.sh/wiki/Internals#internal-and-external) + (英語) に情報があります。 + +## 批判 + +- †1Q. "ble.sh の読み方が分からない"--- + A. `ble.sh` はお好きな様に読んでいただいて問題ありませんが、一番短いのは標記の /blɛʃ/ になりましょう。 + しかし個人的には脳裡で /biːɛliː/ または /biːɛliː dɑt ɛseɪtʃ/ と読んでいるものですから、 + 標記の読み方は飽くまで参考と受け止めていただければ幸いです。 +- †2Q. "コマンドを実行するのだからピュアBashのはずがない。 + ピュアBashとは何たることか"--- + A. ラインエディタ本体がピュア Bashで書かれているという意味です。 + 勿論、ユーザーが外部コマンドを入力・実行した場合にはその外部コマンドが呼び出されます。 + 更に、ユーザーコマンド実行前後には TTY を適切に設定する為に `stty` (POSIX) が呼び出されます。 + 他にも処理の高速化の為に、初期化・終了処理、 + 巨大なデータの処理 (補完、貼り付けなど) の局面でPOSIX 標準コマンドを利用しています。 + `ble.sh` 実装における本来の目標はピュアBashで実装することではなく、 + POSIX環境におけるBashの互換性を保った範囲で高速な動作を実現することです。 + ピュアBashによって大抵の場合は `fork` & `exec` コストを削減することができますが、 + 個々のケースで外部コマンドによる実装の方が効率的な場合には、 + `ble.sh`はピュアBash実装よりも外部コマンドによる実装を優先します。 + +# 1 使い方 + +## 1.1 ソースからのビルド方法 + +### ble.sh 生成 + +`ble.sh` を生成する為には `gawk` (GNU awk) と `gmake` (GNU make) が必要です。 +以下のコマンドで生成できます。 +GNU make が `gmake` という名前でインストールされている場合は、`make` の代わりに `gmake` として下さい。 +```console +$ git clone --recursive https://github.com/akinomyoga/ble.sh.git +$ cd ble.sh +$ make +``` +スクリプトファイル `ble.sh` がサブディレクトリ `ble.sh/out` 内に生成されます。 + +### 試用 + +生成された `ble.sh` は `source` コマンドを用いてお試しいただけます。 + +```console +$ source out/ble.sh +``` + +### インストール + +指定したディレクトリにインストールするには `make install` コマンドを使用します。 + +```bash +# ~/.local/share/blesh にインストール +make install + +# 指定したディレクトリにインストール +make install INSDIR=/path/to/blesh +``` + +メインファイル `ble.sh` 及び関連スクリプトファイルのインストール先ディレクトリは Make 変数 `INSDIR` を用いて指定できます。 +ライセンス及びドキュメントのインストール先は Make 変数 `INSDIR_LICENSE` と `INSDIR_DOC` を用いて指定できます。 +`INSDIR` が指定されている時、`INSDIR_LICENSE` と `INSDIR_DOC` の既定値はそれぞれ `$INSDIR/licenses` と `$INSDIR/doc` です。 +`INSDIR` および後述の `DESTDIR`/`PREFIX` が指定されていない時、`INSDIR`, `INSDIR_LICENSE`, `INSDIR_DOC` の規定値は +それぞれ `$data/blesh`, `$data/blesh/licenses`, `$data/doc/blesh` になります。 +但し、`data` は `${XDG_DATA_HOME:-$HOME/.local/share}` を指します。 + +Make 変数 `USE_DOC=no` が指定されている時、ドキュメントファイルの処理が無効化されます。 + +既定ではコード中のコメント行や空行はインストール時に自動で削除されます。 +コメントや空行を保持したい場合は `strip_comment=no` を `make` の引数に指定して下さい。 + +`.bashrc` の設定に関しては[節1.3](#set-up-bashrc)を御覧ください。 + +### パッケージ作成 + +パッケージ作成者は Make 変数 `DESTDIR` 及び `PREFIX` を用いて `INSDIR`, +`INSDIR_LICENSE`, `INSDIR_DOC` の既定値を一括で設定することができます。 + +``` +# パッケージ作成 - 例1 +make install DESTDIR=/tmp/blesh-package PREFIX=/usr/local + +# パッケージ作成 - 例2 +make install DESTDIR="$build" PREFIX="$prefix" \ + INSDIR_LICENSE="$build/$prefix/share/licenses/blesh" + +# パッケージ作成 - 例3 +make install DESTDIR="$build" PREFIX="$prefix" \ + INSDIR_LICENSE="$build/$prefix/share/blesh/doc" \ + INSDIR_DOC="$build/$prefix/share/blesh/doc" + +# パッケージ作成 - 例4 +make install USE_DOC=no DESTDIR="$build" PREFIX="$prefix" +``` + +`INSDIR` の代わりに Make 変数 `DESTDIR` または `PREFIX` が指定されている時、 +`INSDIR` の値は `$DESTDIR/$PREFIX/share/blesh` に設定され、 +ライセンス及びドキュメントファイルの場所 `INSDIR_LICENSE` と `INSDIR_DOC` の既定値は `$DESTDIR/$PREFIX/share/doc/blesh` になります。 + +#### `_package.bash` + +スクリプトファイル `_package.bash` を `${prefix}/share/blesh/lib/_package.bash` に配置することで、 +`ble-update` で用いるパッケージ更新方法を指定することができます。 +スクリプトファイル `_package.bash` では、次で示すような変数と関数を定義します。 +但し `XXX` はパッケージ管理システムの名前に置き換えてください。 + +```bash +# ${prefix}/share/blesh/lib/_package.bash + +_ble_base_package_type=XXX + +function ble/base/package:XXX/update { + update-the-package-in-a-proper-way + return 0 +} +``` + +シェル関数の終了ステータス 0 は更新が成功したことを表し、更新処理完了後に `ble.sh` が自動的にリロードされます。 +シェル関数がステータス 6 で終了した場合、更新処理完了後に `ble.sh` のタイムスタンプが確認され、`ble.sh` が現セッションの開始時刻よりも新しい時に限りリロードが行われます。 +シェル関数がステータス 125 で終了した場合、`ble.sh` に組み込みの更新処理が試みられます。 +それ以外の場合には更新処理が中断されます。この場合、シェル関数が状況を説明するメッセージを出力するようにして下さい。 +具体例として `AUR` パッケージの [`_package.bash`](https://aur.archlinux.org/cgit/aur.git/tree/blesh-update.sh?h=blesh-git) も参考にしていただければ幸いです。 + +## 1.2 tarball のダウンロード + +GitHub Releases から `ble.sh` の tarball をダウンロードすることもできます。 +ダウンロード・試用・インストールの方法については各リリースページの説明を御覧ください。 +現在、安定版は開発版に比べてかなり古いので様々な機能が欠けていることにご注意下さい。 + +- 開発版 [v0.4.0-devel3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.4.0-devel3) (2023-04), [nightly build](https://github.com/akinomyoga/ble.sh/releases/tag/nightly) +- 安定版 [v0.3.4](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.4) (2019-02 fork) 拡張補完 +- 安定版 [v0.2.7](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.7) (2018-03 fork) Vim モード +- 安定版 [v0.1.15](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.15) (2015-12 fork) 構文着色 + +## 1.3 `.bashrc` の設定 + +対話シェルで常用する場合には `.bashrc` に設定を行います。 +単に `ble.sh` を `source` して頂くだけでも大抵の場合動作しますが、 +より確実に動作させる為には以下の様にコードを記述します。 +```bash +# bashrc + +# .bashrc の先頭近くに以下を追加して下さい。 +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none + +# 間に通常の bashrc の内容を既述します。 + +# .bashrc の末端近くに以下を追加して下さい。 +[[ ! ${BLE_VERSION-} ]] || ble-attach +``` + +`source -- /path/to/ble.sh` 及び `ble-attach` を呼び出す時は、 +標準ストリーム (`stdin`, `stdout`, `stderr`) が現在のセッションの制御端末とは別の物にリダイレクトされていない様にして下さい。 +`source -- /path/to/ble.sh` をシェル関数の中から実行するのは避けて下さい。 +この「より確実な設定」が必要になる詳細な条件については [Discussion #254 への回答 (英語)](https://github.com/akinomyoga/ble.sh/discussions/254#discussioncomment-4284757) で説明されています。 + +## 1.4 初期化スクリプト `~/.blerc` + +ユーザー設定は初期化スクリプト `~/.blerc` (またはもし `~/.blerc` が見つからなければ `${XDG_CONFIG_HOME:-$HOME/.config}/blesh/init.sh`) に記述します。 +初期化スクリプトは `ble.sh` ロード時に自動で読み込まれる Bash スクリプトなので、Bash で使えるコマンドを初期化スクリプトの中で利用できます。 +初期化スクリプトの位置を変更する場合には、`source ble.sh` 時に `--rcfile INITFILE` を指定します。以下に例を挙げます。 +テンプレートとしてリポジトリの [`blerc.template`](https://github.com/akinomyoga/ble.sh/blob/master/blerc.template) というファイルを利用できます +(お使いの `ble.sh` に対応する commit のテンプレートファイルを使う必要があることにご注意ください)。 + +```bash +# in bashrc + +# Example 1: ~/.blerc will be used by default +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none + +# Example 2: /path/to/your/blerc will be used +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none --rcfile /path/to/your/blerc +``` + +## 1.5 アップデート + +Git (`git'), GNU awk (`gawk`), 及び GNU make (`make`) が必要になります。 +`ble-0.3` 以上をお使いの場合は `ble.sh` をロードした状態で `ble-update` を実行して下さい。 + +```bash +$ ble-update +``` + +`ble-0.4` 以上をお使いの場合は `ble.sh` をロードしなくても以下のコマンドで更新可能です。 + +```bash +$ bash /path/to/ble.sh --update +``` + +それ以外の場合には、以下のように `git pull` で最新版を入手・インストールできます。 + +```bash +cd ble.sh # ※既に持っている git リポジトリに入る +git pull +git submodule update --recursive --remote +make +make INSDIR="$HOME/.local/share/blesh" install +``` + +## 1.6 アンインストール + +基本的に `ble.sh` ディレクトリとユーザの追加した設定を単に削除していただければ問題ありません。 + +- 全ての `ble.sh` セッション (`ble.sh` をロードしている Bash 対話セッション) を終了します。 +- 関連するユーザーデータを削除します。これらのデータを保持しておきたい場合は必要に応じてスキップしてください。 + - `.bashrc` に追加した行があれば削除します。 + - `blerc` 設定ファイル (`~/.blerc` または `~/.config/blesh/init.sh`) があれば削除します。 + - 状態ディレクトリ `~/.cache/blesh` が生成されていればそれを削除します。 +- `ble.sh` をインストールしたディレクトリを削除します。git リポジトリ内の + `out/ble.sh` を直接ご使用の場合はインストールしたディレクトリは、git リポジト + リ自体です。`make intall` を用いてインストールした場合は、インストールしたディ + レクトリは `/share/blesh` です。但し、`` (既定値: `~/.local`) + は `make install` に指定した `PREFIX` の値です。生成済み tarball をご利用の際 + には、インストールしたディレクトリは tarball を展開して得られたディレクトリを + 配置した場所です。 +- キャッシュディレクトリ `~/.cache/blesh` が生成されていればそれを削除します。 +- 一時ディレクトリ `/tmp/blesh` が生成されていればそれを削除します。これは `/tmp` の内容が自動的にクリアされないシステムで必要です。 + +## 1.7 トラブルシューティング + +- [Performance](https://github.com/akinomyoga/ble.sh/wiki/Performance) (英語) + では `ble.sh` の動作速度の改善に関する情報について説明しています。 +- [Reporting Issue](https://github.com/akinomyoga/ble.sh/wiki/Reporting-Issue) + (英語) では問題報告をする前に確認しておくと良い情報を説明しています。 + +### キャッシュの消去 + +原理的に発生しないはずなのですが「`ble.sh` で何も入力できなくなってしまった」という報告が偶にあります。 +原因不明で再現もできないため現在調査中ですが、`ble.sh` のキャッシュを消去すると直ることが多いようです。 +`ble.sh` をロードしていないセッションで以下のコマンドを実行することでキャッシュを消去できます。 + +```bash +$ bash /path/to/ble.sh --clear-cache +``` + +`ble.sh` をロードしていないセッションを開始するには、 +例えば `~/.bashrc` を編集して `ble.sh` をソースしている行をコメントアウトしてから Bash を開始してください。 +または Bash 以外のシェル (`ash`, `dash`, `ksh`, `zsh` など) を使うこともお考えください。 +もし問題が直接アクセスできないリモートホストで発生していて問題のない既存のセッションがない場合は、 +非対話的なコマンドで `~/.bashrc` を移動することで `~/.bashrc` を無効化できます。 + +```console +# 例 (ssh) + +local$ ssh remote 'mv .bashrc .bashrc.backup' + +# 例 (rsh) + +local$ rsh remote 'mv .bashrc .bashrc.backup' +``` + +# 2 基本設定 + +ここでは `~/.blerc` に記述する基本的な設定を幾つか紹介します。 +[質問と回答](https://github.com/akinomyoga/ble.sh/wiki/%E8%B3%AA%E5%95%8F%E3%81%A8%E5%9B%9E%E7%AD%94)、 +[逆引きレシピ](https://github.com/akinomyoga/ble.sh/wiki/%E9%80%86%E5%BC%95%E3%81%8D%E3%83%AC%E3%82%B7%E3%83%94)、 +[`contrib` リポジトリ](https://github.com/akinomyoga/blesh-contrib/blob/master/README-ja.md) にも便利な設定があります。 +その他の全ての設定項目はテンプレート [`blerc.template`](https://github.com/akinomyoga/ble.sh/blob/master/blerc.template) に含まれています。 +詳細な説明に関しては[説明書](https://github.com/akinomyoga/ble.sh/wiki/%E7%9B%AE%E6%AC%A1)を参照して下さい。 + +## 2.1 Vim モード + +Vim モードについては [Wiki の説明ページ](https://github.com/akinomyoga/ble.sh/wiki/Vi-(Vim)-editing-mode) を御覧ください。 + +## 2.2 各機能の無効化 + +よくお尋ね頂くご質問の一つにそれぞれの機能をどのように無効化すれば良いのかというものが御座います。 +各機能の無効化方法を以下にまとめます。 +`ble.sh` の振る舞いを Readline に近づける設定 [`config/readline`](https://github.com/akinomyoga/blesh-contrib/blob/master/config/readline.bash) +(`ble-import config/readline` で読み込めます) も御覧ください。 + +```bash +# 構文着色を無効化 +bleopt highlight_syntax= + +# ファイル名に基づく構文着色を無効化 +bleopt highlight_filename= + +# 変数の種類に基づく構文着色の無効化 +bleopt highlight_variable= + +# 自動補完の無効化 (自動補完は Bash 4.0 以降にて既定で有効です) +bleopt complete_auto_complete= +# Tip: 代わりに自動補完の起動遅延をミリ秒単位でご指定いただくこともできます。 +bleopt complete_auto_delay=300 + +# コマンド履歴に基づく自動補完の無効化 +bleopt complete_auto_history= + +# 曖昧補完の無効化 +bleopt complete_ambiguous= + +# TAB によるメニュー補完の無効化 +bleopt complete_menu_complete= + +# メニュー自動絞り込みの無効化 (Bash 4.0 以降にて既定で有効化されます) +bleopt complete_menu_filter= + +# 行末マーカー "[ble: EOF]" の無効化 +bleopt prompt_eol_mark='' +# Tip: 代わりに他の文字列をご指定頂くこともできます。 +bleopt prompt_eol_mark='⏎' + +# 終了ステータスマーカー "[ble: exit %d]" の無効化 +bleopt exec_errexit_mark= +# Tip: 代わりに他の文字列をご指定頂くこともできます。 +bleopt exec_errexit_mark=$'\e[91m[error %d]\e[m' + +# コマンド実行時間マーカー "[ble: elapsed 1.203s (CPU 0.4%)]" の無効化 +bleopt exec_elapsed_mark= +# Tip: 代わりに別の文字列をご指定いただくこともできます。 +bleopt exec_elapsed_mark=$'\e[94m[%ss (%s %%)]\e[m' +# Tip: マーカーを表示する条件を変更することも可能です。 +bleopt exec_elapsed_enabled='sys+usr>=10*60*1000' # 例: 合計CPU時間が 10 分以上の時に表示 + +# 終了マーカー "[ble: exit]" の無効化 +bleopt exec_exit_mark= + +# その他のマーカー "[ble: ...]" の無効化 +bleopt edit_marker= +bleopt edit_marker_error= +``` + +## 2.3 曖昧文字幅 + +設定 `char_width_mode` を用いて、曖昧文字幅を持つ文字 (Unicode 参考特性 `East_Asian_Width` が `A` (Ambiguous) の文字) の幅を制御できます。 +現在は 4 つの選択肢 `emacs`, `west`, `east`, `auto` が用意されています。 +設定値 `emacs` を指定した場合、GNU Emacs における既定の文字幅と同じ物を使います。 +設定値 `west` を指定した場合、全ての曖昧文字幅を 1 (半角) と解釈します。 +設定値 `east` を指定した場合、全ての曖昧文字幅を 2 (全角) と解釈します。 +設定値 `auto` を指定した場合、`west` か `east` かを端末とのやり取りに基づいて自動判定します。 +既定値は `auto` です。この設定項目は、利用している端末の振る舞いに応じて適切に設定する必要があります。 +例えば `west` に設定する場合は以下の様にします: + +```bash +bleopt char_width_mode='west' +``` + +## 2.4 文字コード + +設定 `input_encoding` は入力の文字コードを制御するのに使います。現在 `UTF-8` と `C` のみに対応しています。 +設定値 `C` を指定した場合は、受信したバイト値が直接文字コードであると解釈されます。 +既定値は `UTF-8` です。`C` に設定を変更する場合には以下の様にします: + +```bash +bleopt input_encoding='C' +``` + +## 2.5 ベル + +設定 `edit_bell` は編集関数 `bell` の振る舞いを制御するコロン区切りのリストです。 +値 `abell`, `vbell`, `visual` はそれぞれ対応するベルの提示方法を有効化します。 +値 `abell` は音による通知に対応し、制御文字の BEL (0x07) を `stderr` に出力します。 +値 `vbell` は画面での通知に対応し、端末画面上にメッセージを表示します。 +値 `visual` は画面の反転に対応し、DECSCNM を用いて端末画面を瞬間的に反転します。 +既定では音による通知のみが有効になっています。 + +設定 `vbell_default_message` は画面での通知で使用するメッセージ文字列を指定します。既定値は `' Wuff, -- Wuff!! '` です。 +設定 `vbell_duration` は画面での通知を表示する時間の長さを指定します。単位はミリ秒です。既定値は `2000` です。 +設定 `vbell_align` は画面での通知の表示位置を指定します。`left`, `center`, `right` が指定できます。 + +例えば、以下の設定によって、音による通知を無効化して画面での通知を設定・有効化できます。 + +```bash +bleopt edit_bell=vbell vbell_{default_message=' BEL ',duration=3000,align=right} +``` + +## 2.6 着色の設定 + +構文に従った着色で使用される、各文法要素の色と属性は `ble-face` シェル関数で設定します。 +既定の設定は以下のコードに対応します: +```bash +# 編集に関連する着色の設定 +ble-face -s region bg=60,fg=231 +ble-face -s region_target bg=153,fg=black +ble-face -s region_match bg=55,fg=231 +ble-face -s region_insert fg=27,bg=254 +ble-face -s disabled fg=242 +ble-face -s overwrite_mode fg=black,bg=51 +ble-face -s vbell reverse +ble-face -s vbell_erase bg=252 +ble-face -s vbell_flash fg=green,reverse +ble-face -s prompt_status_line fg=231,bg=240 + +# 構文着色の設定 +ble-face -s syntax_default none +ble-face -s syntax_command fg=brown +ble-face -s syntax_quoted fg=green +ble-face -s syntax_quotation fg=green,bold +ble-face -s syntax_escape fg=magenta +ble-face -s syntax_expr fg=33 +ble-face -s syntax_error bg=203,fg=231 +ble-face -s syntax_varname fg=202 +ble-face -s syntax_delimiter bold +ble-face -s syntax_param_expansion fg=133 +ble-face -s syntax_history_expansion bg=94,fg=231 +ble-face -s syntax_function_name fg=99,bold +ble-face -s syntax_comment fg=242 +ble-face -s syntax_glob fg=198,bold +ble-face -s syntax_brace fg=37,bold +ble-face -s syntax_tilde fg=63,bold +ble-face -s syntax_document fg=100 +ble-face -s syntax_document_begin fg=100,bold +ble-face -s command_builtin_dot fg=red,bold +ble-face -s command_builtin fg=red +ble-face -s command_alias fg=teal +ble-face -s command_function fg=99 +ble-face -s command_file fg=green +ble-face -s command_keyword fg=blue +ble-face -s command_jobs fg=red +ble-face -s command_directory fg=33,underline +ble-face -s command_suffix fg=231,bg=28 +ble-face -s command_suffix_new fg=231,bg=124 +ble-face -s filename_directory underline,fg=33 +ble-face -s filename_directory_sticky underline,fg=231,bg=26 +ble-face -s filename_link underline,fg=teal +ble-face -s filename_orphan underline,fg=16,bg=224 +ble-face -s filename_executable underline,fg=green +ble-face -s filename_setuid underline,fg=black,bg=220 +ble-face -s filename_setgid underline,fg=black,bg=191 +ble-face -s filename_other underline +ble-face -s filename_socket underline,fg=cyan,bg=black +ble-face -s filename_pipe underline,fg=lime,bg=black +ble-face -s filename_character underline,fg=231,bg=black +ble-face -s filename_block underline,fg=yellow,bg=black +ble-face -s filename_warning underline,fg=red +ble-face -s filename_url underline,fg=blue +ble-face -s filename_ls_colors underline +ble-face -s varname_array fg=orange,bold +ble-face -s varname_empty fg=31 +ble-face -s varname_export fg=200,bold +ble-face -s varname_expr fg=99,bold +ble-face -s varname_hash fg=70,bold +ble-face -s varname_new fg=34 +ble-face -s varname_number fg=64 +ble-face -s varname_readonly fg=200 +ble-face -s varname_transform fg=29,bold +ble-face -s varname_unset fg=245 +ble-face -s argument_option fg=teal +ble-face -s argument_error fg=black,bg=225 + +# 補完の着色 +ble-face -s auto_complete fg=238,bg=254 +ble-face -s menu_complete_match bold +ble-face -s menu_complete_selected reverse +ble-face -s menu_desc_default none +ble-face -s menu_desc_type ref:syntax_delimiter +ble-face -s menu_desc_quote ref:syntax_quoted +ble-face -s menu_filter_fixed bold +ble-face -s menu_filter_input fg=16,bg=229 +``` + +現在の描画設定の一覧は以下のコマンドでも確認できます (`ble-face` を無引数で呼び出す)。 +```console +$ ble-face +``` + +色コードはシェル関数 `ble-color-show` (`ble.sh` 内で定義) で確認できます。 +```console +$ ble-color-show +``` + +## 2.7 キーバインディング + +キーバインディングはシェル関数 `ble-bind` を使って変更できます。 +例えば C-x h を入力した時に "Hello, world!" と挿入させたければ以下のようにします。 +```bash +ble-bind -f 'C-x h' 'insert-string "Hello, world!"' +``` + +上記の C-x h の様なキー表記については +[マニュアル §3.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs) で詳細に説明されています。 +スペース・タブ・エンター・バックスペース・エスケープなどの特殊キーの表記については +[マニュアル §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-kspecs-ret) で説明されています: +スペースは SP と表現します。 +タブキーは端末によって C-i または TAB と表現します。 +エンター・リターンキーは端末によって C-m または RET と表現します。 +バックスペースは端末によって C-?, DEL, C-h, または BS 等様々な表現があります。 +Ctrl+ReturnShift+Return などの修飾された特殊キーの取り扱いについては +[マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/%E8%AA%AC%E6%98%8E%E6%9B%B8-%C2%A73-%E3%82%AD%E3%83%BC%E3%83%90%E3%82%A4%E3%83%B3%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0#user-content-sec-modifyOtherKeys-manual) で説明されています。 +お使いの端末が `modifyOtherKeys` に対応していない場合、手動で各キーの組み合わせに対応するエスケープシーケンスを設定する必要があります。 + + +M-c を入力した時にコマンドを実行するには以下のようにします。 + +```bash +ble-bind -c 'M-c' 'my-command' +``` + +C-r を入力した時に、ユーザー定義編集関数 (Bash の `bind -x` で指定するのと同様の物) を実行するには以下のようにします。 + +```bash +ble-bind -x 'C-r' 'my-edit-function' +``` + +既存のキーバインディングは以下のコマンドで確認できます。 +```console +$ ble-bind -P +``` + +以下のコマンドでキーバインディングに使える編集関数一覧を確認できます。 +```console +$ ble-bind -L +``` + +それぞれの編集関数の説明は wiki のマニュアルを参照して下さい。 + +一つのキーで複数の編集関数を呼び出したい場合は、以下の例の様に、 +`ble/widget/編集関数の名前` という名前のシェル関数を通して新しい編集関数を定義できます。 +既存の標準の編集関数と名前が重複しない様に、 +編集関数の名前は `ユーザー名/`, `my/`, `blerc/`, `dotfiles/` などで始める事が強く推奨されます。 + +```bash +# C-t で複数の操作を行う例 +function ble/widget/my/example1 { + ble/widget/beginning-of-logical-line + ble/widget/insert-string 'echo $(' + ble/widget/end-of-logical-line + ble/widget/insert-string ')' +} +ble-bind -f C-t my/example1 +``` + +## 2.8 fzf との統合 + +`fzf` を `ble.sh` と一緒にお使いいただく場合には、互換性の問題を避けるために、[`contrib/fzf` 統合機能](https://github.com/akinomyoga/blesh-contrib#pencil-fzf-integration) を用いて `fzf` を設定していただく必要があります。 +詳細についてはリンク先の説明を御覧ください。 + +```bash +# blerc + +# 注意: fzf を bash_completion と組み合わせて使用する場合は、fzf-completion よ +# りも先に bash_completion をロードしておく必要があります。これは ble.sh と関係 +# なく必要です。 +source /etc/profile.d/bash_completion.sh + +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +``` + +上記 `ble-import` に指定されているオプション `-d` は指定したファイルの読み込み +を遅延させます。このように設定した場合、指定したファイルはプロンプトが表示され +た後にバックグランドで読み込まれます。詳細に関しては [`ble-import` - 説明書 +§8](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A78-Miscellaneous#user-content-fn-ble-import) +を御覧ください。 + +### fzf に対する追加設定がある場合 + +`fzf` の設定を読み込んだ後に追加の設定コードを実行したい場合、上記の fzf 設定の遅延読み込みのために、 +単に設定コードを上記の設定に続けて記述しても動きません。 +この場合、四つの方法がございます。 +最も単純な方法はオプション `-d` を指定せずに遅延読み込みを無効化する方法 [1] です。 + +```bash +# [1] オプション -d を使用しない +ble-import integration/fzf-completion +ble-import integration/fzf-key-bindings + +``` + +しかし上の方法を用いると初期化時間が長くなります。別の方法として、 +`ble-import -d` [2] または `ble/util/idle.push` [3] を用いて追加設定も同様に遅 +延させることができます。または、fzf 設定ファイルの読み込み完了に対して +`ble-import -C` [4] を用いてフックを設定することもできます。 + +```bash +# [2] 追加設定も ble-import -d を使う +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble-import -d '' + +# [3] 追加設定を ble/util/idle.push で登録 +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble/util/idle.push '' + +# [4] 追加設定を ble-import -C で登録 +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble-import -C '' integration/fzf-key-bindings +``` + +# 3 ヒント + +## 3.1 複数行モード + +コマンドラインに改行が含まれている場合、複数行モード (MULTILINE モード) になります。 + +C-v C-j または C-q C-j とすると改行をコマンドラインの一部として入力できます。 +複数行モードでは、RET (C-m) はコマンドの実行ではなく新しい改行の挿入になります。 +複数行モードでは、C-j を用いてコマンドを実行して下さい。 + +`shopt -s cmdhist` が設定されているとき (既定)、もし RET (C-m) を押した時にコマンドラインが構文的に閉じていなければ、コマンドの実行ではなく改行の挿入を行います。 + +## 3.2 Vim モード + +`.bashrc` に `set -o vi` が設定されているとき、または `.inputrc` に `set editing-mode vi` が設定されているとき、vim モードが有効になります。 +Vim モードの詳細な設定については [Wiki のページ (英語)](https://github.com/akinomyoga/ble.sh/wiki/Vi-(Vim)-editing-mode) を御覧ください。 + +## 3.3 自動補完 + +Bash 4.0 以降では自動補完が有効になり、予測候補が表示されます。 +候補を確定するには S-RET を入力します (編集文字列の末尾にいる時は right, C-f または end でも確定できます)。 +表示されている候補の初めの単語だけ部分的に確定する時は M-f または M-right を入力します。 +現在の候補で確定しそのままコマンドを実行する場合には C-RET (※お使いの端末が対応している時) を入力します。 +お使いの端末が対応していない時は [マニュアル §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual) を参照して下さい。 + + +## 3.4 静的略語展開 + +特定の単語を静的略語展開に登録することで好きな文字列に展開することができます。 +登録済み単語に一致する単語の直後で SP を入力した時に静的略語展開が起きます。 +例えば、以下の設定をしておくと `command L` まで入力した状態で SP を押した時に、コマンドラインが `command | less` に展開されます。 + +```bash +# blerc +ble-sabbrev L='| less' +``` + +実際に実行したいコマンドに含まれる可能性の低い単語として、`\` で始まる単語を静的略語展開に登録することもお薦めです。 + +```bash +# blerc +ble-sabbrev '\L'='| less' +``` + +`~` で始まる静的略語展開は / でも展開されます。これは Zsh の名前付きディレクトリ (named directories) に模した使い方ができます。 +例えば、以下の設定の下で `~mybin/` と入力すると、`/home/user/bin/` など (`HOME=/home/user` の場合) に展開されます。 + +```bash +# blerc + +ble-sabbrev "~mybin=$HOME/bin" +``` + +その他の詳細については [マニュアルの静的略語展開の節](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-sabbrev) を御覧ください。 + +# 4 謝辞 + +GitHub の Issue/PR を通して多くの方からフィードバックを頂き、皆様に本当に感謝しております。 +特に以下の方には大きな寄与を受けたので言及させていただきます。 + +- [`@cmplstofB`](https://github.com/cmplstofB) 様には vim モードの実装において初期よりテスト及び様々な提案をしていただきました。 +- [`@dylankb`](https://github.com/dylankb) 様には `fzf` との互換性や `ble.sh` 初期化に関連して様々な問題報告をいただきました。 +- [`@rux616`](https://github.com/rux616) 様には幾つかの問題報告および `.blerc` の既定パス解決のバグ修正をいただきました。 +- [`@timjrd`](https://github.com/timjrd) 様には補完の枠組みの高速化に関する PR をいただきました。 +- [`@3ximus`](https://github.com/3ximus) 様には広範囲に渡る様々な問題について報告いただきました。 +- [`@SuperSandro2000`](https://github.com/SuperSandro2000) 様には NixOS 関係を始め様々なご報告をいただきました。 diff --git a/.local/share/doc/blesh/README.md b/.local/share/doc/blesh/README.md new file mode 100644 index 0000000..0a79aa7 --- /dev/null +++ b/.local/share/doc/blesh/README.md @@ -0,0 +1,938 @@ +[ Languages: **English** | [日本語](README-ja_JP.md) (Japanese) ] + +

ble.sh (/blɛʃ/) ―Bash Line Editor―

+

+[ README | Manual | +Q&A | +contrib | +Recipes ] +

+ +*Bash Line Editor* (`ble.sh`†1) is a command line editor written in pure Bash†2 which replaces the default GNU Readline. + +The current devel version is 0.4. +This script supports Bash 3.0 or higher although we recommend using `ble.sh` with release versions of **Bash 4.0 or higher**. +The POSIX standard utilities are also required. +Currently, only `UTF-8` encoding is supported for non-ASCII characters. +This script is provided under the [**BSD License**](LICENSE.md) (3-clause BSD license). + +## Quick instructions + + +There are two ways to get `ble.sh`: to get the source using `git` and build +`ble.sh`, or to download the [nightly build](https://github.com/akinomyoga/ble.sh/releases/tag/nightly) using `curl` or `wget`. +See [Sec 1.1](#get-from-source) and [Sec 1.2](#get-from-tarball) for the details of trial and installation. +See [Sec 1.3](#set-up-bashrc) for the details of the setup of your `~/.bashrc`. + +> [!NOTE] +> If you want to **use fzf with `ble.sh`**, you need to check [Sec +> 2.8](#fzf-integration) to avoid compatibility problems. + +
Download source using git and make ble.sh + +This requires the commands `git`, `make` (GNU make), and `gawk` (GNU awk)†3. +In the following, please replace `make` with `gmake` if your system provides GNU make as `gmake` (such as in BSD). + +```bash +# TRIAL without installation + +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git +make -C ble.sh +source ble.sh/out/ble.sh + +# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3) + +git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git +make -C ble.sh install PREFIX=~/.local +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +The build process integrates multiple Bash script files into a single Bash script `ble.sh` with pre-processing. +It also places other module files in appropriate places and strips code comments for a shorter initialization time. +The build process does not involve any C/C++/Fortran compilations and generating binaries, so C/C++/Fortran compilers are not needed. +
+ +
Download the nightly build with curl + +This requires the commands `curl`, `tar` (with the support for the `J` flag), and `xz` (XZ Utils). + +```bash +# TRIAL without installation + +curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +source ble-nightly/ble.sh + +# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3) + +curl -L https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +bash ble-nightly/ble.sh --install ~/.local/share +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +After the installation, the directory `ble-nightly` can be removed. +
+ +
Download the nightly build with wget + +This requires the commands `wget`, `tar` (with the support for the `J` flag), and `xz` (XZ Utils). + +```bash +# TRIAL without installation + +wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +source ble-nightly/ble.sh + +# Quick INSTALL to BASHRC (If this doesn't work, please follow Sec 1.3) + +wget -O - https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz | tar xJf - +bash ble-nightly/ble.sh --install ~/.local/share +echo 'source -- ~/.local/share/blesh/ble.sh' >> ~/.bashrc +``` + +After the installation, the directory `ble-nightly` can be removed. +
+ +
Install a package using a package manager (currently only a few packages) + +This only requires the corresponding package manager. + +- [AUR (Arch Linux)](https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-AUR) `blesh-git` (devel), `blesh` (stable 0.3.4) +- [NixOS (nixpkgs)](https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs) `blesh` (devel) +- [Guix](https://packages.guix.gnu.org/packages/blesh) `blesh` (devel) +
+ +
Update an existing copy of ble.sh + +```bash +# UPDATE (in a ble.sh session) + +ble-update + +# UPDATE (outside ble.sh sessions) + +bash /path/to/ble.sh --update +``` +
+ +
Create a package of ble.sh + +Since `ble.sh` is just a set of shell scripts and do not contain any binary (i.e., "`noarch`"), +you may just download the pre-built tarball from a release page and put the extracted contents in e.g. `/tmp/blesh-package/usr/local`. +Nevertheless, if you need to build the package from the source, please use the following commands. +Note that the git repository (`.git`) is required for the build. + +```bash +# BUILD & PACKAGE (for package maintainers) + +git clone --recursive https://github.com/akinomyoga/ble.sh.git +make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local +``` + +For a detailed control of the install locations of the main files, the license +files, and the documentation files, please also check the later sections +[Install](#install) and [Package](#package). + +If you want to tell `ble.sh` the way to update the package for `ble-update`, +you can place `_package.bash` at `${prefix}/share/blesh/lib/_package.bash`. +Please check [`_package.bash`](#_packagebash) for the details. + +```bash +# ${prefix}/share/blesh/lib/_package.bash + +_ble_base_package_type=XXX +function ble/base/package:XXX/update { + update-the-package-in-a-proper-way +} +``` +
+ +## Features + +- **Syntax highlighting**: Highlight command lines input by users as in `fish` and `zsh-syntax-highlighting`. + Unlike the simple highlighting in `zsh-syntax-highlighting`, `ble.sh` performs syntactic analysis + to enable the correct highlighting of complex structures such as nested command substitutions, multiple here documents, etc. + Highlighting colors and styles are [fully configurable](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A72-Graphics). +- **Enhanced completion**: + Extend [completion](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion) + by **syntax-aware completion**, completion with quotes and parameter expansions in prefix texts, **ambiguous candidate generation**, etc. + Also, [**menu-complete**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-menu-complete) + supports the selection of candidates in the menu (candidate list) by cursor keys, TAB, and S-TAB. + The feature [**auto-complete**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-auto-complete) + supports the automatic suggestion of completed texts as in `fish` and `zsh-autosuggestions` (with Bash 4.0+). + The feature [**menu-filter**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-menu-filter) + integrates automatic filtering of candidates into menu completion (with Bash 4.0+). + There are other functionalities such as + [**dabbrev**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-dabbrev) and + [**sabbrev**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-sabbrev) like + [*zsh abbreviations*](https://unix.stackexchange.com/questions/6152/zsh-alias-expansion) or [`zsh-abbr`](https://github.com/olets/zsh-abbr). +- **Vim editing mode**: Enhance `readline`'s vi editing mode available with `set -o vi`. + Vim editing mode supports various vim modes such as char/line/block visual/select mode, replace mode, + command mode, operator pending mode as well as insert mode and normal mode. + Vim editing mode supports various operators, text objects, registers, keyboard macros, marks, etc. + It also provides `vim-surround` as an option. +- Other interesting features include + [**status line**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A74-Editing#user-content-bleopt-prompt_status_line), + [**history share**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A74-Editing#user-content-bleopt-history_share), + [**right prompt**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A74-Editing#user-content-bleopt-prompt_rps1), + [**transient prompt**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A74-Editing#user-content-bleopt-prompt_ps1_transient), + [**xterm title**](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A74-Editing#user-content-bleopt-prompt_xterm_title), etc. + +Note: ble.sh does not provide specific settings of the prompt, aliases, functions, etc. +ble.sh provides a more fundamental infrastructure so that users can set up their own prompt, aliases, functions, etc. +Of course ble.sh can be used in combination with other Bash configurations such as [`bash-it`](https://github.com/Bash-it/bash-it) and [`oh-my-bash`](https://github.com/ohmybash/oh-my-bash). + +> Demo (version 0.2) +> +> ![ble.sh demo gif](https://github.com/akinomyoga/ble.sh/wiki/images/trial1.gif) + +## History and roadmap + +My little experiment took place in one corner of my `bashrc` at the end of May 2013 after I enjoyed an article on `zsh-syntax-highlighting`. +I initially thought something could be achieved by writing a few hundred lines of code +but soon realized that everything needs to be re-implemented for the authentic support of syntax highlighting in Bash. +I decided to make it as an independent script `ble.sh`. +The name stemmed from that of Zsh's line editor, *ZLE* (*Zsh Line Editor*), but suffixed with `.sh` for the implication of being written in a shell script. +I'm occasionally asked about the pronunciation of `ble.sh`, but you can pronounce it as you like. +After the two-week experiment, I was satisfied with my conclusion that it is *possible* to implement a full-featured line editor in Bash that satisfies the actual daily uses. +The real efforts to improve the prototype implementation for real uses started in February 2015. +I released the initial version in the next December. Until then, the basic part of the line editor was completed. +The implementation of vim mode was started in September 2017 and completed in the next March. +I started working on the enhancement of the completion in August 2018 and released it in the next February. + +- 2013-06 v0.0 -- prototype +- 2015-12 v0.1 -- Syntax highlighting [[v0.1.15](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.15)] +- 2018-03 v0.2 -- Vim mode [[v0.2.7](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.7)] +- 2019-02 v0.3 -- Enhanced completion [[v0.3.4](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.4)] +- 20xx-xx v0.4 (plan) -- programmable highlighting [[nightly build](https://github.com/akinomyoga/ble.sh/releases/tag/nightly)] +- 20xx-xx v0.5 (plan) -- TUI configuration +- 20xx-xx v0.6 (plan) -- error diagnostics? + +## Limitations and assumptions + +There are some limitations due to the way `ble.sh` is implemented. +Also, some user configurations or other Bash frameworks may conflict with ble.sh. +For example, + +- By default, `ble.sh` does not set `PIPESTATUS` for the previous command line + because it adds extra execution costs. Instead, the array `BLE_PIPESTATUS` + contains the values of `PIPESTATUS` of the previous command line. If you + need to access the values directly through the variable `PIPESTATUS`, please + set the option `bleopt exec_restore_pipestatus=1`. +- By default, `ble.sh` assumes that `PROMPT_COMMAND` and `PRECMD` hooks do not + change the cursor position and the layout in the terminal display to offer + smooth rendering. If you have settings that output texts or changes the + cursor position in `PROMPT_COMMAND` and `PRECMD`, please set the option + `bleopt prompt_command_changes_layout=1`. +- `ble.sh` assumes that common variable names and environment variables (such as `LC_*`) are not used for the global readonly variables. + In Bash, global readonly variables take effect in any scope including the local scope of the function, which means that we cannot even define a local variable that has the same name as a global readonly variable. + This is not the problem specific to `ble.sh`, but any Bash framework may suffer from the global readonly variables. + It is generally not recommended to define global readonly variables in Bash except for the security reasoning + (Refs. [[1]](https://lists.gnu.org/archive/html/bug-bash/2019-03/threads.html#00150), [[2]](https://lists.gnu.org/archive/html/bug-bash/2020-04/threads.html#00200), [[3]](https://mywiki.wooledge.org/BashProgramming?highlight=%28%22readonly%22%20flag,%20or%20an%20%22integer%22%20flag,%20but%20these%20are%20mostly%20useless,%20and%20serious%20scripts%20shouldn%27t%20be%20using%20them%29#Variables)). + Also, `ble.sh` overrides the builtin `readonly` with a shell function to prevent it from making global variables readonly. + It allows only uppercase global variables and `_*` to become readonly except `_ble_*`, `__ble_*`, and some special uppercase variables. +- `ble.sh` overrides Bash's built-in commands (`trap`, `readonly`, `bind`, `history`, `read`, and `exit`) with shell functions to adjust the behavior of each built-in command and prevent them from interfering with `ble.sh`. + If the user or another framework directly calls the original builtins through `builtin BUILTIN`, or if the user or another framework replaces the shell functions, the behavior is undefined. +- The shell and terminal settings for the line editor and the command execution + are different. `ble.sh` adjusts them for the line editor and try to restore + the settings for the command execution. However, there are settings that + cannot be restored or are intentionally not restored for various reasons. + Some of them are summarized on [a wiki + page](https://github.com/akinomyoga/ble.sh/wiki/Internals#internal-and-external). + +## Criticism + +- †1Q. *It is hard to + pronounce "ble-sh". How should I pronounce it?* --- A. The easiest + pronunciation of `ble.sh` that users use is /blɛʃ/, but you can pronounce it + as you like. I do not specify the canonical way of pronouncing `ble.sh`. In + fact, I personally call it simply /biːɛliː/ or verbosely read it as /biːɛliː + dɑt ɛseɪtʃ/ in my head. +- †2Q. *It cannot be pure + Bash because the user should be able to input and run external commands. + What does the pure Bash mean?* --- A. It means that the core part of the line + editor is written in pure Bash. Of course, the external commands will be run + when the user inputs them and requests the execution of them. In addition, + before and after the execution of user commands, `ble.sh` relies on POSIX + `stty` to set up the correct TTY states for user commands. It also uses + other POSIX utilities for acceleration in some parts of initialization and + cleanup code, processing of large data in completions, pasting large data, + etc. The primary goal of the `ble.sh` implementation is not being pure Bash, + but the performance in the Bash implementation with the POSIX environment. + Being pure Bash is usually useful for reducing the `fork`/`exec` cost, but if + implementation by external commands is more efficient in specific parts, + `ble.sh` will use the external commands there. +- †3Q. *Why does `ble.sh` + use `make` to generate the script files? You should not use `make` for a + script framework.* --- A. Because it is not a good idea to directly edit a + large script file of tens of thousands of lines. I split the codebase of + `ble.sh` into source files of reasonable sizes and edit the source files. In + the build process, some source files are combined to form the main script + `ble.sh`, and some other files are arranged in appropriate places. The + reason for combining the files into one file instead of sourcing the related + files in runtime is to minimize the shell startup time, which has a large + impact on the shell experience. Opening and reading many files can take a + long time. Some people seem to be angry about `ble.sh` using `make` to build + and arrange script files. They seem to believe that one always needs to use + `make` with C/C++/Fortran compilers to generate binaries. They complain + about `ble.sh`'s make process, but it comes from the lack of knowledge on the + general principle of `make`. Some people seem to be angry about `ble.sh` + having C/C++ source codes in the repository, but they are used to update the + Unicode character table from the Unicode database when a new Unicode standard + appears. The generated table is included in the repository: + [`canvas.GraphemeClusterBreak.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.GraphemeClusterBreak.sh), + [`canvas.c2w.musl.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.c2w.musl.sh), + [`canvas.c2w.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.c2w.sh), + and + [`canvas.emoji.sh`](https://github.com/akinomyoga/ble.sh/blob/master/src/canvas.emoji.sh), + so there is no need to run these C/C++ programs in the build process. + Another C file is used as an adapter in an old system MSYS1, which is used + with an old compiler toolchain in Windows, but it will never be used in + Unix-like systems. Each file used in the build process is explained in + [`make/README.md`](make/README.md). + +# 1 Usage + +## 1.1 Build from source + +### Generate + +To generate `ble.sh`, `gawk` (GNU awk) and `gmake` (GNU make) (in addition to Bash and POSIX standard utilities) are required. +The file `ble.sh` can be generated using the following commands. +If you have GNU make installed on `gmake`, please use `gmake` instead of `make`. +```bash +git clone --recursive https://github.com/akinomyoga/ble.sh.git +cd ble.sh +make +``` + +A script file `ble.sh` will be generated in the directory `ble.sh/out`. + +### Try + +Then, you can load `ble.sh` in the Bash session using the `source` command: +```bash +source out/ble.sh +``` + +### Install + +To install `ble.sh` in a specified directory, use `make install`. + +``` +# INSTALL to ~/.local/share/blesh and ~/.local/share/doc/blesh +make install + +# INSTALL into a specified directory +make install INSDIR=/path/to/blesh +``` + +The install locations of `ble.sh` and related script files can be specified by +make variable `INSDIR`. The locations of the license files and the +documentation files can be specified by make variables `INSDIR_LICENSE` and +`INSDIR_DOC`, respectively. When `INSDIR` is specified, the default values of +`INSDIR_LICENSE` and `INSDIR_DOC` are `$INSDIR/licenses` and `$INSDIR/doc`. +When `INSDIR` and the below-mentioned `DESTDIR`/`PREFIX` are not specified, the +default values of `INSDIR`, `INSDIR_LICENSES`, and `INSDIR_DOC` are +`$data/blesh`, `$data/blesh/licenses`, and `$data/doc/blesh`, respectively, +where `$data` represents `${XDG_DATA_HOME:-$HOME/.local/share}/blesh`. + +When `USE_DOC=no` is specified, the documentation files are disabled. + +By default, the comment lines and blank lines in the script files are stripped +in the installation process. If you would like to keep these lines in the +script files, please specify the argument `strip_comment=no` to `make`. + +To set up `.bashrc` see [Sec. 1.3](#set-up-bashrc). + +### Package + +Package maintainers may use make variables `DESTDIR` and `PREFIX` to quickly +set up the default values for `INSDIR`, `INSDIR_LICENSE`, and `INSDIR_DOC`. + +```bash +# PACKAGE - Example 1 +make install DESTDIR=/tmp/blesh-package PREFIX=/usr/local + +# PACKAGE - Example 2 +make install DESTDIR="$build" PREFIX="$prefix" \ + INSDIR_LICENSE="$build/$prefix/share/licenses/blesh" + +# PACKAGE - Example 3 +make install DESTDIR="$build" PREFIX="$prefix" \ + INSDIR_LICENSE="$build/$prefix/share/blesh/doc" \ + INSDIR_DOC="$build/$prefix/share/blesh/doc" + +# PACKAGE - Example 4 +make install USE_DOC=no DESTDIR="$build" PREFIX="$prefix" +``` + +If make variable `DESTDIR` or `PREFIX` is specified instead of `INSDIR`, the +value of `INSDIR` is set to `$DESTDIR/$PREFIX/share/blesh`, and the default +install locations of the license and documentation files, `INSDIR_LICENSE` and +`INSDIR_DOC`, will be `$DESTDIR/$PREFIX/share/doc/blesh`. + +#### `_package.bash` + +When you want to tell `ble.sh` the way to update the package for `ble-update`, +you can place `_package.bash` at `${prefix}/share/blesh/lib/_package.bash`. +The file `_package.bash` is supposed to define a shell variable and a shell +function as illustrated in the following example (please replace `XXX` with a +name representing the package management system): + +```bash +# ${prefix}/share/blesh/lib/_package.bash + +_ble_base_package_type=XXX + +function ble/base/package:XXX/update { + update-the-package-in-a-proper-way + return 0 +} +``` + +When the shell function returns exit status 0, it means that the update has been successfully completed, and `ble.sh` will be reloaded automatically. +When the shell function returns exit status 6, the timestamp of `ble.sh` will be checked so `ble.sh` is reloaded only when `ble.sh` is actually updated. +When the shell function returns exit status 125, the default `ble.sh` update procedure is attempted. +Otherwise, the updating procedure is canceled, where any message explaining situation should be output by the shell function. +An example `_package.bash` for `AUR` can be found [here](https://aur.archlinux.org/cgit/aur.git/tree/blesh-update.sh?h=blesh-git). + +## 1.2 Download a tarball + +You can also download a tarball of `ble.sh` from GitHub releases. +See each release page for the description of downloading, trial and installation. +Many features are unavailable in the stable versions since they are significantly old compared to the devel version. + +- Devel [v0.4.0-devel3](https://github.com/akinomyoga/ble.sh/releases/tag/v0.4.0-devel3) (2023-04), [nightly build](https://github.com/akinomyoga/ble.sh/releases/tag/nightly) +- Stable [v0.3.4](https://github.com/akinomyoga/ble.sh/releases/tag/v0.3.4) (2019-02 fork) Enhanced completions +- Stable [v0.2.7](https://github.com/akinomyoga/ble.sh/releases/tag/v0.2.7) (2018-03 fork) Vim mode +- Stable [v0.1.15](https://github.com/akinomyoga/ble.sh/releases/tag/v0.1.15) (2015-12 fork) Syntax highlighting + +## 1.3 Set up `.bashrc` + +If you want to load `ble.sh` in interactive sessions of `bash` by default, usually one can just source `ble.sh` in `~/.bashrc`, +but a more reliable way is to add the following codes to your `.bashrc` file: + +```bash +# bashrc + +# Add this lines at the top of .bashrc: +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none + +# your bashrc settings come here... + +# Add this line at the end of .bashrc: +[[ ! ${BLE_VERSION-} ]] || ble-attach +``` + +Basically, when `source -- /path/to/ble.sh` and `ble-attach` are performed, +standard streams (`stdin`, `stdout`, and `stderr`) should not be redirected but should be connected to the controlling TTY of the current session. +Also, please avoid calling `source -- /path/to/ble.sh` in shell functions. +The detailed conditions where the above *more reliable setup* is needed are explained in [an answer in Discussion #254](https://github.com/akinomyoga/ble.sh/discussions/254#discussioncomment-4284757). + +## 1.4 User settings `~/.blerc` + +User settings can be placed in the init script `~/.blerc` (or +`${XDG_CONFIG_HOME:-$HOME/.config}/blesh/init.sh` if `~/.blerc` is not +available). The init script is a Bash script that is sourced during the load +of `ble.sh`, so any shell commands can be used in `~/.blerc`. If you want to +change the default path of the init script, you can add the option `--rcfile +INITFILE` to `source ble.sh` as the following example: A template for the init +script is available as the file +[`blerc.template`](https://github.com/akinomyoga/ble.sh/blob/master/blerc.template) +in the repository, but please note that you need to use the template in the +commit corresponding to your copy of `ble.sh`. + +```bash +# in bashrc + +# Example 1: ~/.blerc will be used by default +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none + +# Example 2: /path/to/your/blerc will be used +[[ $- == *i* ]] && source -- /path/to/blesh/ble.sh --attach=none --rcfile /path/to/your/blerc +``` + +## 1.5 Update + +You need Git (`git`), GNU awk (`gawk`) and GNU make (`make`). +For `ble-0.3+`, you can run `ble-update` in the session with `ble.sh` loaded: + +```bash +$ ble-update +``` + +For `ble.0.4+`, you can also update it outside the `ble.sh` session using + +```bash +$ bash /path/to/ble.sh --update +``` + +You can instead download the latest version by `git pull` and install it: + +```bash +cd ble.sh # <-- enter the git repository you already have +git pull +git submodule update --recursive --remote +make +make INSDIR="$HOME/.local/share/blesh" install +``` + +## 1.6 Uninstall + +Basically you can simply delete the installed directory and the settings that the user added. + +- Close all the `ble.sh` sessions (the Bash interactive sessions with `ble.sh`) +- Remove related user data. If you would like to keep them, you can skip these steps. + - Remove the added lines in `.bashrc`. + - Remove `blerc` files (`~/.blerc` or `~/.config/blesh/init.sh`) if any. + - Remove the state directory `~/.local/state/blesh` if any. +- Remove the directory where `ble.sh` is installed. When you use `out/ble.sh` + inside the working tree of the git repository, the installed directory is the + directory of the repository. When you use `ble.sh` installed by `make + install`, the installed directory is `/share/blesh` where `` + (default: `~/.local`) is the prefix specified to `make install` in the + installation stage. When you use the version extracted from a tarball, the + directory created by extracting the tarball is the installed directory. +- Remove the cache directory `~/.cache/blesh` if any. +- Remove the temporary directory `/tmp/blesh` if any [ Only needed when your system does not automatically clear `/tmp` ]. + +## 1.7 Troubleshooting + +- [Performance](https://github.com/akinomyoga/ble.sh/wiki/Performance) + describes hints for perfomance issue. +- [Reporting Issue](https://github.com/akinomyoga/ble.sh/wiki/Reporting-Issue) + describes information that you may check before reporting an issue. + +### Clearing cache + +It should not happen in theory, but users occasionally report that they +happened to become unable to input anything with `ble.sh`. We could not manage +to reproduce the problem or identify the cause so far, but it seems to be +solved by clearing the cache of `ble.sh` by running the following command from +another session without `ble.sh`: + +```console +$ bash /path/to/ble.sh --clear-cache +``` + +To start a session without `ble.sh`, one may directly edit `~/.bashrc` to +comment out the line sourcing `ble.sh`. Or one might launch a different shell +such as `ash`, `dash`, `ksh`, or `zsh`. Another option is to configure the +terminal so that the command-line options passed to the shell include `--norc`. +If the problem happens in the remote host and you do not have an access to the +session without `ble.sh`, you can non-interactively rename your `~/.bashrc`: + +```console +# Example (ssh) + +local$ ssh remote 'mv .bashrc .bashrc.backup' + +# Example (rsh) + +local$ rsh remote 'mv .bashrc .bashrc.backup' +``` + +# 2 Basic settings + +Here, some of the settings for `~/.blerc` are picked up. +You can find useful settings also in [Q\&A](https://github.com/akinomyoga/ble.sh/wiki/Q&A), +[Recipes](https://github.com/akinomyoga/ble.sh/wiki/Recipes), +and [`contrib` repository](https://github.com/akinomyoga/blesh-contrib). +The complete list of setting items can be found in the file [`blerc.template`](https://github.com/akinomyoga/ble.sh/blob/master/blerc.template). +For detailed explanations please refer to [Manual](https://github.com/akinomyoga/ble.sh/wiki). + +## 2.1 Vim mode + +For the vi/vim mode, check [the wiki page](https://github.com/akinomyoga/ble.sh/wiki/Vi-(Vim)-editing-mode). + +## 2.2 Disable features + +One of frequently asked questions is the way to disable a specific feature that +`ble.sh` adds. Here the settings for disabling features are summarized. See +also the settings +[`config/readline`](https://github.com/akinomyoga/blesh-contrib/blob/master/config/readline.bash), +which can be loaded by `ble-import config/readline` to make `ble.sh`'s behavior +similar to Readline. + +```bash +# Disable syntax highlighting +bleopt highlight_syntax= + +# Disable highlighting based on filenames +bleopt highlight_filename= + +# Disable highlighting based on variable types +bleopt highlight_variable= + +# Disable auto-complete (Note: auto-complete is enabled by default in bash-4.0+) +bleopt complete_auto_complete= +# Tip: you may instead specify the delay of auto-complete in millisecond +bleopt complete_auto_delay=300 + +# Disable auto-complete based on the command history +bleopt complete_auto_history= + +# Disable ambiguous completion +bleopt complete_ambiguous= + +# Disable menu-complete by TAB +bleopt complete_menu_complete= + +# Disable menu filtering (Note: auto-complete is enabled by default in bash-4.0+) +bleopt complete_menu_filter= + +# Disable EOF marker like "[ble: EOF]" +bleopt prompt_eol_mark='' +# Tip: you may instead specify another string: +bleopt prompt_eol_mark='⏎' + +# Disable error exit marker like "[ble: exit %d]" +bleopt exec_errexit_mark= +# Tip: you may instead specify another string: +bleopt exec_errexit_mark=$'\e[91m[error %d]\e[m' + +# Disable elapsed-time marker like "[ble: elapsed 1.203s (CPU 0.4%)]" +bleopt exec_elapsed_mark= +# Tip: you may instead specify another string +bleopt exec_elapsed_mark=$'\e[94m[%ss (%s %%)]\e[m' +# Tip: you may instead change the threshold of showing the mark +bleopt exec_elapsed_enabled='sys+usr>=10*60*1000' # e.g. ten minutes for total CPU usage + +# Disable exit marker like "[ble: exit]" +bleopt exec_exit_mark= + +# Disable some other markers like "[ble: ...]" +bleopt edit_marker= +bleopt edit_marker_error= +``` + +## 2.3 CJK Width + +The option `char_width_mode` controls the width of the Unicode characters with `East_Asian_Width=A` (Ambiguous characters). +Currently, four values `emacs`, `west`, `east`, and `auto` are supported. With the value `emacs`, the default width in emacs is used. +With `west`, all the ambiguous characters have width 1 (Hankaku). With `east`, all the ambiguous characters have width 2 (Zenkaku). +With `auto`, the width mode `west` or `east` is automatically chosen based on the terminal behavior. +The default value is `auto`. The appropriate value should be chosen in accordance with your terminal behavior. +For example, the value can be changed to `west` as: + +```bash +bleopt char_width_mode='west' +``` + +## 2.4 Input Encoding + +The option `input_encoding` controls the encoding scheme used in the decode of input. Currently `UTF-8` and `C` are available. With the value `C`, byte values are directly interpreted as character codes. The default value is `UTF-8`. For example, the value can be changed to `C` as: + +```bash +bleopt input_encoding='C' +``` + +## 2.5 Bell + +The option `edit_bell` controls the behavior of the edit function (widget) +called `bell`. It is a colon-separated list of the values `vbell`, `abell`, +and `visual`. When a value is contained, the corresponding type of the bell is +enabled. The value `abell` corresponds to the audible bell, which prints ASCII +Control Character BEL (0x07) will be written to `stderr`. The value +`vbell` corresponds to the visible bell, which shows the message in the +terminal display. The value `visual` corresponds to the visual bell, which +flashes the terminal screen by turning on the DECSCNM mode for a +short moment. By default, only the audible bell is enabled. + +The option `vbell_default_message` specifies the default message shown by the +visual bell. The default value of this setting is `' Wuff, -- Wuff!! '`. The +option `vbell_duration` specifies the display duration of the visual-bell +message. The unit is a millisecond. The default value is `2000`. The option +`vbell_align` specifies the position of `vbell` by `left`, `center`, or +`right`. + +For example, the audible bell can be disabled, and the visual bell can be set +up as: + +```bash +bleopt edit_bell=vbell vbell_{default_message=' BEL ',duration=3000,align=right} +``` + +## 2.6 Highlight Colors + +The colors and attributes used in the syntax highlighting are controlled by the function `ble-face`. The following code reproduces the default configuration: +```bash +# highlighting related to editing +ble-face -s region bg=60,fg=231 +ble-face -s region_target bg=153,fg=black +ble-face -s region_match bg=55,fg=231 +ble-face -s region_insert fg=27,bg=254 +ble-face -s disabled fg=242 +ble-face -s overwrite_mode fg=black,bg=51 +ble-face -s vbell reverse +ble-face -s vbell_erase bg=252 +ble-face -s vbell_flash fg=green,reverse +ble-face -s prompt_status_line fg=231,bg=240 + +# syntax highlighting +ble-face -s syntax_default none +ble-face -s syntax_command fg=brown +ble-face -s syntax_quoted fg=green +ble-face -s syntax_quotation fg=green,bold +ble-face -s syntax_escape fg=magenta +ble-face -s syntax_expr fg=33 +ble-face -s syntax_error bg=203,fg=231 +ble-face -s syntax_varname fg=202 +ble-face -s syntax_delimiter bold +ble-face -s syntax_param_expansion fg=133 +ble-face -s syntax_history_expansion bg=94,fg=231 +ble-face -s syntax_function_name fg=99,bold +ble-face -s syntax_comment fg=242 +ble-face -s syntax_glob fg=198,bold +ble-face -s syntax_brace fg=37,bold +ble-face -s syntax_tilde fg=63,bold +ble-face -s syntax_document fg=100 +ble-face -s syntax_document_begin fg=100,bold +ble-face -s command_builtin_dot fg=red,bold +ble-face -s command_builtin fg=red +ble-face -s command_alias fg=teal +ble-face -s command_function fg=99 +ble-face -s command_file fg=green +ble-face -s command_keyword fg=blue +ble-face -s command_jobs fg=red +ble-face -s command_directory fg=33,underline +ble-face -s command_suffix fg=231,bg=28 +ble-face -s command_suffix_new fg=231,bg=124 +ble-face -s filename_directory underline,fg=33 +ble-face -s filename_directory_sticky underline,fg=231,bg=26 +ble-face -s filename_link underline,fg=teal +ble-face -s filename_orphan underline,fg=16,bg=224 +ble-face -s filename_executable underline,fg=green +ble-face -s filename_setuid underline,fg=black,bg=220 +ble-face -s filename_setgid underline,fg=black,bg=191 +ble-face -s filename_other underline +ble-face -s filename_socket underline,fg=cyan,bg=black +ble-face -s filename_pipe underline,fg=lime,bg=black +ble-face -s filename_character underline,fg=231,bg=black +ble-face -s filename_block underline,fg=yellow,bg=black +ble-face -s filename_warning underline,fg=red +ble-face -s filename_url underline,fg=blue +ble-face -s filename_ls_colors underline +ble-face -s varname_array fg=orange,bold +ble-face -s varname_empty fg=31 +ble-face -s varname_export fg=200,bold +ble-face -s varname_expr fg=99,bold +ble-face -s varname_hash fg=70,bold +ble-face -s varname_new fg=34 +ble-face -s varname_number fg=64 +ble-face -s varname_readonly fg=200 +ble-face -s varname_transform fg=29,bold +ble-face -s varname_unset fg=245 +ble-face -s argument_option fg=teal +ble-face -s argument_error fg=black,bg=225 + +# highlighting for completions +ble-face -s auto_complete fg=238,bg=254 +ble-face -s menu_complete_match bold +ble-face -s menu_complete_selected reverse +ble-face -s menu_desc_default none +ble-face -s menu_desc_type ref:syntax_delimiter +ble-face -s menu_desc_quote ref:syntax_quoted +ble-face -s menu_filter_fixed bold +ble-face -s menu_filter_input fg=16,bg=229 +``` + +The current list of faces can be obtained by the following command (`ble-face` without arguments): +```console +$ ble-face +``` + +The color codes can be checked in output of the function `ble-color-show` (defined in `ble.sh`): +```console +$ ble-color-show +``` + +## 2.7 Key Bindings + +Key bindings can be controlled with the shell function, `ble-bind`. +For example, with the following setting, "Hello, world!" will be inserted on typing C-x h +```bash +ble-bind -f 'C-x h' 'insert-string "Hello, world!"' +``` + +The details on the key representation, such as C-x h in the above example, +are described in [Manual §3.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs). +The representations of Space, Tab, Enter, Backspace, Escape, etc. are described +in [Manual §3.1.1](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-kspecs-ret): +The space is represented as SP, +the tab key is represented as C-i or TAB depending on the terminal, +the enter/return key is represented as C-m or RET depending on the terminal, +and the backspace key is represented as C-?, DEL, C-h, or BS depending on the terminal. +The representations of modified special keys such as Ctrl+Return and Shift+Return are described +in [Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual): +If your terminal does not support `modifyOtherKeys`, you need to manually configure the escape sequences of modified special keys. + + +For another example, if you want to invoke a command on typing M-c, you can write it as follows: + +```bash +ble-bind -c 'M-c' 'my-command' +``` + +Or, if you want to invoke a edit function (designed for Bash `bind -x`) on typing C-r, you can write it as follows: + +```bash +ble-bind -x 'C-r' 'my-edit-function' +``` + +The existing key bindings are shown by the following command: +```console +$ ble-bind -P +``` + +The list of widgets is shown by the following command: +```console +$ ble-bind -L +``` + +Descriptions of widgets can be found in the manual on the wiki. + +If you want to run multiple widgets with a key, you can define your own widget by creating a function of the name `ble/widget/YOUR_WIDGET_NAME` +as illustrated in the following example. +It is highly recommended to prefix the widget name with `YOUR_NAME/`, `my/`, `blerc/`, `dotfiles/`, etc. +in order not to conflict with the names of the existing standard widgets. + +```bash +# Example of calling multiple widgets with the key C-t +function ble/widget/my/example1 { + ble/widget/beginning-of-logical-line + ble/widget/insert-string 'echo $(' + ble/widget/end-of-logical-line + ble/widget/insert-string ')' +} +ble-bind -f C-t my/example1 +``` + +## 2.8 fzf integration + +If you would like to use `fzf` in combination with `ble.sh`, you need to configure `fzf` using [the `contrib/fzf` integration](https://github.com/akinomyoga/blesh-contrib#pencil-fzf-integration) to avoid compatibility issues. +Please follow the instructions in the link for the detailed description. + +```bash +# blerc + +# Note: If you want to combine fzf-completion with bash_completion, you need to +# load bash_completion earlier than fzf-completion. This is required +# regardless of whether to use ble.sh or not. +source /etc/profile.d/bash_completion.sh + +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +``` + +The option `-d` of `ble-import` delays the initialization. In this way, the +fzf settings are loaded in background after the prompt is shown. See +[`ble-import` - Manual §8](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A78-Miscellaneous#user-content-fn-ble-import) +for details. + +### When you have additional configuration for fzf + +When you want to run codes of the additional configuration after the fzf +settings are loaded, you cannot simply write them after the above settings +because of the delayed loading of the fzf settings. In this case, there are +four options. The easiest way is to drop the `-d` option (Option 1 below) to +disable the delayed loading: + +```bash +# [1] Drop -d +ble-import integration/fzf-completion +ble-import integration/fzf-key-bindings + +``` + +However, the above setting may make the initialization time longer. As another +option, you may also delay the additional settings with `ble-import -d` [2] or +`ble/util/idle.push` [3]. Or, you can hook into the loading of the fzf +settings by `ble-import -C` [4]. + +```bash +# [2] Use ble-import -d for additional settings +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble-import -d '' + +# [3] Use "ble/util/idle.push" for additional settings +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble/util/idle.push '' + +# [4] Use "ble-import -C" for additional settings +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +ble-import -C '' integration/fzf-key-bindings +``` + +# 3 Tips + +## 3.1 Use multiline mode + +When the command line string contains a newline character, `ble.sh` enters the MULTILINE mode. + +By typing C-v C-j or C-q C-j, you can insert a newline character in the command line string. +In the MULTILINE mode, RET (C-m) causes the insertion of a new newline character. +In the MULTILINE mode, the command can be executed by typing C-j. + +When the shell option `shopt -s cmdhist` is set (which is the default), +RET (C-m) inserts a newline if the current command line string is syntactically incomplete. + +## 3.2 Use vim editing mode + +If `set -o vi` is specified in `.bashrc` or `set editing-mode vi` is specified in `.inputrc`, the vim mode is enabled. +For details, please check [the wiki page](https://github.com/akinomyoga/ble.sh/wiki/Vi-(Vim)-editing-mode). + +## 3.3 Use `auto-complete` + +The feature `auto-complete` is available in Bash 4.0 or later. `auto-complete` automatically suggests a possible completion on user input. +The suggested contents can be inserted by typing S-RET +(when the cursor is at the end of the command line, you can also use right, C-f, or end to insert the suggestion). +If you want to insert only the first word of the suggested contents, you can use M-right or M-f. +If you want to accept the suggestion and immediately run the command, you can use C-RET +(if your terminal does not support special key combinations like C-RET, please check +[Manual §3.6.4](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A73-Key-Binding#user-content-sec-modifyOtherKeys-manual)). + +## 3.4 Use `sabbrev` (static abbrev expansions) + +By registering words to `sabbrev`, the words can be expanded to predefined strings. +When the cursor is just after a registered word, typing SP causes the `sabbrev` expansion. +For example, with the following settings, when you type SP after the string `command L`, the command line will be expanded to `command | less`. + +```bash +# blerc +ble-sabbrev L='| less' +``` + +The sabbrev names that start with `\` plus alphabetical letters are also recommended since it is unlikely to conflict with real words that are a part of the executed command. + +```bash +# blerc +ble-sabbrev '\L'='| less' +``` + +The sabbrevs starting with `~` can be expanded also by /. This can be used to approximate Zsh's named directories. +For example, with the following settings, typing `~mybin/` expands it to e.g. `/home/user/bin/` (where we assumed `HOME=/home/user`). + +```bash +# blerc + +ble-sabbrev "~mybin=$HOME/bin" +``` + +See [the sabbrev section in Manual](https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A77-Completion#user-content-sec-sabbrev) for more usages. + +# 4 Contributors + +I received much feedback from many people in GitHub Issues/PRs. +I thank all such people for supporting the project. +Among them, the following people have made particularly significant contributions. + +- [`@cmplstofB`](https://github.com/cmplstofB) helped me implement vim-mode by testing it and giving me a lot of suggestions. +- [`@dylankb`](https://github.com/dylankb) reported many issues with the fzf integration, initialization, etc. +- [`@rux616`](https://github.com/rux616) reported several issues and created a PR for fixing the default path of `.blerc` +- [`@timjrd`](https://github.com/timjrd) suggested and contributed to performance improvements in completion. +- [`@3ximus`](https://github.com/3ximus) reported many issues for a wide variety of problems. +- [`@SuperSandro2000`](https://github.com/SuperSandro2000) reported many issues related to NixOS and others diff --git a/.local/share/doc/blesh/Release.md b/.local/share/doc/blesh/Release.md new file mode 100644 index 0000000..c3fe066 --- /dev/null +++ b/.local/share/doc/blesh/Release.md @@ -0,0 +1,797 @@ +# ble-0.4.0-devel3 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.4.0-devel3.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel3/ble-0.4.0-devel3.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel3/ble-0.4.0-devel3.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel3/ble-0.4.0-devel3.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.4.0-devel3.tar.xz +source ble-0.4.0-devel3/ble.sh + +# INSTALL (quick) +tar xJf ble-0.4.0-devel3.tar.xz -C ~/.local/share/blesh +echo 'source ~/.local/share/blesh' >> ~/.bashrc + +# INSTALL (more robust) +tar xJf ble-0.4.0-devel3.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none +# Add the following line at the end of ~/.bashrc +[[ ${BLE_VERSION-} ]] && ble-attach +``` + +-------------------------------------------------------------------------------- +# ble-0.3.4 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.3.4.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.3.4/ble-0.3.4.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.3.4/ble-0.3.4.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.3.4/ble-0.3.4.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.3.4.tar.xz +source ble-0.3.4/ble.sh + +# INSTALL +tar xJf ble-0.3.4.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none +# Add the following line at the end of ~/.bashrc +[[ ${BLE_VERSION-} ]] && ble-attach +``` + +## blesh-0.3 Fixes +- decode: fix `bind` emulation in .bashrc (v0.3) 742777e +- global: pick fixes and changes from ble-0.1..0.2 backports 78bbc5e +- bump 0.3.4 9da6774 + +## Fixes +- complete: fix a problem that candidates are not updated after menu-filter (reported by 3ximus) `#D1428` 1c7786e (master: 98fbc1c) +- edit: work around the wrong job information of Bash in trap handlers (reported by 3ximus) `#D1435` `#D1436` d40847f (master: bc4735e) +- edit (command-help): work around the Bash bug that tempenv vanishes with `builtin eval` `#D1438` cc8ca96 (master: 8379d4a) +- global: suppress missing locale errors (reported by 3ximus) `#D1440` b52a798 (master: 4d3c595) +- edit (sword): fix definition of `sword` (shell words) `#D1441` 2370bce (master: f923388) +- edit (`kill-forward-logical-line`): fix a bug not deleting newline at the end of the line `#D1443` 2a8a7f6 (master: 09cf7f1) +- global: work around bash-4.2 bug of `declare -gA` (reported by 0xC0ncord) `#D1470` 2f85ed3 (master: 8856a04) +- global: fix declaration of associative arrays for `ble-reload` (reported by 0xC0ncord) `#D1471` 422de69 (master: 3cae6e4) +- util (`ble/util/msleep`): fix hang in Cygwin by swithing from `/dev/udp/0.0.0.0/80` to `/dev/zero` `#D1452` 5ace564 (master: d4d718a) +- syntax: fix broken AST with `[[` keyword `#D1454` 1d48e79 (master: 69658ef) +- benchmark (`ble-measure`): work around a locale-dependent decimal point of `EPOCHREALTIME` (reported by 3ximus) `#D1460` f3833ad (master: 1aa471b) +- util (`ble/util/msleep`): work around the bash-4.3 bug of `read -t` (reported by 3ximus) `#D1468` `#D1469` 70797cf (master: 4ca9b2e) +- bind: work around broken `cmd_xmap` after switching the editing mode `#D1478` 909f461 (master: 8d354c1) +- edit: clear graphic rendition on newlines and external commands `#D1479` 59ede5c (master: 18bb2d5) +- decode (rlfunc): work around incomplete bytes in keyseq (reported by onelittlehope) `#D1483` 948a38d (master: 3559658) beb0383 37363be +- canvas: fix a glitch that SGR at the end of command line is applied to new lines `#D1498` 6871634 (master: 4bdfdbf) +- syntax: fix a bug that `eval() { :; }`, `declare() { :; }` are not treated as function definition `#D1529` 6c1d295 (master: b429095) +- decode: fix a hang on attach failure by cache corruption `#D1531` d4b0700 (master: 24ea379) +- progcomp: fix non-working `complete -C prog` (reported by Archehandoro) `#D1535` 47b3ade (master: 026432d) +- bind: fix a problem that `bind '"seq":"key"'` causes a loop macro `bind -s key key` (reported by thanosz) `#D1536` e2a502d (master: ea05fc5) +- main: work around `. ble.sh --{test,update,clear-cache}` in intereactive sessions `#D1555` 500915f (master: bbc2a90) +- main: fix reloading after ble-update (fixup 500915f (master: bbc2a90)) (fixed by oc1024) `#D1558` 9372670 +- main: fix exit status for `bash ble.sh --test` (fixup 500915f (master: bbc2a90)) `#D1558` 641238a +- main: work around sourcing `ble.sh` inside subshells `#D1554` 500915f (master: bbc2a90) +- global: use a better workaround of bash-4.2 `declare -gA` by separating assignment `#D1567` 40827ef (master: 2408a20) +- util: work around bash-3.0 bug `"${scal[@]/xxx}"` `#D1570` 7e10cf4 (master: 24f79da) +- syntax: fix a bug that argument completion is attempted in nested commands (reported by huresche) `#D1579` 6987ae8 (master: 301d40f) +- edit (brackated-paste): fix incomplete `CR => LF` conversion (reported by alborotogarcia) `#D1587` 2651c8e (master: 8d6da16) +- main (adjust-bash-options): adjust `LC_COLLATE=C` `#D1588` 94cc9d2 (master: e87ac21) +- highlight (`layer:region`): fix blocked lower-layer changes without selection changes `#D1596` d40d42a (master: 5ede3c6) +- complete (`auto-menu`): fix sleep loops by clock/sclock difference `#D1597` 0abc15b (master: 53dd018) +- util: work around the Bash 3 bug of array assignments with `^A` and `^?` in Bash 3.2 `#D1614` 0eac4df (master: b9f7611) +- benchmark (`ble-measure`): fix a bug that the result is always 0 in Bash 3 and 4 (fixup bbc2a904) `#D1615` bc3cdab (master: a034c91) +- decode, canvas, etc.: explicitly treat CSI arguments as decimal numbers (reported by GorrillaRibs) `#D1625` 97bce68 (master: c6473b7) 2ea48d7 +- edit: fix a bug that `command-help` doesn't work `#D1635` c375fbb (master: 0f6a083) +- complete: fix a task scheduling bug of referencing two different clocks (reported by rashil2000) `#D1636` df9f932 (master: fea5f5b) +- canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 00f9ce8 (master: 68ee111) +- decode: fix a bug that the characters input while initialization are delayed `#D1670` 734bd50 (master: 430f449) +- util (`ble/util/readfile`): fix a bug of always exiting with 1 in `bash <= 3.2` (reported by laoshaw) `#D1678` 51d244a (master: 61705bf) +- trace: fix wrong positioning of the ellipses on overflow `#D1684` dea87c7 (master: b90ac78) +- mandb: generate completions of options also for the empty word `#D1689` dea87c7 (master: b90ac78) +- complete: do not generate keywords for quoted command names `#D1691` 5b1e5be (master: 60d244f) +- menu (menu-style:align): fix the failure of delaying `ble/canvas/trace` on items (motivated by banoris) `#D1710` 3d56593 (master: acc9661) +- complete: fix empty completions with `FIGNORE` (reported by seanfarley) `#D1711` 49e75ee (master: 144ea5d) +- main: fix the message of owner errors of cache directories (reported by zim0369) `#D1712` 02aeb4a (master: b547a41) +- util (`ble/string#escape-for-bash-specialchars`): fix escaping of TAB `#D1713` accf8f3 (master: 7db3d2b) +- util (visible-bell): erase visible-bell before running external commands `#D1723` 72a11ae (master: 0da0c1c) +- util (`ble/function`): work around `shopt -u extglob` `#D1725` 3819e83 (master: 952c388) +- syntax: fix uninitialized syntax-highlighting in bash-3.2 `#D1731` 7bd03a5 (master: e3f5bf7) +- main: fix the workaround for `set -eu` and refactor `#D1743` a949af0 (master: 6a946f0) +- progcomp: retry completions on `$? == 124` also for non-default completions (reported by SuperSandro2000) `#D1759` e217932 (master: 82b9c01) +- util (`ble/util/import`): work around filenames with bash special characters `#D1763` 4179e3d (master: b27f758) +- edit: fix the restore failure of `PS1` and `PROMPT_COMMAND` on `ble-detach` `#D1784` 4f4c924 (master: b9fdaab) +- complete: do not attempt an independent rhs completion for arguments (reported by rsteube) `#D1787` 7bf32ca (master: f8bbe2c) +- history: work around possible dirty prefix `*` in the history output `#D1808` 84184ce (master: 64a740d) +- util(`ble/util/eval-pathname-expansion`): fix restoring shopt options in bash-4.0 `#D1825` d3b3f7b (master: 736f4da) +- decode: fix the workaround for `set -e` with `--prompt=attach` `#D1832` 51cb735 (master: 5111323) +- decode (`encoding:C`): fix initialization for isolated ESC `#D1839` aaa74b5 (master: c3bba5b) +- main. util: fix problems of readlink etc. found by test in macOS (reported by aiotter) `#D1849` a1adc7f (master: fa955c1) `#D1855` a22e145 +- progcomp: fix a bug that `COMP_WORDBREAKS` is ignored `#D1872` b338066 (master: 4d2dd35) +- global: quote `return $?` `#D1884` 4f14f7a (master: 801d14a) +- main: fix adjustments of bash options (reported by rashil2000) `#D1895` 7bd25c9 (master: 138c476) +- decode: fix a bug that the tab completion do not work with bash-4.4 and lower `#D1928` 6351e7f (master: 7da9bce) +- bind: fix M-C-@, C-x C-@, and M-C-x (`bash-4.2 -o emacs`) `#D1920` 02f45f3 (master: a410b03) +- complete: fix non-working ambiguous path completion with `..` and `.` in the path `#D1930` fdb76e9 (master: 632e90a) +- main (ble-reload): fix failure by non-existent rcfile `#D1931` 58de996 (master: b7ae2fa) +- util: fix ble/util/clock in bash-4.2 [main: fix the timestamp in the session ID in bash-4.2] `#D1954` 9a24b1e (master: 651c70c1) +- edit (`ble/textarea#render`): fix interleaving outputs to `_ble_util_buffer` and `DRAW_BUFF` `#D1987` 62519a7 (master: 6d61388) +- keymap/vi (`operator:filter`): do not append newline at the end of line `#D1994` 8207d4f (master: bce2033) +- keymap/vi (`expand-range-for-linewise-operator`): fix the end point being not extended `#D1994` 8207d4f (master: bce2033) +- syntax: fix unrecognized asignment `echo arr[i]+=rhs` [sabbrev: apply sabbrev to right-hand sides of variable assignments] `#D2007` 948f50f (master: 41faa494) + +## Changes +- syntax: exclude \\ + LF at the word beginning from words (motivated by cmplstofB) `#D1431` 1b00fd2 (master: 67e62d6) +- edit: preserve the state of `READLINE_{LINE,POINT,MARK}` `#D1437` cc8ca96 (master: 8379d4a) +- edit: change default behavior of C-w and M-w to operate on backward words `#D1448` b1fd84a (master: 47a3301) +- edit (`ble/builtin/read`): cancel by C-d on an empty line `#D1473` 4fae77a (master: ecb8888) +- syntax: change syntax context after `time ;` and `! ;` for Bash 4.4 `#D1477` e55e3df (master: 4628370) +- decode (rlfunc): update mapping `vi-replace` in `imap` and `vi-editing-mode` in `nmap` (reported by onelittlehope) `#D1484` 3a2d0fe (master: f2ca811) +- prompt: invalidate prompt and textarea on prompt setting changes `#D1492` e28f330 (master: 1f55913) +- main: accept non-regular files as `blerc` and add option `--norc` `#D1530` 4b0eb87 (master: 7244e2f) +- prompt: adjust behavior of `LINENO` and prompt sequence `\#` (reported by tycho-kirchner) `#D1542` f3668ba (master: 8b0257e) +- main: show notifications against debug versions of Bash `#D1612` 0ee8415 (master: 8f974aa) +- edit: suppress only `stderr` with `internal_suppress_bash_output` (motivated by rashil2000) `#D1646` b0a9021 (master: a30887f) +- prompt: do not evaluate `PROMPT_COMMAND` for subprompts `#D1654` 9c0e515 (master: 08e903e) +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` a602876 (master: 0525528) 88e2df5 +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 0525528 79efd42 (master: 88e2df5) +- syntax: revert 99f2234 (master: 371a5a4) and generate empty completion source on syntax error `#D1609` e09fcab +- syntax: do not start argument completions immediately after previous word (reported by EmilySeville7cfg) `#D1690` 99f2234 (master: 371a5a4) +- syntax: revert 371a5a4 and generate empty completion source on syntax error `#D1609` a1d1286 (master: e09fcab) +- canvas: do not insert explicit newlines on line folding if possible (reported by banoris) `#D1745` d878fce (master: 02b9da6) dc3827b +- edit (`ble-bind -x`): preserve multiline prompts on execution of `bind -x` commands (requested by SuperSandro2000) `#D1755` 240bfaa (master: 7d05a28) +- util (`ble/util/buffer`): hide cursor in rendering `#D1758` 5907567 (master: e332dc5) +- complete (`action:file`): always suffix `/` to complete symlinked directory names (reported by SuperSandro2000) `#D1759` ebdc58b (master: 397ac1f) +- edit: fix layout with `prompt_rps1` caused by missing `opts=relative` for `ble/textmap#update` `#D1769` e799191 (master: f6af802) +- edit (`ble-detach`): prepend a space to `stty sane` for `HISTIGNORE=' *'` `#D1796` 31bc2b7 (master: 26b532e) +- edit: the widgets `{kill,copy,delete}-region-or` now receives widgets as arguments `#D1021` e222c48 (master: bbbd155) +- decode (`bind`): do not treat non-beginning `#` as comments `#D1820` f9db7d8 (master: 65c4138) +- history: disable the history file when `HISTFILE` is empty `#D1836` 7153250 (master: 9549e83) +- main (`ble-reload`): preserve the original initialization options `#D1852` 8912d81 (master: d8c92cc) +- progcomp: reproduce arguments of completion functions passed by Bash `#D1872` b338066 (master: 4d2dd35) +- color: let `bleopt term_index_colors` override the default if specified `#D1878` e7c657c (master: 7d238c0) +- decode (`vi_imap-rlfunc.txt`): update the widget for `backward-kill-word` as `kill-backward-{u => c}word` `#D1896` 3c4e3a4 (master: e19b796) +- term (`_ble_term_TERM`): detect wezterm-20220408 `#D1909` f3a8382 (master: 486564a) +- keymap/vi (`decompose-meta`): translate S-a to A `#D1988` 9e0c187 (master: 600e845) +- term (`_ble_term_TERM`): detect konsole `#D1988` 9e0c187 (master: 600e845) ed53858 + +## Compatibility +- term: work around leaked DA2R in screen from outside terminal `#D1485` 4d77fab (master: e130619) +- util (`modifyOtherKeys`): work around a quirk of kitty (reported by NoahGorny) `#D1549` 823eb83 (master: f599525) +- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` d7d2a23 (master: 560160b) +- decode: identify `kitty` and treat `\e[27u` as isolated ESC (reported by lyiriyah) `#D1585` 2f7404e (master: c2a84a2) +- complete: suppress known error messages of `bash-completion` (reported by oc1024, Lun4m) `#D1622` 558322c (master: d117973) +- util (`modifyOtherKeys`): update the workaround for a new quiark of kitty `#D1627` 90d9284 (master: 3e4ecf5) +- main: work around `set -B` and `set -k` `#D1628` 55494eb (master: a860769) +- term: disable `modifyOtherKeys` and do not send `DA2` for `st` (requested by Shahabaz-Bagwan) `#D1632` 7e08766 (master: 92c7b26) +- cmap: add `st`-specific escape sequences for cursor keys `#D1633` 1391c90 (master: acfb879) +- cmap: distinguish find/select from home/end for openSUSE `inputrc.keys` (reported by cornfeedhobo) `#D1648` 886cc07 (master: c4d28f4) +- cmap: freeze the internal codes of find/select and kitty special keys `#D1674` 7d02058 (master: fdfe62a) +- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680` 5acb117 (master: a6b4e2c) +- util (`modifyOtherKeys`): use the kitty protocol for kitty 0.23+ which removes the support of `modifyOtherKeys` (reported by kovidgoyal) `#D1681` 696264b (master: ec91574) +- complete: work around the variable leaks by `virsh` completion from `libvirt` (reported by telometto) `#D1682` 7a65fc3 (master: f985b9a) +- stty: do not remove keydefs for C-u, C-v, C-w, and C-? (reported by laoshaw) `#D1683` ff8fb83 (master: 82f74f0) +- decode (`ble/builtin/bind`): improve compatibility of the deprecated form `bind key:rlfunc` (motivated by cmplstofB) `#D1698` c3904ff (master: b6fc4f0) +- main: work around `XDG_RUNTIME_DIR` of a different user by `su` (reported by zim0369) `#D1712` dbf58e4 (master: 8d37048) +- main (`ble/util/readlink`): work around non-standard or missing `readlink` (motivated by peterzky) `#D1720` 60595bd (master: a41279e) +- decode (`ble/builtin/bind`): fix a bug that only lowercase is accepted for deprecated form `bind key:rlfunc` (reported by returntrip) `#D1726` 43cf9b9 (master: a67458e) e363f1b +- decode (`ble/builtin/bind`): fix a bug that only lowercase is accepted for deprecated form `bind key:rlfunc` (reported by returntrip) `#D1726` a67458e dd358d7 (master: e363f1b) +- global: work around the arithmetic syntax error of `10#` in Bash-5.1 `#D1734` b321b57 (master: 7545ea3) +- global: adjust implementations for Bash 5.2 `patsub_replacement` `#D1738` 66ae615 (master: 4590997) +- main: check `/dev/tty` on startup (reported by andychu) `#D1749` e6c2855 (master: 711c69f) +- global: work around `shopt -s compat42` `#D1754` 1f254b5 (master: a75bb25) +- global: identify bash-4.2 bug that internal quoting of `${v/%$empty/"$rep"}` remains `#D1753` 1f254b5 (master: a75bb25) +- prompt: fix a bug of `ble/prompt/print` redundantly quoting `$` `#D1752` 1f254b5 (master: a75bb25) +- global: work around `compat42` quoting of `"${v/pat/"$rep"}"` `#D1751` 1f254b5 (master: a75bb25) +- util: add identification of Windows Terminal `wt` `#D1758` 5907567 (master: e332dc5) +- global: work around bash-3.0 bug that single quotes remains for `"${v-$''}"` `#D1774` 30440b2 (master: 9b96578) +- util (`modifyOtherKeys`): fix a bug that kitty protocol is never activated `#D1842` f8aeb51 (master: 14f3c81) +- util (`modifyOtherKeys`): work around delayed terminal identification `#D1842` f8aeb51 (master: 14f3c81) +- main: resolve empty `HOSTNAME` [originally: contrib: add `histdb`] `#D1925` e82230e (master: 44d9e104) +- main: warn empty `LANG` [originally: main: support an option `--inputrc={diff,all,user,none}`] `#D1926` ede4ee7 (master: 92f2006) +- term (`terminology`): work around terminal glitches `#D1946` ccb93a5 (master: 9a1b4f9) +- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` 992131c (master: 5d14cf1) +- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` 1f0d8e1 (master: 1e7b884) +- util (function#evaldef): work around `set -e` [progcomp: work around slow `nix` completion] `#D1997` 2ab4e4b (master: 2c1aacfc) +- util (`string#quote-word`): work around `set -ue` [util, edit: add `ble/util/message` and `ble append-line`] `#D2001` 2317562 (master: 2a524f34) +- complete: suppress error messages from `_adb` `#D2005` 2f77171 (master: f2aa32b) +- edit: restore `PS1` while processing `bind -x` `#D2024` 604c092 (master: 2eadcd5) + +## Optimization +- complete (`ble/complete/source:file`): remove slow old codes (reported by timjrd) `#D1512` 60a33e2 (master: e5be0c1) +- util (`ble/util/assign`): work around subshell conflicts `#D1578` 4117d1b (master: 6e4bb12) +- prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` a3cfd0d (master: 521aff9) +- util (`ble/string#split`): optimize `#D1826` 9dcbbd4 (master: 7bb10a7) +- debug: add `ble/debug/profiler` (motivated by SuperSandro2000) `#D1824` f629698 11aa4ab 9dcbbd4 (master: 7bb10a7) +- global: avoid passing arbitrary strings through `awk -v var=value` `#D1827` 9edb1aa (master: 82232de) + +## Internal changes and fixes +- main: include hostname in local runtime directory `#D1444` 3e648a9 (master: 6494836) +- benchmark (`ble-measure`): support `-T TIME` and `-B TIME` option `#D1460` f3833ad (master: 1aa471b) +- global: fix status check for read timeout `#D1467` f190f9a (master: e886883) +- util, etc: ensure each function to work with arbitrary `IFS` `#D1490` `#D1491` c33fad0 (master: 5f9adfe) +- global: work around `localvar_inherit` for varname-list init `#D1566` 8c67b79 (master: 5c2edfc) +- util: fix `ble/util/dense-array#fill-range` e397120 (master: a46fdaf) +- util: fix leak variables `buff`, `trap`, `{x,y}{1,2}` `#D1572` 82113e9 (master: 5967d6c) +- util: fix leak variables `#D1643` 0817df6 (master: fcf634b) +- edit (`command-help`): use `ble/util/assign/.mktmp` to determine the temporary filename `#D1663` 2ff6078 (master: 1af0800) +- Makefile: add fallback Makefile for BSD make `#D1805` ea8b966 (master: e5d8d00) +- util, decode, vi: fix leak variables `#D1933` 9e2e823 (master: 8d5cab8) +- syntax: fix code formatting [originally: complete: support auto-complete sources] `#D1938` 450f70b (master: 00cae745) +- main: use builtin for ":" [histdb: support timeout of background processes] `#D1971` 482ddb5 (master: e0566bdc) +- global: normalize to `_a-zA-Z` [sabbrev: apply sabbrev to right-hand sides of variable assignments] `#D2006` a101fe6 (master: 41faa494) +- util (restore-vars): work around `set -u` [lib: add `util.bgproc` for `ble/util/bgproc`] `#D2017` 8787ca5 (master: 7803305f) +- util: update `ble/util/conditional-sync` [util.bgproc: increase frequency of bgproc termination check] `#D2027` 79fd13c (master: 8d623c1) + +## Test +- util (ble/util/s2bytes): clear locale cache `#D1881` 45f3df3 (master: 2e1a7c1) +- util (ble/util/s2c): work around intermediate mbstate of bash <= 5.2 `#D1881` 45f3df3 (master: 2e1a7c1) +- util (ble/encoding:UTF-8/b2c): fix interpretation of leading byte `#D1881` 45f3df3 (master: 2e1a7c1) +- complete: fix syntax error for bash-3.0 `#D1881` b534799 (master: 0b3e611) + +## Documentation +- blerc: rename from `blerc` to `blerc.template` `#D1899` 3c4e3a4 (master: e19b796) +- wiki/Q&A: add item for defining a widget calling multiple widgets (motivated by micimize) `#D1898` 3c4e3a4 (master: e19b796) +- blerc: add frequently used keybindings (motivated by KiaraGrouwstra, micimize) `#D1896` `#D1897` 3c4e3a4 (master: e19b796) + +## Contrib +- fzf-key-bindings: fix a problem that `modifyOtherKeys` is not reflected (reported by SuperSandro2000) `#D1908` f3a8382 (master: 486564a) + +## New features +- canvas: update emoji database and support `bleopt emoji_version` (motivated by endorfina) `#D1454` 3f6c9b9 (master: d1f8c27) +- syntax: support tilde expansions in parameter expansions `#D1513` e32914f (master: 0506df2) +- prompt (`contrib/prompt-git`): support dirty checking `#D1601` 50a0094 (master: b2713d9) +- util (`bleopt`, `bind`): fix error message and exit status, respectively `#D1640` 29728b1 (master: b663cee) +- edit: support bash-5.2 binding of `prior/next` to `history-search-{for,back}ward` `#D1661` a3a353e (master: d26a6e1) +- util: suppress false warnings of `bind` inside non-interactive shells (reported by wukuan405) `#D1823` 82c9934 (master: 1e19a67) +- auto-complete: cancel auto-complete for `magic-space` `#D1913` 05c0888 (master: 01b4f67) +- complete: support ambiguous completion for command paths `#D1922` 6d1e1ba (master: 8a716ad) +- syntax: support context after `((...))` and `[[ ... ]]` in bash-5.2 `#D1962` 57d7674 (master: 67cb967) + +-------------------------------------------------------------------------------- +# ble-0.2.7 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.2.7.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.2.7/ble-0.2.7.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.2.7/ble-0.2.7.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.2.7/ble-0.2.7.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.2.7.tar.xz +source ble-0.2.7/ble.sh + +# INSTALL +tar xJf ble-0.2.7.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach +# Add the following line at the end of ~/.bashrc +((_ble_bash)) && ble-attach +``` + +## blesh-0.2 fixes +- global: fix `ble/{is- => util/is}function` 5e82ca7a +- global: pick fixes and changes from ble-0.1 backports 013eb1cd +- complete: fix up 4df15e1e f02bd2a5 +- bump 0.2.7 1118c803 + +## Fixes +- edit: work around the wrong job information of Bash in trap handlers (reported by 3ximus) `#D1435` `#D1436` 795a647c (master: bc4735e0) +- edit (sword): fix definition of `sword` (shell words) `#D1441` 5e73cf6b (master: f9233889) +- edit (`kill-forward-logical-line`): fix a bug not deleting newline at the end of the line `#D1443` 03787a2d (master: 09cf7f14) +- global: work around bash-4.2 bug of `declare -gA` (reported by 0xC0ncord) `#D1470` a2ace444 (master: 8856a04f) +- global: fix declaration of associative arrays for `ble-reload` (reported by 0xC0ncord) `#D1471` 533eba77 (master: 3cae6e4d) +- util (`ble/util/msleep`): fix hang in Cygwin by swithing from `/dev/udp/0.0.0.0/80` to `/dev/zero` `#D1452` 46992e79 (master: d4d718ab) +- syntax: fix broken AST with `[[` keyword `#D1454` 0482bf64 (master: 69658efc) +- util (`ble/util/msleep`): work around the bash-4.3 bug of `read -t` (reported by 3ximus) `#D1468` `#D1469` fad78ea5 (master: 4ca9b2e2) +- bind: work around broken `cmd_xmap` after switching the editing mode `#D1478` 97ca1171 (master: 8d354c1b) +- edit: clear graphic rendition on newlines and external commands `#D1479` 759b96dd (master: 18bb2d5c) +- canvas: fix a glitch that SGR at the end of command line is applied to new lines `#D1498` a6ac1216 (master: 4bdfdbf8) +- syntax: fix a bug that `eval() { :; }`, `declare() { :; }` are not treated as function definition `#D1529` a4cda9c3 (master: b4290958) +- decode: fix a hang on attach failure by cache corruption `#D1531` a4c13ab8 (master: 24ea3792) +- benchmark (`ble-measure`): fix a bug that the result is always 0 in Bash 3 and 4 (fixup 8eb493a9 (master: bbc2a904)) `#D1615` a034c91 +- main: work around `. ble.sh --{test,update,clear-cache}` in intereactive sessions `#D1555` 8eb493a9 (master: bbc2a904) +- main: fix reloading after ble-update (fixup 8eb493a9 (master: bbc2a904)) (fixed by oc1024) `#D1558` 9372670 +- main: fix exit status for `bash ble.sh --test` (fixup 8eb493a9 (master: bbc2a904)) `#D1558` 641238a +- main: work around sourcing `ble.sh` inside subshells `#D1554` 8eb493a9 (master: bbc2a904) +- global: use a better workaround of bash-4.2 `declare -gA` by separating assignment `#D1567` 0b7de999 (master: 2408a207) +- edit (brackated-paste): fix incomplete `CR => LF` conversion (reported by alborotogarcia) `#D1587` ac738bb4 (master: 8d6da161) +- highlight (`layer:region`): fix blocked lower-layer changes without selection changes `#D1596` 650140ff (master: 5ede3c69) +- util: work around the Bash 3 bug of array assignments with `^A` and `^?` in Bash 3.2 `#D1614` 0ed7f6dc (master: b9f76118) +- benchmark (`ble-measure`): fix a bug that the result is always 0 in Bash 3 and 4 (fixup bbc2a904) `#D1615` 28e8dfed (master: a034c91a) +- decode, canvas, etc.: explicitly treat CSI arguments as decimal numbers (reported by GorrillaRibs) `#D1625` c9e4198b (master: c6473b78) 2ea48d7 +- edit: fix a bug that `command-help` doesn't work `#D1635` b992bb5d (master: 0f6a0834) +- canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 56b77a83 (master: 68ee1112) +- util (`ble/util/readfile`): fix a bug of always exiting with 1 in `bash <= 3.2` (reported by laoshaw) `#D1678` 5b843bb6 (master: 61705bf6) +- complete: do not generate keywords for quoted command names `#D1691` 7211b1ec (master: 60d244fe) +- complete: fix empty completions with `FIGNORE` (reported by seanfarley) `#D1711` 90f388aa (master: 144ea5db) +- main: fix the message of owner errors of cache directories (reported by zim0369) `#D1712` d2bf86c1 (master: b547a41a) +- syntax: fix uninitialized syntax-highlighting in bash-3.2 `#D1731` 6aa12c82 (master: e3f5bf74) +- progcomp: retry completions on `$? == 124` also for non-default completions (reported by SuperSandro2000) `#D1759` c641fb1b (master: 82b9c011) +- util (`ble/util/import`): work around filenames with bash special characters `#D1763` 7da5f048 (master: b27f7585) +- edit: fix the restore failure of `PS1` and `PROMPT_COMMAND` on `ble-detach` `#D1784` 47dfdd94 (master: b9fdaabd) +- history: work around possible dirty prefix `*` in the history output `#D1808` cc14f59c (master: 64a740d7) +- decode: fix the workaround for `set -e` with `--prompt=attach` `#D1832` 958aae6b (master: 51113237) +- main. util: fix problems of readlink etc. found by test in macOS (reported by aiotter) `#D1849` 8f0acf3d (master: fa955c1a) `#D1855` a22e145 +- global: quote `return $?` `#D1884` 9e10b54b (master: 801d14af) +- bind: fix M-C-@, C-x C-@, and M-C-x (`bash-4.2 -o emacs`) `#D1920` 342826f3 (master: a410b038) +- keymap/vi (`operator:filter`): do not append newline at the end of line `#D1994` 2a8e746f (master: bce20339) +- keymap/vi (`expand-range-for-linewise-operator`): fix the end point being not extended `#D1994` 2a8e746f (master: bce20339) +- syntax: fix unrecognized asignment `echo arr[i]+=rhs` [sabbrev: apply sabbrev to right-hand sides of variable assignments] `#D2006` 4ed4fd4f (master: 41faa494) +- syntax: fix unrecognized variable assignment of the form `echo arr[i]+=rhs` `#D2007` 4ed4fd4f (master: 41faa494) + +## Changes +- syntax: exclude \\ + LF at the word beginning from words (motivated by cmplstofB) `#D1431` 6044a485 (master: 67e62d64) +- edit: change default behavior of C-w and M-w to operate on backward words `#D1448` 787ff57f (master: 47a3301a) +- edit: the widgets `{kill,copy,delete}-region-or` now receives widgets as arguments `#D1021` 8f48aff1 (master: bbbd155f) +- edit (`ble/builtin/read`): cancel by C-d on an empty line `#D1473` 551bde3a (master: ecb8888d) +- syntax: change syntax context after `time ;` and `! ;` for Bash 4.4 `#D1477` 0b66cf4a (master: 46283706) +- prompt: invalidate prompt and textarea on prompt setting changes `#D1492` 54d310df (master: 1f559135) +- prompt: adjust behavior of `LINENO` and prompt sequence `\#` (reported by tycho-kirchner) `#D1542` 4b63b164 (master: 8b0257e2) +- main: show notifications against debug versions of Bash `#D1612` 608ac2ad (master: 8f974aa1) +- prompt: do not evaluate `PROMPT_COMMAND` for subprompts `#D1654` 5c0cfdef (master: 08e903e0) +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 2587bb01 (master: 05255282) 88e2df5 +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 0525528 5f638563 (master: 88e2df51) +- util (`ble/util/buffer`): hide cursor in rendering `#D1758` 4ecbbdc2 (master: e332dc5f) +- edit (`ble-detach`): prepend a space to `stty sane` for `HISTIGNORE=' *'` `#D1796` bd903716 (master: 26b532e7) +- history: disable the history file when `HISTFILE` is empty `#D1836` d97ca100 (master: 9549e831) +- keymap/vi (`decompose-meta`): translate S-a to A `#D1988` eaf66c7c (master: 600e845e) +- term (`_ble_term_TERM`): detect konsole `#D1988` eaf66c7c (master: 600e845e) ed53858 +- complete (`source:argument`): fallback to rhs completion also for `name+=rhs` `#D2006` 4ed4fd4f (master: 41faa494) + +## Compatibility +- highlight: fix a problem that the attribute of the last character is applied till EOL `#D1393` 36f9d809 (master: 2ddb1ba2) `#D1395` ef09932 +- highlight: fix a problem that the attribute of the last character is applied till EOL `#D1393` 2ddb1ba `#D1395` 6bcb4053 (master: ef099326) +- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` d7130d55 (master: 560160b0) +- main: work around `set -B` and `set -k` `#D1628` 3c97ae84 (master: a8607692) +- cmap: add `st`-specific escape sequences for cursor keys `#D1633` bf46e344 (master: acfb8790) +- cmap: distinguish find/select from home/end for openSUSE `inputrc.keys` (reported by cornfeedhobo) `#D1648` ad675556 (master: c4d28f40) +- cmap: freeze the internal codes of find/select and kitty special keys `#D1674` f41b8004 (master: fdfe62a4) +- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680` 93ae08d0 (master: a6b4e2ca) +- complete: work around the variable leaks by `virsh` completion from `libvirt` (reported by telometto) `#D1682` ee2ac075 (master: f985b9a4) +- stty: do not remove keydefs for C-u, C-v, C-w, and C-? (reported by laoshaw) `#D1683` c01487bf (master: 82f74f0a) +- main: work around `XDG_RUNTIME_DIR` of a different user by `su` (reported by zim0369) `#D1712` e5501a31 (master: 8d370486) +- main (`ble/util/readlink`): work around non-standard or missing `readlink` (motivated by peterzky) `#D1720` d785f5db (master: a41279ed) +- global: work around the arithmetic syntax error of `10#` in Bash-5.1 `#D1734` 2b55aa16 (master: 7545ea31) +- global: adjust implementations for Bash 5.2 `patsub_replacement` `#D1738` 359a3891 (master: 4590997a) +- main: check `/dev/tty` on startup (reported by andychu) `#D1749` 19fa0924 (master: 711c69f1) +- global: work around `shopt -s compat42` `#D1754` e7adfb34 (master: a75bb25a) +- global: identify bash-4.2 bug that internal quoting of `${v/%$empty/"$rep"}` remains `#D1753` e7adfb34 (master: a75bb25a) +- prompt: fix a bug of `ble/prompt/print` redundantly quoting `$` `#D1752` e7adfb34 (master: a75bb25a) +- global: work around `compat42` quoting of `"${v/pat/"$rep"}"` `#D1751` e7adfb34 (master: a75bb25a) +- util: add identification of Windows Terminal `wt` `#D1758` 4ecbbdc2 (master: e332dc5f) +- global: work around bash-3.0 bug that single quotes remains for `"${v-$''}"` `#D1774` fb607ad6 (master: 9b96578c) +- main: resolve empty `HOSTNAME` [add `histdb`] `#D1925` 5812f2ef (master: 44d9e104) +- main: warn empty `LANG` [main: support an option `--inputrc={diff,all,user,none}`] `#D1926` 3f29bee3 (master: 92f20063) +- main: never load `/etc/inputrc` in openSUSE (motivated by Ultra980) `#D1926` 3f29bee3 (master: 92f20063) 0ceb0cb +- main: show warning for empty locale (movivated by Ultra980) `#D1927` 3f29bee3 (master: 92f20063) +- term (`terminology`): work around terminal glitches `#D1946` 2d4caa67 (master: 9a1b4f9f) +- edit: always adjust the terminal states with `bind -x` (reported by linwaytin) `#D1983` cdda7c44 (master: 5d14cf17) +- syntax: suppress brace expansions in designated array initialization in Bash 5.3 `#D1989` 78dd47ee (master: 1e7b884d) +- edit: restore `PS1` while processing `bind -x` (reported by adoyle-h) `#D2024` c46f4230 (master: 2eadcd5b) + +## Optimization +- util (`ble/util/assign`): work around subshell conflicts `#D1578` 59d6355c (master: 6e4bb126) +- prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` 66fd10b7 (master: 521aff9b) +- util (`ble/string#split`): optimize `#D1826` 5b3fc89c (master: 7bb10a79) +- debug: add `ble/debug/profiler` (motivated by SuperSandro2000) `#D1824` f629698 11aa4ab 5b3fc89c (master: 7bb10a79) +- global: avoid passing arbitrary strings through `awk -v var=value` `#D1827` 4571695a (master: 82232de5) + +## Internal changes and fixes +- main: include hostname in local runtime directory `#D1444` d19ab298 (master: 64948361) +- global: fix status check for read timeout `#D1467` 0bcc12c9 (master: e886883b) +- util, etc: ensure each function to work with arbitrary `IFS` `#D1490` `#D1491` 2fe60b64 (master: 5f9adfe8) +- util: fix `ble/util/dense-array#fill-range` b708ee29 (master: a46fdaf4) +- util: fix leak variables `buff`, `trap`, `{x,y}{1,2}` `#D1572` 36d151e2 (master: 5967d6ce) +- make: add fallback Makefile for BSD make `#D1805` 6498a5d3 (master: e5d8d00c) +- util, decode, vi: fix leak variables `#D1933` 002dda7f (master: 8d5cab85) +- syntax: fix code formatting [histdb: support auto-complete source `histdb-word`] `#D1938` edd48d1c (master: 00cae745) +- main: use builtin for `:` [histdb: support timeout of background processes] `#D1971` 8640dc41 (master: e0566bdc) +- global: normalize bracket expressions to `_a-zA-Z` / `_a-zA-Z0-9` `#D2006` 4ed4fd4f (master: 41faa494) +- util (restore-vars): work around `set -u` [util.bgproc: separate `ble/util/bgproc` from `histdb`] `#D2017` d60758ae (master: 7803305f) + +## Test +- util (ble/util/s2bytes): clear locale cache `#D1881` 99e217d3 (master: 2e1a7c17) +- util (ble/util/s2c): work around intermediate mbstate of bash <= 5.2 `#D1881` 99e217d3 (master: 2e1a7c17) +- util (ble/encoding:UTF-8/b2c): fix interpretation of leading byte `#D1881` 99e217d3 (master: 2e1a7c17) + +## New features +- syntax: support context after `((...))` and `[[ ... ]]` in bash-5.2 `#D1962` 74af9e60 (master: 67cb967a) + +-------------------------------------------------------------------------------- +# ble-0.1.15 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.1.15.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.1.15/ble-0.1.15.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.1.15/ble-0.1.15.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.1.15/ble-0.1.15.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.1.15.tar.xz +source ble-0.1.15/ble.sh + +# INSTALL +tar xJf ble-0.1.15.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach +# Add the following line at the end of ~/.bashrc +((_ble_bash)) && ble-attach +``` + +## blesh-0.1 fixes +- edit,highlight: backport changes in rebased commits dfac242 +- bump 0.1.15 3f4d866 + +## Fixes +- edit (sword): fix definition of `sword` (shell words) `#D1441` 03980f1 (master: f923388) +- bind: work around broken `cmd_xmap` after switching the editing mode `#D1478` 847e602 (master: 8d354c1) +- benchmark (`ble-measure`): fix a bug that the result is always 0 in Bash 3 and 4 (fixup 4759768 (master: bbc2a90)) `#D1615` a034c91 +- main: work around `. ble.sh --{test,update,clear-cache}` in intereactive sessions `#D1555` 4759768 (master: bbc2a90) +- main: fix reloading after ble-update (fixup 4759768 (master: bbc2a90)) (fixed by oc1024) `#D1558` 9372670 +- main: fix exit status for `bash ble.sh --test` (fixup 4759768 (master: bbc2a90)) `#D1558` 641238a +- main: work around sourcing `ble.sh` inside subshells `#D1554` 4759768 (master: bbc2a90) +- util: work around the Bash 3 bug of array assignments with `^A` and `^?` in Bash 3.2 `#D1614` 9648bd4 (master: b9f7611) +- decode, canvas, etc.: explicitly treat CSI arguments as decimal numbers (reported by GorrillaRibs) `#D1625` 40a0ec9 (master: c6473b7) 2ea48d7 +- edit: fix a bug that `command-help` doesn't work `#D1635` c99e2f1 (master: 0f6a083) +- canvas: update prompt trace on `char_width_mode` change (reported by Barbarossa93) `#D1642` 5b22cd6 (master: 68ee111) +- complete: do not generate keywords for quoted command names `#D1691` cd75f39 (master: 60d244f) +- progcomp: retry completions on `$? == 124` also for non-default completions (reported by SuperSandro2000) `#D1759` a66b547 (master: 82b9c01) +- edit: fix the restore failure of `PS1` and `PROMPT_COMMAND` on `ble-detach` `#D1784` a0f6594 (master: b9fdaab) +- history: work around possible dirty prefix `*` in the history output `#D1808` 0ed2ffb (master: 64a740d) +- main. util: fix problems of readlink etc. found by test in macOS (reported by aiotter) `#D1849` 1dc5938 (master: fa955c1) `#D1855` a22e145 +- global: quote `return $?` `#D1884` c2ba90b (master: 801d14a) +- bind: fix M-C-@, C-x C-@, and M-C-x (`bash-4.2 -o emacs`) `#D1920` de577dc (master: a410b03) + +## Changes +- syntax: exclude \\ + LF at the word beginning from words (motivated by cmplstofB) `#D1431` 69156f1 (master: 67e62d6) +- edit: change default behavior of C-w and M-w to operate on backward words `#D1448` 0a07c13 (master: 47a3301) +- edit: the widgets `{kill,copy,delete}-region-or` now receives widgets as arguments `#D1021` ec16708 (master: bbbd155) +- main: show notifications against debug versions of Bash `#D1612` 8f989e4 (master: 8f974aa) +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 2a045d8 (master: 0525528) 88e2df5 +- main: suppress non-interactive warnings from manually sourced startup files (reported by andreclerigo) `#D1676` 0525528 4ef844e (master: 88e2df5) +- util (`ble/util/buffer`): hide cursor in rendering `#D1758` 444abff (master: e332dc5) +- edit (`ble-detach`): prepend a space to `stty sane` for `HISTIGNORE=' *'` `#D1796` acb7c08 (master: 26b532e) +- history: disable the history file when `HISTFILE` is empty `#D1836` a79095a (master: 9549e83) + +## Compatibility +- global: work around empty `vi_imap` cache by `tmux-resurrect` `#D1562` b0cc0a3 (master: 560160b) +- cmap: add `st`-specific escape sequences for cursor keys `#D1633` ae298f1 (master: acfb879) +- cmap: distinguish find/select from home/end for openSUSE `inputrc.keys` (reported by cornfeedhobo) `#D1648` 603cf41 (master: c4d28f4) +- cmap: freeze the internal codes of find/select and kitty special keys `#D1674` 66263c4 (master: fdfe62a) +- decode: work around the overwritten builtin `set` (reported by eadmaster) `#D1680` 43dcb66 (master: a6b4e2c) +- complete: work around the variable leaks by `virsh` completion from `libvirt` (reported by telometto) `#D1682` d13ce5b (master: f985b9a) +- stty: do not remove keydefs for C-u, C-v, C-w, and C-? (reported by laoshaw) `#D1683` 6335dc2 (master: 82f74f0) +- main (`ble/util/readlink`): work around non-standard or missing `readlink` (motivated by peterzky) `#D1720` 94137b7 (master: a41279e) +- global: work around the arithmetic syntax error of `10#` in Bash-5.1 `#D1734` 7c2463e (master: 7545ea3) +- global: adjust implementations for Bash 5.2 `patsub_replacement` `#D1738` f1599ee (master: 4590997) +- main: check `/dev/tty` on startup (reported by andychu) `#D1749` 28e9c44 (master: 711c69f) +- global: work around `shopt -s compat42` `#D1754` 59075cc (master: a75bb25) +- global: identify bash-4.2 bug that internal quoting of `${v/%$empty/"$rep"}` remains `#D1753` 59075cc (master: a75bb25) +- prompt: fix a bug of `ble/prompt/print` redundantly quoting `$` `#D1752` 59075cc (master: a75bb25) +- global: work around `compat42` quoting of `"${v/pat/"$rep"}"` `#D1751` 59075cc (master: a75bb25) +- util: add identification of Windows Terminal `wt` `#D1758` 444abff (master: e332dc5) +- global: work around bash-3.0 bug that single quotes remains for `"${v-$''}"` `#D1774` d0dc13e (master: 9b96578) +- highlight: fix a problem that the attribute of the last character is applied till EOL `#D1393` 2ddb1ba `#D1395` 8c33557 (master: ef09932) +- main: resolve empty `HOSTNAME` [add `histdb`] `#D1925` e6cc6c3 (master: 44d9e10) +- main: warn empty `LANG` [main: support an option `--inputrc={diff,all,user,none}`] `#D1926` 2bd1544 (master: 92f2006) +- term (`terminology`): work around terminal glitches `#D1946` c5c3bc9 (master: 9a1b4f9) +- edit: restore `PS1` while processing `bind -x` (reported by adoyle-h) `#D2024` 94db09b (master: 2eadcd5) + +## Optimization +- prompt: fix not properly set `$?` in `${PS1@P}` evaluation (reported by nihilismus) `#D1644` a7b5c4b (master: 521aff9) + +## Internal changes and fixes +- main: include hostname in local runtime directory `#D1444` 1a5e90a (master: 6494836) +- global: fix status check for read timeout `#D1467` b56d638 (master: e886883) +- util, etc: ensure each function to work with arbitrary `IFS` `#D1490` `#D1491` 7228fd0 (master: 5f9adfe) +- util: fix leak variables `buff`, `trap`, `{x,y}{1,2}` `#D1572` de71ada (master: 5967d6c) +- make: add fallback Makefile for BSD make `#D1805` 2cb758f (master: e5d8d00) +- util, decode, vi: fix leak variables `#D1933` a2197a6 (master: 8d5cab8) +- syntax: fix code formatting [histdb: support auto-complete source `histdb-word`] `#D1938` 492349f (master: 00cae74) + +## Test +- util (ble/util/s2bytes): clear locale cache `#D1881` a8d7fd7 (master: 2e1a7c1) +- util (ble/util/s2c): work around intermediate mbstate of bash <= 5.2 `#D1881` a8d7fd7 (master: 2e1a7c1) +- util (ble/encoding:UTF-8/b2c): fix interpretation of leading byte `#D1881` a8d7fd7 (master: 2e1a7c1) + +-------------------------------------------------------------------------------- +# ble-0.4.0-devel2 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.4.0-devel2.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel2/ble-0.4.0-devel2.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel2/ble-0.4.0-devel2.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.4.0-devel2/ble-0.4.0-devel2.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.4.0-devel2.tar.xz +source ble-0.4.0-devel2/ble.sh + +# INSTALL (quick) +tar xJf ble-0.4.0-devel2.tar.xz -C ~/.local/share/blesh +echo 'source ~/.local/share/blesh' >> ~/.bashrc + +# INSTALL (more robust) +tar xJf ble-0.4.0-devel2.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none +# Add the following line at the end of ~/.bashrc +[[ ${BLE_VERSION-} ]] && ble-attach +``` + +-------------------------------------------------------------------------------- + +# ble-0.3.3 + +## Usage + +**Prerequisites** + +Bash 3.0+ and basic POSIX utilities are required. + +**Download ble-0.3.3.tar.xz** + +https://github.com/akinomyoga/ble.sh/releases/download/v0.3.3/ble-0.3.3.tar.xz + +```bash +# DOWNLOAD with wget +wget https://github.com/akinomyoga/ble.sh/releases/download/v0.3.3/ble-0.3.3.tar.xz + +# DOWNLOAD with curl +curl -LO https://github.com/akinomyoga/ble.sh/releases/download/v0.3.3/ble-0.3.3.tar.xz +``` + +**Trial & Install** + +```bash +# TRIAL +tar xJf ble-0.3.3.tar.xz +source ble-0.3.3/ble.sh + +# INSTALL +tar xJf ble-0.3.3.tar.xz -C ~/.local/share/blesh +# Add the following line near the top of ~/.bashrc +[[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --attach=none +# Add the following line at the end of ~/.bashrc +[[ ${BLE_VERSION-} ]] && ble-attach +``` + +## New features + +- syntax: allow unquoted `[!` and `[^` in `simple-word` (reported by cmplstofB) `#D1303` 4bf8b86 (master: 1efe833) + +## Changes + +- auto-complete: bind `insert-on-end` to `C-e` `#D1250` 1070aba (master: 90b45eb) +- util (`bleopt`): fail when a specified bleopt variable does not exist (test-util) 0a51044 (master: 5966f22) +- edit: preserve `PS1` when `internal_suppress_bash_output` is set `#D1344` 537acf2 (master: 6ede0c7) +- complete: change to generate filenames starting from `.` by default `#D1425` e26867d (master: 987436d) + +## Fix + +- [ble-0.3] reload: fix a bug that the state is broken by `ble-reload` `#D1266` f2f30d1 (master: N/A) +- decode (`ble/builtin/bind`): remove comment from bind argument `#D1267` 82f4aaa (master: 880bb2c) +- complete: clear menu on history move `#D1248` 04fddd6 (master: 06cc7de) +- syntax: fix a bug that arguments of `eval` are not highlighted `#D1254` 38a7fc7 (master: 5046d14) +- decode: use `BRE` instead of `ERE` for `POSIX sed` (reported by dylankb) `#D1283` a577ec4 (master: 2184739) +- vi (vi-command/nth-column): fix a bug in arithmetic expansion (reported by andychu) `#D1292` ea2fa8e (master: da6cc47) +- complete: fix a bug that menu-filter is only partially turned off by `complete_menu_filter` `#D1298` 7278e27 (master: b3654e2) +- syntax: fix failglob errors of heredocs of the form `<<$(echo A)` `#D1308` 5ba9400 (master: 3212fd2) +- util (`bleopt`): fix a bug that a new setting is not defined with `name:=` (test-util) `#D1312` f2dbad0 (master: c757b92) +- util (`ble/util/{save,restore}-vars`): fix a bug that `name` and `prefix` cannot be saved/restored (test-util) f91f7ed (master: 5f2480c) +- util (`ble/path#remove{,-glob}`): fix corner cases (test-util) 2ba1d42 (master: ccbc9f8) +- util (`ble/variable#get-attr`): fix an error message with special variable names such as `?` and `*` `#D1321` b58f006 (master: 557b774) +- edit: fix a bug that `set +H` is cancelled on command execution `#D1332` bc454a2 (master: 02bdf4e) +- syntax (`ble/syntax/parse/shift`): fix a bug of shift skip in nested words `#D1333` 78e2170 (master: 65fbba0) +- util (`ble-stackdump`): fix a shift of line numbers `#D1337` 1505a5b (master: a14b72f) +- edit (`ble-bind -x`): check range of `READLINE_{POINT,MARK}` `#D1339` 1bc1ff6 (master: efe1e81) +- main: fix a bug that `~/.config/blesh/init.sh` is not detected (GitHub #53 by rux616) 9f74da6 (master: 61f9e10) +- util (`ble/string#to{upper,lower}`): work around `LC_COLLATE=en_US.utf8` (test-util) `#D1341` 5d9aa64 (master: 1f6b44e) `#D1355` 4e67719 (master: 4da6103) + - fixup 5d9aa64 fef40eb (master: N/A) +- util (encoding, keyseq): fix miscelleneous encoding bugs (test-util) 6d72d2a (master: 435bd16) +- edit: work around `WINCH` not updating `COLUMNS`/`LINES` after `ble-reload` `#D1345` e2d54a2 (master: a190455) +- complete: initialize `bleopt complete_menu_style` options before `complete_load` hook (reported by rux616) `#D1352` 15ba24f (master: 8a9a386) +- main: fix problems caused by multiple `source ble.sh` in bashrc `#D1354` 983e8a9 (master: 5476933) +- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` 52de342 (master: 4760409) +- decode (`bind`): work around `shopt -s nocasematch` (reported by tigger04) `#D1372` b34ad58 (master: 855cacf) +- prompt: fix a bug that rprompt is not cleared when `bleopt prompt_rps1` is reset `#D1377` c736bd5 (master: 1904b1d) +- complete: fix a bug of duplicated completions of filenames with spaces `#D1390` 048f17e (master: 98576c7) +- complete: fix bugs that quotation disappears on ambiguous completion `#D1387` 048f17e (master: 98576c7) +- complete: fix a bug that progcomp retry by 124 caused the default completion again `#D1386` 048f17e (master: 98576c7) +- syntax (tree-enumerate): fix unmodified `wtype` of reconstructed words at the end `#D1385` 048f17e (master: 98576c7) +- complete: fix superlinear performace of ambiguous matching globpat `#D1389` bd4657a (master: 71afaba) +- prompt: fix a bug that lonig rps1 is not correctly turned off `#D1401` 9266961 (master: d84bcd8) +- prompt: fix extra spaces on line folding before double width character `#D1400` 9266961 (master: d84bcd8) +- syntax (glob bracket expression): fix a bug of unsupported POSIX brackets `#D1402` e1eca65 (master: 6fd9e22) +- syntax (`ble/syntax:bash/simple-word/evaluate-path-spec`): fix a bug of unrecognized `[!...]` and `[^...]` `#D1403` 50fcd03 (master: 0b842f5) +- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` 0f85719 (master: 1066653) +- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 1f9abf6 (master: a32962e) +- complete: fix a problem that the user setting `dotglob` is changed `#D1425` e26867d (master: 987436d) +- complete: fix a problem of redundant unmatched ambiguous part with tilde expansions in the common prefix `#D1417` 20cb6af (master: 5777d7f) +- complete (`source:file`): fix a bug that tilde expansion candidates are always filtered out `#D1416` 20cb6af (master: 5777d7f) +- complete (`cd`): fix duplicate candidates by `CDPATH` (reported by Lennart00 at `oh-my-bash`) `#D1415` 20cb6af (master: 5777d7f) + +## Compatibility + +- msys2: support2 MSYS (motivated by SUCHMOKUO) `#D1264` 500e051 (master: 47e2863) + - edit: support `\$` in `PS1` for MSYS2 `#D1265` b8c2ca6 (master: f6f8956) + - edit: fixup b8c2ca6 fe78bd6 (master: N/A) + - msys2: work around MSYS2 Bash bug of missing CR `#D1270` 8c09190 (master: 71f3498) +- edit (`ble/widget/bracketed-paste`): fix error messages on `paste_end` in older version of Bash (test-util) 1631069 (master: b2c7d1c) +- decode: work around Bash-3.1 bug of `declare -f` rejecting special characters in function names (test-util) 1631069 (master: b2c7d1c) +- util (`ble/variable#get-attr`): fix a bug that attributes are not obtained in Bash <= 4.3 (test-util) 1631069 (master: b2c7d1c) +- decode: work around Bash-4.1 bug that locale not applied with `LC_CTYPE=C eval command` (test-util) 1631069 (master: b2c7d1c) +- complete: follow Bash-5.1 change of arithmetic literal `10#` `#D1322` b58f006 (master: 557b774) +- decode: work around Bash-4.1 arithmetic bug of array subscripts evaluated in discarded branches `#D1320` b58f006 (master: 557b774) +- decode: fix a bug of broken cmap cache found in ble-0.3 `#D1327` 4b15993 (master: 16b56bf) +- util (strftime): fix a bug not working with `-v var` option in Bash <= 4.1 (test-util) 360211c (master: f1a2818) +- complete: work around slow `compgen -c` in Cygwin `#D1329` 185a443 (master: 5327f5d) +- edit: work around problems with `mc` (reported by onelittlehope) `#D1392` 4d534b4 (master: e97aa07) + - highlight: fix a problem that the attribute of the last character is applied till EOL `#D1393` f47a5b8 (master: 2ddb1ba) `#D1395` 8c1e17c (master: ef09932) + +## Internal + +- global: check isolated identifiers and leak variables `#D1246` f92ba5c (master: 19cc99d) 9461953 (master: 2e74b6d) +- main: unset `BLE_VERSION`, `_ble_bash`, etc. on `ble-unload` `#D1382` 2bbd0fb (master: 6b615b6) + - complete: fix unfiltered tilde expansions `#D1414` 20cb6af (master: 5777d7f) + +------------------------------------------------------------------------------- +# ble-0.2.6 + +## New features + +- syntax: allow unquoted `[!` and `[^` in `simple-word` (reported by cmplstofB) `#D1303` 5cff40f (master: 1efe833) + +## Changes + +- edit: preserve `PS1` when `internal_suppress_bash_output` is set `#D1344` 72ae9c6 (master: 6ede0c7) + +## Fix + +- decode: use `BRE` instead of `ERE` for `POSIX sed` (reported by dylankb) `#D1283` bca4598 (master: 2184739) +- vi (vi-command/nth-column): fix a bug in arithmetic expansion (reported by andychu) `#D1292` 4260bc2 (master: da6cc47) +- syntax: fix failglob errors of heredocs of the form `<<$(echo A)` `#D1308` 1f874ba (master: 3212fd2) +- util (`bleopt`): fix a bug that a new setting is not defined with `name:=` (test-util) `#D1312` a9eb0e9 (master: c757b92) +- util (`ble/util/{save,restore}-vars`): fix a bug that `name` and `prefix` cannot be saved/restored (test-util) 49841db (master: 5f2480c) +- edit: fix a bug that `set +H` is cancelled on command execution `#D1332` 2ff6d06 (master: 02bdf4e) +- syntax (`ble/syntax/parse/shift`): fix a bug of shift skip in nested words `#D1333` bc935bd (master: 65fbba0) +- util (`ble-stackdump`): fix a shift of line numbers `#D1337` b597e90 (master: a14b72f) +- edit (`ble-bind -x`): check range of `READLINE_{POINT,MARK}` `#D1339` 47a93e8 (master: efe1e81) +- util (`ble/string#to{upper,lower}`): work around `LC_COLLATE=en_US.utf8` (test-util) `#D1341` 5b32621 (master: 1f6b44e) `#D1355` b38ef10 (master: 4da6103) +- util (encoding, keyseq): fix miscelleneous encoding bugs (test-util) 03c0b44 (master: 435bd16) +- edit: work around `WINCH` not updating `COLUMNS`/`LINES` after `ble-reload` `#D1345` 50af6a5 (master: a190455) +- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` f81734f (master: 4760409) +- syntax (glob bracket expression): fix a bug of unsupported POSIX brackets `#D1402` b7ea892 (master: 6fd9e22) +- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` cc5e4d1 (master: 1066653) +- highlight: fix unhighlighted tilde expansions `~+` (reported by cmplstofB) `#D1424` 3f7f044 (master: a32962e) + +## Compatibility + +- msys2: support2 MSYS (motivated by SUCHMOKUO) `#D1264` 7cf81c0 (master: 47e2863) + - edit: support `\$` in `PS1` for MSYS2 `#D1265` 8f44624 (master: f6f8956) + - msys2: work around MSYS2 Bash bug of missing CR `#D1270` bbe1b61 (master: 71f3498) +- edit (`ble/widget/bracketed-paste`): fix error messages on `paste_end` in older version of Bash (test-util) a80f1d1 (master: b2c7d1c) +- decode: work around Bash-3.1 bug of `declare -f` rejecting special characters in function names (test-util) a80f1d1 (master: b2c7d1c) +- util (`ble/variable#get-attr`): fix a bug that attributes are not obtained in Bash <= 4.3 (test-util) a80f1d1 (master: b2c7d1c) +- decode: work around Bash-4.1 bug that locale not applied with `LC_CTYPE=C eval command` (test-util) a80f1d1 (master: b2c7d1c) +- decode: fix a bug of broken cmap cache found in ble-0.3 `#D1327` 366e8c1 (master: 16b56bf) +- util (strftime): fix a bug not working with `-v var` option in Bash <= 4.1 (test-util) 4f11463 (master: f1a2818) +- complete: work around slow `compgen -c` in Cygwin `#D1329` 887be6e (master: 5327f5d) +- edit: work around problems with `mc` (reported by onelittlehope) `#D1392` a2d6099 (master: e97aa07) + +## Internal + +- global: check isolated identifiers and leak variables `#D1246` 146c98b (master: 19cc99d) + +------------------------------------------------------------------------------- +# ble-0.1.14 + +## Change + +- edit: preserve `PS1` when `internal_suppress_bash_output` is set `#D1344` 549f8f5 (master: 6ede0c7) + +## Fix + +- fixup ab01ceb 8129816 (v0.2: 51bde60) +- decode: use `BRE` instead of `ERE` for `POSIX sed` (reported by dylankb) `#D1283` 1244d86 (master: 2184739) +- edit: fix a bug that `set +H` is cancelled on command execution `#D1332` ba3687a (master: 02bdf4e) +- syntax (`ble/syntax/parse/shift`): fix a bug of shift skip in nested words `#D1333` 16fb351 (master: 65fbba0) +- util (`ble-stackdump`): fix a shift of line numbers `#D1337` 5d5b86b (master: a14b72f) +- edit (`ble-bind -x`): check range of `READLINE_{POINT,MARK}` `#D1339` 6909cc0 (master: efe1e81) +- util (`ble/string#to{upper,lower}`): work around `LC_COLLATE=en_US.utf8` (test-util) `#D1341` 31476cc (master: 1f6b44e) `#D1355` 65cab5c (master: 4da6103) +- util (encoding, keyseq): fix miscelleneous encoding bugs (test-util) 11d8db7 (master: 435bd16) +- edit: work around `WINCH` not updating `COLUMNS`/`LINES` after `ble-reload` `#D1345` e15c5a6 (master: a190455) +- syntax: allow single-character variable name in named redirections `{a}<>` `#D1360` 6bbed24 (master: 4760409) +- highlight: fix remaininig highlighting of vanishing words `#D1421` `#D1422` bf8fdc8 (master: 1066653) + +## Compatibility + +- global: work around Bash 3.2 bug of array initialization with SOH/DEL `#D1238` 566f53e (master: defdbd4) `#D1241` +- msys2: support2 MSYS (motivated by SUCHMOKUO) `#D1264` 19a36ea (master: 47e2863) + - edit: support `\$` in `PS1` for MSYS2 `#D1265` 8658738 (master: f6f8956) + - msys2: work around MSYS2 Bash bug of missing CR `#D1270` b72c063 (master: 71f3498) +- decode: fix a bug of broken cmap cache found in ble-0.3 `#D1327` fc6ded3 (master: 16b56bf) +- util (strftime): fix a bug not working with `-v var` option in Bash <= 4.1 (test-util) cb2389c (master: f1a2818) +- complete: work around slow `compgen -c` in Cygwin `#D1329` d6d49cc (master: 5327f5d) +- edit: work around problems with `mc` (reported by onelittlehope) `#D1392` 15111cf (master: e97aa07) + +## Internal + +- global: check isolated identifiers and leak variables `#D1246` 03b3204 (master: 19cc99d) 2e74b6d diff --git a/.local/share/doc/blesh/contrib/README-ja.md b/.local/share/doc/blesh/contrib/README-ja.md new file mode 100644 index 0000000..f98787a --- /dev/null +++ b/.local/share/doc/blesh/contrib/README-ja.md @@ -0,0 +1,97 @@ +\[ Language: [English](README.md) | **日本語** ] + +# blesh-contrib +[akinomyoga/ble.sh](https://github.com/akinomyoga/ble.sh)向けの設定 + +特に指定のない限りこのリポジトリのファイルは [3条項 BSD ライセンス](LICENSE) で提供されます。 +サブディレクトリ `airline` 以下のファイルは MIT ライセンスで提供されます。 + +〔訳註: これは[2020年5月20日(日本標準時)時点のREADME.md](https://github.com/akinomyoga/blesh-contrib/blob/8d89d469bd46d9d1158ab5295cd48a3df6942074/README.md) (8d89d46)の,技術的内容を変更しない日本語訳です〕 + +## :pencil: fzfとの統合 + +### 選択肢その1: `~/.fzf.bash`内で設定する + +fzfを`ble.sh`と共に用いたい場合,`.fzf.bash`を次のように書き直します(`/path/to/fzf`は fzf ディレクトリへのパスに置き換えてください。※fzf バイナリではなくて **fzf ディレクトリ**へのパスです)。 + +```bash +# fzf.bash + +# fzfの設定 +# --------- + +_ble_contrib_fzf_base=/path/to/fzf +if [[ ! "$PATH" == *"$_ble_contrib_fzf_base/bin"* ]]; then + export PATH="${PATH:+${PATH}:}/path/to/fzf/bin" +fi + +# 自動補完 +# --------------- +if [[ ${BLE_VERSION-} ]]; then + ble-import -d integration/fzf-completion +else + [[ $- == *i* ]] && source -- "$_ble_contrib_fzf_base/shell/completion.bash" 2> /dev/null +fi + +# キー束縛 +# ------------ +if [[ ${BLE_VERSION-} ]]; then + ble-import -d integration/fzf-key-bindings +else + source -- "$_ble_contrib_fzf_base/shell/key-bindings.bash" +fi +``` + +### 選択肢その2: `~/.blerc`内で設定する + +別の方法として,`blerc`において次のように直接設定を書くこともできます(`/path/to/fzf`は各人のfzfへのパスに置き換えてください)。 +この場合,`.fzf.bash`を`.bashrc`の中で呼び出さ(`source`コマンドを用い)ないでください。 + +```bash +# blerc + +# fzfの設定 +_ble_contrib_fzf_base=/path/to/fzf +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +``` + +## :pencil: fzf-git + +[fzf-git](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236)での設定を`ble.sh`と共に用いるには,次のように設定してください。 + +```bash +# bashrc / fzf.bash +if [[ ${BLE_VERSION-} ]]; then + _ble_contrib_fzf_base=/path/to/fzf + _ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio + ble-import -d integration/fzf-git +fi +``` + +または,`~/.blerc`内でも構成できます: + +```bash +# blerc +_ble_contrib_fzf_base=/path/to/fzf +_ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio +ble-import -d integration/fzf-git +``` + +シェル変数`$_ble_contrib_fzf_git_config`には,有効にする束縛の種別をコロン区切りで列挙します。 +`key-binding`という値で,次の形式のキー束縛を有効にします: C-g C-f, C-g C-b, C-g C-t, C-g C-h及びC-g C-r。 +`sabbrev`という値で,次の語に対する静的略語展開を有効にします: `gf`, `gb`, `gt`, `gh`及び`gr`。 +`arpeggio`という値で,次のキーの組み合わせを同時に押下できるようにします: g f, g b, g t, g h及びg r。 + +## :pencil: プロンプトシーケンス + +### プロンプトシーケンス `\q{contrib/vim-mode}` + +この指定はVimのモード名に展開されます。 + +```bash +# blerc(例) +ble-import contrib/prompt-vim-mode +PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' # PS1にモード名を表示 +bleopt keymap_vi_mode_show:= # モード行を表示しない +``` diff --git a/.local/share/doc/blesh/contrib/README.md b/.local/share/doc/blesh/contrib/README.md new file mode 100644 index 0000000..9657c2a --- /dev/null +++ b/.local/share/doc/blesh/contrib/README.md @@ -0,0 +1,39 @@ +[ Languages: **English** | [日本語](README-ja.md) (Japanese) ] + +# blesh-contrib +Settings for [akinomyoga/ble.sh](https://github.com/akinomyoga/ble.sh) + +Unless otherwise specified, files in this repository are licensed by [BSD +3-clause license](LICENSE). The files in `airline` are licensed by the MIT +License. The details are explained in sub-pages: + +- ⚙ [Integration with `fzf`](integration/fzf.md) + - :pencil: `contrib/integration/fzf-initialize` + - :pencil: `contrib/integration/fzf-completion` + - :pencil: `contrib/integration/fzf-key-bindings` + - :pencil: `contrib/integration/fzf-git` + - :pencil: `contrib/integration/fzf-menu` +- ⚙ Other integrations (undocumented) + - :pencil: `contrib/integration/bash-preexec` +- ⚙ Other integrations that will be automatically loaded + - :pencil: `contrib/integration/bash-completion` + - :pencil: `contrib/integration/nix-completion` + - :pencil: `contrib/integration/zoxide` +- :pencil: [`contrib/colorglass`](colorglass.md) +- :pencil: `contrib/histdb` (undocumented) +- ⚙ [Prompt sequences](prompt.md) + - :pencil: `contrib/prompt-defer` + - :pencil: `contrib/prompt-elapsed` + - :pencil: `contrib/prompt-git` + - :pencil: `contrib/prompt-vim-mode` +- ⚙ Color schemes `contrib/scheme/*` +- ⚙ Airline themes `contrib/airline/*` +- ⚙ Highlighting layers `contrib/layer/*` +- ⚙ Miscellaneous configurations + - :pencil: `contrib/config/execmark` + - :pencil: `contrib/config/github265-prompt-path-level-colors` + - :pencil: `contrib/config/github288-filter-sabbrev-completion` + - :pencil: `contrib/config/github296-named-execmark` + - :pencil: `contrib/config/github302-perlre-server` + - :pencil: `contrib/config/github481-elapsed-mark-without-command` + - :pencil: `contrib/config/github483-elapsed-mark-on-error` diff --git a/.local/share/doc/blesh/contrib/colorglass.md b/.local/share/doc/blesh/contrib/colorglass.md new file mode 100644 index 0000000..d634be2 --- /dev/null +++ b/.local/share/doc/blesh/contrib/colorglass.md @@ -0,0 +1,109 @@ +# :pencil: colorglass + +If your terminal supports 24-bit color, you can adjust the theme colors by +specifying gamma, contrast, hue rotation, etc. This also works for the +terminals without the 24-bit color support if `bleopt term_index_colors` is +properly set up, but the resulting colors would be reduced to a smaller number +of colors. + +```bash +ble-import contrib/colorglass + +# If your terminal does not support the 24-bit colors, please explicitly +# configure it by putting the following line: +#bleopt term_true_colors= +``` + +## Options + +### Blopet `colorglass_gamma` (Integer) + +This option specifies the change of gamma by percentage. For example, `bleopt +colorglass_gamma=5` performs the gamma correction with $\gamma=1.05$, and +`bleopt colorglass_gamma=-5` performs the gamma correction with $\gamma=0.95$ + +```bash +# default +bleopt colorglass_gamma=0 +``` + +### Blopet `colorglass_contrast` (Integer) + +This option specifies the contrast modification in the range -100..100. + +```bash +# default +bleopt colorglass_contrast=0 +``` + +### Blopet `colorglass_rotate` (Integer) + +This option specifies the angle of hue rotation in degrees. + +```bash +# default +bleopt colorglass_rotate=0 +``` + +### Blopet `colorglass_saturation` (Integer) + +This option specifies the change of saturation in the range -100..100. + +```bash +# default +bleopt colorglass_saturation=0 +``` + +### Blopet `colorglass_brightness` (Integer) + +This option specifies the change of brightness in the range -100..100. + +```bash +# default +bleopt colorglass_brightness=0 +``` + +### Blopet `colorglass_alpha` (Integer) + +This option specifies the opacity in the range 0..255 when the color is +synthesized with the background color specified by `bleopt colorglass_color`. + +```bash +# defualt +bleopt colorglass_alpha=255 +``` + +### Blopet `colorglass_color` (Integer) + +This option specifies the background color used by the color synthesis by +`bleopt colorglass_alpha`. + +```bash +# defualt +bleopt colorglass_color=0x8888FF +``` + +### Bleopt `colorglass_base16_palette` (Empty/Enumerate) + +This option specifies a color scheme of `base16` colors (index colors 0..15). +When this option is set to a (non-empty) palette name, index colors 0..15 in +the output of `ble.sh` will be replaced by the corresponding 24-bit colors in +the palette. See [List of base16 palettes](https://akinomyoga.github.io/ble.sh/colorglass.base16.html) +or [`colorglass.base16.dat`](https://github.com/akinomyoga/blesh-contrib/blob/master/colorglass.base16.dat) +for the list of available palettes. + +```bash +# defualt +bleopt colorglass_base16_palette= +``` + +### Bleopt `colorglass_blindness` (Enumerate) + +When this option is set to a non-empty value, the colors under color blindness +are simulated. Five values `none`, `protanopia`, `deuteranopia`, `tritanopia`, +and `achromatopsia` are supported. + +```bash +# default +bleopt colorglass_blindness=none +``` diff --git a/.local/share/doc/blesh/contrib/integration/fzf.md b/.local/share/doc/blesh/contrib/integration/fzf.md new file mode 100644 index 0000000..6e53f48 --- /dev/null +++ b/.local/share/doc/blesh/contrib/integration/fzf.md @@ -0,0 +1,195 @@ +# :pencil: Integration with `fzf` + +## Configure fzf's `completion` and `key-bindings` + +In the following cases, a special care is needed to make it work with `ble.sh`. + +- When you want to load fzf's `completion.bash` (sometimes installed at + `/etc/bash_completion.d/fzf` or `/usr/share/bash-completion/completions/fzf`) + or `key-bindings.bash`. +- When you want to load fzf's settings by `eval "$(fzf --bash)"` (supported by + `fzf >= 0.48.0`). + +We require those settings to be loaded through our modules :pencil: +[`contrib/integration/fzf-completion`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-completion.bash) +and :pencil: +[`contrib/integration/fzf-key-bindings`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-key-bindings.bash). + +> [!IMPORTANT] +> If you want to integrate fzf's `completion.bash` with +> [`bash-completion`](https://github.com/scop/bash-completion), +> `bash-completion` needs to be loaded before fzf's `completion.bash` is +> loaded. + +> [!IMPORTANT] +> In the Bash sessions where `ble.sh` is loaded, fzf's settings loaded +> elsewhere needs to be disabled. If you want to support the case without +> `ble.sh`, please enable the fzf's settings conditionally when `ble.sh` is not +> loaded. + +There are several ways to configure them. + +### Option 1: Set up in `~/.blerc` + +The current recommended way is to directly write settings in your `.blerc` as follows: + +```bash +# blerc + +# If ble/contrib/integration/fzf cannot find the fzf directory, please set the +# following variable "_ble_contrib_fzf_base" manually. The value +# "/path/to/fzf-directory" should be replaced by a path to the fzf directory +# such as "$HOME/.fzf" or "/usr/share/fzf" that contain +# "shell/{completion,key-bindings}.bash" or "{completion,key-bindings}.bash". + +#_ble_contrib_fzf_base=/path/to/fzf-directory + + +# Note: If you would like to combine fzf-completion with bash_completion, you +# need to load bash_completion earlier than fzf-completion. + +#source -- /path/to/bash_completion.sh + + +# Set up fzf +ble-import -d integration/fzf-completion +ble-import -d integration/fzf-key-bindings +``` + +#### When you have additional settings for fzf + +The option `-d` of `ble-import` in the above example means the asynchronous +loading of the modules. If you need to immediately load the module, please +drop the option `-d`. For example, if the user needs to call a function +defined in a module, the module can be loaded immediately, so that the user can +use the function. + +```bash +ble-import integration/fzf-completion +_fzf_set_up_completion foo bar +``` + +However, in most cases, the user would probably want to reserve the execution +of the commands relying on the module by using the `-C callback` option. In +this way, the reserved command is evaluated when the module is successfully +loaded. + +```bash +ble-import -d integration/fzf-completion \ + -C '_fzf_set_up_completion foo bar' +``` + +### Option 2: Set up in `~/.fzf.bash` + +If you have `~/.fzf.bash` for the fzf settings, you can rewrite your +`.fzf.bash` in the following way. In this case, `.fzf.bash` needs to be +sourced after `ble.sh`. Please replace `/path/to/fzf-directory`, +`/path/to/fzf/...` and `/path/to/bash_completion.sh` if necessary. + +```bash +# fzf.bash + +# If ble/contrib/integration/fzf cannot find the fzf directory, please set the +# following variable "_ble_contrib_fzf_base" manually. The value +# "/path/to/fzf-directory" should be replaced by a path to the fzf directory +# such as "$HOME/.fzf" or "/usr/share/fzf" that contain +# "shell/{completion,key-bindings}.bash" or "{completion,key-bindings}.bash". + +#_ble_contrib_fzf_base=/path/to/fzf-directory + +# Setup fzf +# --------- +if [[ ! "$PATH" == *"/path/to/fzf/bin"* ]]; then + export PATH="${PATH:+${PATH}:}/path/to/fzf/bin" +fi + +# Auto-completion +# --------------- +if [[ $- == *i* ]]; then + # Note: If you would like to combine fzf-completion with bash_completion, you + # need to load bash_completion earlier than fzf-completion. + + #source -- /path/to/bash_completion.sh + + if [[ ${BLE_VERSION-} ]]; then + ble-import -d integration/fzf-completion + else + source -- /path/to/fzf/shell/completion.bash 2> /dev/null + fi +fi + +# Key bindings +# ------------ +if [[ ${BLE_VERSION-} ]]; then + ble-import -d integration/fzf-key-bindings +else + source -- /path/to/fzf/shell/key-bindings.bash +fi +``` + +## :pencil: `integration/fzf-completion` + +The module `integration/fzf-completion` mentioned above also provides a widget. + +### Widget `fzf-complete` + +This widget performs fzf's completion normally triggered by the key `**`. + +``` +widget: fzf-complete [type] + + @param[in,opt] type + This specifies the type of the completion. The shell function + "_fzf_${type}_completion" is used to perform the '**' completion. The + values available by default are "path", "file", "dir", "proc", "host", + "var", and "alias". +``` + +## :pencil: `integration/fzf-git` + +If you want to use +[`junegunn/fzf-git.sh`](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236) +(fzf settings for `git` formerly provided as a +[Gist](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236)) with +`ble.sh`, you instead need to use :pencil: +[`contrib/integration/fzf-git`](https://github.com/akinomyoga/blesh-contrib/blob/master/integration/fzf-git.bash). + +```bash +# bashrc / fzf.bash +if [[ ${BLE_VERSION-} ]]; then + # If needed. See above for details: + #_ble_contrib_fzf_base=/path/to/fzf-directory + + _ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio + ble-import -d integration/fzf-git +fi +``` + +Or you can configure it in `~/.blerc`: + +```bash +# blerc + +# If needed. See above for details: +#_ble_contrib_fzf_base=/path/to/fzf-directory + +_ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio +ble-import -d integration/fzf-git +``` + +The shell variable `_ble_contrib_fzf_git_config` is a colon-separated list of the enabled types of bindings. +The value `key-binding` enables the key bindings of the form C-g C-f, C-g C-b, C-g C-t, C-g C-h, C-g C-r, and C-g C-s. +The value `sabbrev` enables the sabbrev expansion for the words `gf`, `gb`, `gt`, `gh`, `gr`, and `gs`. +The value `arpeggio` enables the simultaneous key combinations of g f, g b, g t, g h, g r, and g s. +The value `old-functions` enables old function names: `is_in_git_repo`, `fzf-down`, `gh`, `gb`, `gt`, `gh`, `gr`, and `gs`. + +## :pencil: `integration/fzf-menu` + +This module configures so that when the menu completion is started, fzf is +started instead of `menu-complete` built in `ble.sh`. + +```bash +# blerc + +ble-import -d integration/fzf-menu +``` diff --git a/.local/share/doc/blesh/contrib/prompt.md b/.local/share/doc/blesh/contrib/prompt.md new file mode 100644 index 0000000..4dce5cc --- /dev/null +++ b/.local/share/doc/blesh/contrib/prompt.md @@ -0,0 +1,83 @@ +# ⚙ Prompt sequences + +## :pencil: `contrib/prompt-vim-mode` + +Source: [`prompt-vim-mode.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-vim-mode.bash) + +### Prompt sequence `\q{contrib/vim-mode}` + +This prompt sequence expands to the vim mode name. + +```bash +# blerc (example) + +ble-import contrib/prompt-vim-mode +PS1='[\u@\h \W]\q{contrib/vim-mode}\$ ' # show mode name in PS1 +bleopt keymap_vi_mode_show:= # hide mode line +``` + +## :pencil: `contrib/prompt-git` + +Source: [`prompt-git.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-git.bash) + +```bash +# blerc (example) + +ble-import contrib/prompt-git +bleopt prompt_rps1='\q{contrib/git-info}' +``` + +### Prompt sequence `\q{contrib/git-info}` + +This expands to a string that explains the current git status. + +### Prompt sequence `\q{contrib/git-name}` + +This expands to the directory name of the repository. + +### Prompt sequence `\q{contrib/git-hash N}` + +This expands to the commit hash. +The hash is truncated to the length `N`. +The default value for `N` is `7`. + +### Prompt sequence `\q{contrib/git-branch}` + +This expands to the branch name (or tag name or hash) of `HEAD`. + +### Prompt sequence `\q{contrib/git-path}` + +This expands to the current path relative to the root directory of the repository. + +## :pencil: `contrib/prompt-elapsed` + +Source: [`prompt-elapsed.bash`](https://github.com/akinomyoga/blesh-contrib/blob/master/prompt-elapsed.bash) + +Measures the time of the previous command execution. + +```bash +# blerc (example) + +ble-import contrib/prompt-elapsed +bleopt prompt_rps1='\g{fg=69,italic}\q{contrib/elapsed}' +``` + +### Prompt sequence `\q{contrib/elapsed}` + +This expands to the high-resolution elapsed time for the command execution. + +### Prompt sequence `\q{contrib/elapsed-real}` + +This expands to the `real` time of `time`. + +### Prompt sequence `\q{contrib/elapsed-user}` + +This expands to the `user` time of `time`. + +### Prompt sequence `\q{contrib/elapsed-sys}` + +This expands to the `sys` time of `time`. + +### Prompt sequence `\q{contrib/elapsed-cpu}` + +This expands to the average cpu usage.