Comments (4)
The cursor is always π moved to the end on line 251:
# the search was succesful so display the result properly by clearing away
# existing highlights and moving the cursor to the end of the result buffer
if [[ $_history_substring_search_refresh_display -eq 1 ]]; then
region_highlight=()
CURSOR=${#BUFFER} # <== HERE \o/ line 251
fi
Try commenting out that line; it might do exactly what you're dreaming of. β
from zsh-history-substring-search.
hey @aktau
i have been digging about and found the answer this at the book 'From Bash to Z Shell', page 360-361, which google books removes partially (at least from my view), section Case Study 4: Chaining Widgets Together.
that was yesterday. today i found another thread and zle built-ins which does almost exactly what you want. check Gilles 2 answers, which more or less do what bash history-preserve-point does..
https://unix.stackexchange.com/questions/16101/zsh-search-history-on-up-and-down-keys
cheers!
from zsh-history-substring-search.
+1 for this request. I haven't found a way to solve it yet.
from zsh-history-substring-search.
@aktau and everyone else interested:
In zsh, to remember the cursor position for each history entry and recall it
each time you recall a history entry, you'd add to your ~/.zshrc:
typeset -A cursor_history
save-cursor() cursor_history[$HISTNO]=$CURSOR
restore-cursor() CURSOR=${cursor_history[$HISTNO]-$CURSOR}
autoload -Uz add-zle-hook-widget
add-zle-hook-widget line-finish save-cursor
add-zle-hook-widget history-line-set restore-cursor
(note that that history is not preserved between shell invocations, only within
the current shell session).
It also doesn't save the current cursor position when you leave the currently
edited line. For that, you'd also need to wrap at least all history motion
widgets so they do a save-cursor first:
for w (${(Mk)widgets:#.*hist*}) {
functions[${w#.}]='save-cursor; zle '$w
zle -N ${w#?}
}
Source: StΓ©phane Chazelas @ https://unix.stackexchange.com/a/630708/283551
from zsh-history-substring-search.
Related Issues (20)
- Release a new version HOT 2
- Not highlighting in zsh 5.9 HOT 13
- zsh-syntax-highlighting: unhandled ZLE widget 'history-substring-search-up' HOT 2
- integrate `history-substring-search-down` with existing widget
- Incompatibility with custom config setopt globsubst
- Modify your readme, bindkey does not work, as mentioned in readme HOT 2
- Need Help, i must "source .zshrc" first for the plugin to works HOT 2
- binding keys doesn't work?
- `(anon):local:1: bad option: -e` error HOT 7
- History not synced accross terminals. HOT 2
- Highlighting doesn't work when using both marlonrichert/zsh-autocomplete and zsh-users/zsh-syntax-highlighting HOT 2
- Shell is stuck on 100% cpu if last character is a pipe
- Add separate license file HOT 1
- Create release including `HISTORY_SUBSTRING_SEARCH_PREFIXED` HOT 2
- How to install on Ubuntu 22.04 (in WSL2) without Oh My Zsh? HOT 4
- Cannot search across in different terminal tab
- Not enough arguments for -U HOT 8
- .zshrc:XXX: no matches found: [plugins...] HOT 3
- Where do historical records exist? HOT 1
- How do I change the data source of a history command to histdb
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zsh-history-substring-search.