diff --git a/scripts/shell-integration/integration.bash b/scripts/shell-integration/integration.bash new file mode 100644 index 0000000..ac4f76f --- /dev/null +++ b/scripts/shell-integration/integration.bash @@ -0,0 +1,7 @@ +_loki_bash() { + if [[ -n "$READLINE_LINE" ]]; then + READLINE_LINE=$(loki -e "$READLINE_LINE") + READLINE_POINT=${#READLINE_LINE} + fi +} +bind -x '"\ee": _loki_bash' \ No newline at end of file diff --git a/scripts/shell-integration/integration.fish b/scripts/shell-integration/integration.fish new file mode 100644 index 0000000..0494975 --- /dev/null +++ b/scripts/shell-integration/integration.fish @@ -0,0 +1,9 @@ +function _loki_fish + set -l _old (commandline) + if test -n $_old + echo -n "⌛" + commandline -f repaint + commandline (loki -e $_old) + end +end +bind \ee _loki_fish \ No newline at end of file diff --git a/scripts/shell-integration/integration.nu b/scripts/shell-integration/integration.nu new file mode 100644 index 0000000..61b3205 --- /dev/null +++ b/scripts/shell-integration/integration.nu @@ -0,0 +1,21 @@ +def _loki_nushell [] { + let _prev = (commandline) + if ($_prev != "") { + print '⌛' + commandline edit -r (loki -e $_prev) + } +} + +$env.config.keybindings = ($env.config.keybindings | append { + name: loki_integration + modifier: alt + keycode: char_e + mode: [emacs, vi_insert] + event:[ + { + send: executehostcommand, + cmd: "_loki_nushell" + } + ] + } +) \ No newline at end of file diff --git a/scripts/shell-integration/integration.ps1 b/scripts/shell-integration/integration.ps1 new file mode 100644 index 0000000..b9f4abe --- /dev/null +++ b/scripts/shell-integration/integration.ps1 @@ -0,0 +1,10 @@ +Set-PSReadLineKeyHandler -Chord "alt+e" -ScriptBlock { + $_old = $null + [Microsoft.PowerShell.PSConsoleReadline]::GetBufferState([ref]$_old, [ref]$null) + if ($_old) { + [Microsoft.PowerShell.PSConsoleReadLine]::Insert('⌛') + $_new = (loki -e $_old) + [Microsoft.PowerShell.PSConsoleReadLine]::DeleteLine() + [Microsoft.PowerShell.PSConsoleReadline]::Insert($_new) + } +} \ No newline at end of file diff --git a/scripts/shell-integration/integration.zsh b/scripts/shell-integration/integration.zsh new file mode 100644 index 0000000..2737138 --- /dev/null +++ b/scripts/shell-integration/integration.zsh @@ -0,0 +1,11 @@ +_loki_zsh() { + if [[ -n "$BUFFER" ]]; then + local _old=$BUFFER + BUFFER+="⌛" + zle -I && zle redisplay + BUFFER=$(loki -e "$_old") + zle end-of-line + fi +} +zle -N _loki_zsh +bindkey '\ee' _loki_zsh \ No newline at end of file