Questions tagged [zle]
The zle tag has no summary.
53 questions
5
votes
1
answer
240
views
How to configure ZSH to behave more like BASH
I recently upgraded KDE Plasma to v6, got ZSH instead of BASH in it and because I like some of its smart completion features and such, I decided to try to learn working with it. But I have a hard time ...
0
votes
2
answers
62
views
Stop the cursor at single and double quote
I have a zle like:
function _ctrl-shift-left() {
((REGION_ACTIVE)) || zle set-mark-command # Selection
zle backward-word
}
zle -N _ctrl-shift-left
bindkey '^[[1;6D' _ctrl-shift-left # Ctrl+...
3
votes
1
answer
120
views
How to add a zle-line-init hook without replacing existing hook?
I would like to run some code when zle becomes active.
The only way I know how to do that is
zle-line-init() {
echo hi
}
zle -N zle-line-init
But AFAIK this will replace any potential existing ...
1
vote
1
answer
95
views
Print the character before and after the cursor
I need a zle function that will print the character before and after the cursor.
print-char-before-after() {
# Get the position of the cursor
local cursor_pos=$CURSOR
# Get the text in ...
1
vote
0
answers
139
views
Key sequences for command/ctrl + backspace
I am trying to create a keybinding for CMD (on Mac)/CTRL (on Linux) + Backspace to delete everything before the cursor. I cannot for the life of me figure out what key sequence I should use. I am ...
0
votes
1
answer
521
views
How to setup zsh with fzf history backsearch in tmux (I get zle errors)
I am using tmux with the zsh shell.
I try to setup fzf, and I do it like this (inside my zshrc):
eval "$(fzf --zsh)"
This works, as long as I am not in tmux. I can use Ctrl-R and get the ...
1
vote
1
answer
354
views
What do these strings, '\M^?' and '^\M?', represent in zsh/ZLE?
In the documentation for the Zsh Line Editor, there is a section that says:
For either in-string or out-string, the following escape sequences are recognised:
\a
bell character
\b
...
0
votes
0
answers
221
views
Zsh: make single file selection smart, stylish, and functionally correct (highlights, completions below cursor, etc)
I would like to have a near-flawless "single file selector" with zsh. So far I haven't seen one in questions as they tend to focus on zle settings for one's command line. Let's say we are ...
0
votes
1
answer
84
views
How to change meta to option (macOS) in zle emacs keymap?
Since I use both bash and zsh, I'd like to learn the zle's emacs keymap (since this is the default in bash). My problem is that macOS's option key does not work with the meta shortcuts (like M-. for ...
2
votes
0
answers
72
views
how to change prompt of zle widgets (history-incremental-backward-search)?
Is there a way to change the prompt of zle widgets such as history-incremental-backward-search?
For instance I wonder if we can colorize "bck-i-search:" or change the string, or colorize the ...
1
vote
1
answer
1k
views
What is the current zle keymap/mode?
For example, if I hit the right combination of keys to enter viins and walk away from the terminal and forget, how can I tell when I get back? How can I tell what the default mode is? The guide has ...
3
votes
1
answer
329
views
Fuzzy Search History: Show History Keeping The Lines Intact For Multi-Line Commands
I am working on a zsh widget to fuzzy search history.
skim-history() {
origquery=${BUFFER}
output=$(history -1 1 | sd '^[ ]*[0-9]*[ ]*' '' | sk --tac --no-sort --exact)
if [ $? -eq 0 ]; then
...
0
votes
1
answer
147
views
How to cancel a zle function after triggering the bindkey?
Hope you're doing well.
I have the following in my .zshrc:
# 1. invoke zoxide to pick dir
# 2. open target dir in ranger
# 3. when exiting ranger, cd into last dir
zoxide_to_ranger () {
eval '...
6
votes
2
answers
2k
views
zsh history-beginning-search-backwards doesn't position cursor as desired
In bash, I used this:
% cat .inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
I'd like the same behavior in .zsh, so I've tried these bindkeys:
"^[[A&...
3
votes
1
answer
1k
views
What is the "global keymap" in zsh?
In the zsh manual 18.2.2 Local Keymaps it refers to the "global keymap" thrice.
Where is this term defined?
How do I find out what is my current global keymap, and how would I change it?