Coder Social home page Coder Social logo

akinomyoga / blesh-contrib Goto Github PK

View Code? Open in Web Editor NEW
30.0 6.0 8.0 296 KB

Source of settings for Bash Line Editor https://github.com/akinomyoga/ble.sh (for ble-0.4+)

License: BSD 3-Clause "New" or "Revised" License

Shell 99.68% Makefile 0.32%
bash-configuration blesh

blesh-contrib's Introduction

[ Languages: English | 日本語 (Japanese) ]

blesh-contrib

Settings for akinomyoga/ble.sh

Unless otherwise specified, files in this repository are licensed by BSD 3-clause license. The files in airline are licensed by the MIT License. The details are explained in sub-pages:

  • Integration with fzf
    • 📝 contrib/integration/fzf-initialize
    • 📝 contrib/integration/fzf-completion
    • 📝 contrib/integration/fzf-key-bindings
    • 📝 contrib/integration/fzf-git
    • 📝 contrib/integration/fzf-menu
  • ⚙ Other integrations (undocumented)
    • 📝 contrib/integration/bash-preexec
  • ⚙ Other integrations that will be automatically loaded
    • 📝 contrib/integration/bash-completion
    • 📝 contrib/integration/nix-completion
    • 📝 contrib/integration/zoxide
  • 📝 contrib/colorglass
  • 📝 contrib/histdb (undocumented)
  • Prompt sequences
    • 📝 contrib/prompt-defer
    • 📝 contrib/prompt-elapsed
    • 📝 contrib/prompt-git
    • 📝 contrib/prompt-vim-mode
  • ⚙ Color schemes contrib/scheme/*
  • ⚙ Airline themes contrib/airline/*
  • ⚙ Highlighting layers contrib/layer/*
  • ⚙ Miscellaneous configurations
    • 📝 contrib/config/execmark
    • 📝 contrib/config/github265-prompt-path-level-colors
    • 📝 contrib/config/github288-filter-sabbrev-completion
    • 📝 contrib/config/github296-named-execmark
    • 📝 contrib/config/github302-perlre-server
    • 📝 contrib/config/github481-elapsed-mark-without-command
    • 📝 contrib/config/github483-elapsed-mark-on-error

blesh-contrib's People

Contributors

akinomyoga avatar cmplstofb avatar dave-elec avatar paulzzy avatar supersandro2000 avatar walkabout21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blesh-contrib's Issues

Airline themes not working

On a fresh shell:

bash --norc

I only did source ~/.local/share/blesh/ble.sh to enable blesh and then I sourced solarized themed airline:

source ~/.local/share/blesh/contrib/airline/solarized_flood.bash

However, it doesn't actually look solarized, but like this:

https://i.imgur.com/OE66UsY.png

actually, any theme looks like this.

Unable to call fzf function after load

I followed the steps of README on how to integrate ble.sh with fzf, using the ".fzf.bash" file, and in the end fo that file,I tried to call the function '_fzf_setup_completion', but bash says "command not found."
When I try to use this function interactively in bash, it works again.
If I disable ble.sh (loading fzf normally), the function also works!
Does the 'ble-import' function run assyncronous? If so, what is the best place to use fzf functions?

Thanks

Unclear instructions fzf-integration

This is more question if README.MD should be updated.

I probably don't understand something, but provided instructions didn't work for me, instead I had to do something reversely (to work).

Where should I source '.fzf.bash'? Before or after ble.sh.

My working config:

# ~/.bashrc

[[ $- == *i* ]] && source /usr/share/blesh/ble.sh --noattach
# If not running interactively, don't do anything
[[ $- != *i* ]] && return

...
## fzf readline search replacement
## neither of these are working even if if-statement stays as original
#source $XDG_CONFIG_HOME/bash/fzf.bash
#ble-import -d contrib/fzf-key-bindings

[[ ${BLE_VERSION-} ]] && ble-attach

## fzf 
## this works
source $XDG_CONFIG_HOME/bash/fzf.bash
# fzf.bash

# If ble/contrib/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=/usr/share/fzf

# Setup fzf
# ---------
#if [[ ! "$PATH" == *"/usr/bin/fzf"* ]]; then
#  export PATH="${PATH:+${PATH}:}/usr/bin/fzf"
#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 contrib/fzf-completion
#  else
#    source /usr/share/fzf/completion.bash 2> /dev/null
#  fi
#fi

# Key bindings
# ------------
if [[ ${BLE_VERSION-} ]]; then
  source /usr/share/fzf/key-bindings.bash
  #source /home/daru/.config/bash/fzf-key-bindings.bash
else
  ble-import contrib/fzf-key-bindings
fi

fzf integration does not work well with multiline prompts

I am using the powerline prompt design from sbp which is multline and has the cursor on line below it's usually place

image

Normally the fzf prompt looks like

image

image

but the ble.sh fzf integration moves it one up and overwrites the current prompt. When I close it the prompt comes back. I still did not read the entire documentation and do not know if there is a setting to easily fix this or this is a bug.

image

How to disable Fzf contrib autoloading

Hi @akinomyoga,

I use the dotfiles managing tool chezmoi, which I setup to install fzf and its bash completion files from the fzf upstream to:

.local/bin/fzf
.bashrc.d/80-fzf_completion.bash
.bashrc.d/80-fzf_key_bindings.bash

In my .bashrc I source all .bashrc.d/*.bash files, therefore also loading the fzf files.
As you can see, those are not standard locations, and ble.sh fails to find those and therefore it prints (kinda annoying) error messages.

Is there a way to disable autoloading the fzf integrations in ble.sh?
Or even better, is there a way to specify the those files as a bleopt?
Is there any benefit by letting ble.sh know where the fzf integrations files are? What are the benefits over loading them manually like I did?

Thank you in advance! 🙂

fzf-git integration adding weird autocomplete suggestions

Enabling this integration (fzf-git) using:

_ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio
ble-import -d integration/fzf-git

This add strange suggestions for all the autocomplete commands. Every time, for every command that I press TAB, the options [gf, ge, gb, gl, gh, gt, gr, gs] appears on the list, on the bottom!
This bug appears to be fixed if I remove the line:

_ble_contrib_fzf_git_config=key-binding:sabbrev:arpeggio

I needed that line? For what? Everything appears to work fine without it!

Thanks.

Background processes completion mess up bar

GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) [Arch Linux]
ble.sh, version 0.4.0-devel3+46ac426 (noarch) [git 2.39.1, GNU Make 4.4, GNU Awk 5.2.1, API 3.2, PMA Avon 8-g1, (GNU MPFR 4.2.0, GNU MP 6.2.1)]
bash-completion, version 2.11 (hash:2d02f73e803daa87a06e94e33b2a7b3e672a2c0c, 76338 bytes) (noarch)
locale: LANG=C
terminal: TERM=xterm-256color wcwidth=15.0-west/13.0-2+ri, xterm:115 (1;115;0)

When a background process finishes, a line like

[1]+  Done

appears and this makes the vim airline bar dissapear momentarily.

To reproduce:

$ set -o vi
$ ble-import vim-airline
$ coproc c { sleep 1; echo; }
...
[1]+  Done
# bar dissapears, doesn't reappear on terminal character resizing, or entering an empty command line

To refresh the bar again, one could execute any command, but on more complex setups, it is also needed to resize the terminal afterwards.

ble-face: face 'vim_airline_error_default' not found

Setting vim_airline_theme= to minimalist, transparent, solarized, or monochrome produces the following error on startup:

ble-face: face 'vim_airline_error_default' not found

Should the above themes be updated?

fzf-git branches menu doesn't work

After importing fzf-git and pressing C-g C-b I am greeted with this:

/usr/share/blesh/contrib/integration/fzf-git.bash: line 9: ble-import: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 11: return: can only `return' from a function or sourced script
/usr/share/blesh/contrib/integration/fzf-git.bash: line 202: ble/function#try: No such file or directory
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found
/usr/share/blesh/contrib/integration/fzf-git.bash: line 166: ble-bind: command not found

Here is my import:

ble-import -d integration/fzf-completion
ble-import -d integration/fzf-key-bindings
_ble_contrib_fzf_git_config=key-binding:sabbrev
ble-import -d integration/fzf-git

I am using Arch and blesh-git from the AUR

fzf-git functions not working on MSys2 bash (Git bash)

Not sure if this is the right place to ask for help, but I want to give it a shot anyways.

While the functions themselves are bash statements, fzf' preview argument gets executed under cmd (and not bash) on Windows. This causes certain problems, listed below:

  1. Semicolon, used in the preview argument here, is not a command separator in cmd.
    --preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' |
  2. In the preview argument here, the <<< operator is used which does not exist in cmd. It also uses command substitution $(...) which cmd doesn't support.
    --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$LINES |
  3. The <<< operator is used here too.
    --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$LINES |

It might be too much to ask, but is there a way to modify them so that they don't use such operators?

Is it possible to trigger fzf completion with a key on blesh ?

Hello there!
I currently have fzf completion and bindings working perfectly with blesh, but I was wondering if I could do sort of an hybrid of both, basically instead of using the ** to trigger fzf completion would it be possible to use a custom binding to trigger this kind of completion ?

I've seen this issue junegunn/fzf#1804 where he says to create a custom function for each command which I could do, but I'm wondering if there's a way to just use the existing completion.bash from them.

Thanks in advance

fzf integration - What is "_ble_contrib_fzf_base="?

What is this fzf directory that _ble_contrib_fzf_base= should point to according to the README?

This is what fzf installed on Arch Linux looks like:

$ pacq fzf
fzf /usr/
fzf /usr/bin/
fzf /usr/bin/fzf
fzf /usr/bin/fzf-tmux
fzf /usr/share/
fzf /usr/share/fish/
fzf /usr/share/fish/vendor_functions.d/
fzf /usr/share/fish/vendor_functions.d/fzf_key_bindings.fish
fzf /usr/share/fzf/
fzf /usr/share/fzf/completion.bash
fzf /usr/share/fzf/completion.zsh
fzf /usr/share/fzf/key-bindings.bash
fzf /usr/share/fzf/key-bindings.zsh
fzf /usr/share/licenses/
fzf /usr/share/licenses/fzf/
fzf /usr/share/licenses/fzf/LICENSE
fzf /usr/share/man/
fzf /usr/share/man/man1/
fzf /usr/share/man/man1/fzf-tmux.1.gz
fzf /usr/share/man/man1/fzf.1.gz
fzf /usr/share/vim/
fzf /usr/share/vim/vimfiles/
fzf /usr/share/vim/vimfiles/doc/
fzf /usr/share/vim/vimfiles/doc/fzf.txt
fzf /usr/share/vim/vimfiles/plugin/
fzf /usr/share/vim/vimfiles/plugin/fzf.vim

What should I set _ble_contrib_fzf_base= to?

fzf cd "alt-c" bug

action: "alt-c" to cd into a directory via fzf

expected: cd into directory selected with fzf

actual: command is put on the line, but not run; to run it, user must press backspace, then press enter

Perhaps an extra newline is being added to the command output. If this carrage return / new line is not added to the output, it should cd correctly without requiring more action from the user

Allow disabling some fzf key bindings

I switched from fzf to https://github.com/ellie/atuin for my shell history needs with the Ctrl-R binding, but still use the other Alt-C and Ctrl-T fzf bindings.

It would be awesome to be able to disable some binding by ble.sh configuration.

For now, I just remove the lines related to history:

diff --git a/fzf-key-bindings.bash b/fzf-key-bindings.bash
index 9ef2774..11e8fad 100644
--- a/fzf-key-bindings.bash
+++ b/fzf-key-bindings.bash
@@ -22,18 +22,6 @@ 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 {
-  READLINE_LINE=$(history -p "$(__fzf_history__)")
-  READLINE_POINT=${#READLINE_LINE}
-}
-((_ble_bash>=40000)) &&
-  ble/contrib/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 'eval "$(__fzf_cd__)"'
 ble-bind -m vi_imap -c M-c 'eval "$(__fzf_cd__)"'
@@ -41,7 +29,6 @@ ble-bind -m vi_nmap -c M-c 'eval "$(__fzf_cd__)"'

 # patch fzf functions
 ble/function#advice around fzf-file-widget ble/contrib/fzf-key-bindings.advice
-ble/function#advice around __fzf_history__ ble/contrib/fzf-key-bindings.advice
 ble/function#advice around __fzf_cd__      ble/contrib/fzf-key-bindings.advice
 function ble/contrib/fzf-key-bindings.advice {
   if [[ ! $_ble_attached ]]; then

can you add predefined themes based on gogh

can you add predefined themes based on the color profiles on gogh: [https://github.com/Gogh-Co/Gogh] so users can easily switch to premade themes. Love the work BTW.

for example theme and corresponding number

and can be executed with a specific theme command like
ble-theme-change=192

redundant fzf path in documentation for setup. use var to simplify

# fzf.bash

# Setup fzf
# ---------
_ble_contrib_fzf_base=/path/to/fzf-directory
if [[ ! "$PATH" == *"$_ble_contrib_fzf_base/bin"* ]]; then
  export PATH="${PATH:+${PATH}:}/path/to/fzf-directory/bin"

should be

_ble_contrib_fzf_base=/path/to/fzf-directory
if [[ ! "$PATH" == *"$_ble_contrib_fzf_base/bin"* ]]; then
export PATH="${PATH:+${PATH}:}$_ble_contrib_fzf_base/bin"
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.