sudo: maintain cursor position
I.e. when prefixing the current command-line with 'sudo ' maintain the current cursor position instead of jumping to the end of the line.
This commit is contained in:
parent
96e4e5dd03
commit
1e7c6743a7
@ -13,9 +13,8 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
sudo-command-line() {
|
sudo-command-line() {
|
||||||
[[ -z $BUFFER ]] && zle up-history
|
[[ -z $BUFFER ]] && zle up-history
|
||||||
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
|
[[ $BUFFER != sudo\ * ]] && LBUFFER="sudo $LBUFFER"
|
||||||
zle end-of-line
|
|
||||||
}
|
}
|
||||||
zle -N sudo-command-line
|
zle -N sudo-command-line
|
||||||
# Defined shortcut keys: [Esc] [Esc]
|
# Defined shortcut keys: [Esc] [Esc]
|
||||||
|
Loading…
Reference in New Issue
Block a user