From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12426 invoked by alias); 11 Feb 2017 15:35:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22445 Received: (qmail 12956 invoked from network); 11 Feb 2017 15:35:56 -0000 X-Qmail-Scanner-Diagnostics: from mx2.mailbox.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.241.60.215):SA:0(-0.7/5.0):. Processed in 1.344965 secs); 11 Feb 2017 15:35:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: su_ld@mailbox.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at mailbox.org designates 80.241.60.215 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:subject:subject:from:from:date:date:received; s= mail20150812; t=1486826791; bh=8toBUS5GZq4QffxecNfiarKlIWMRf+o4R JzBjLCwbtU=; b=m3IY9Uf+9VcN3yV+5FJ3lSD/qZ7UHrk5eikLmEbgXmZ/pYWfC aMLrsc9FEzhs5LciLVllQLN2rLRWAkxilKsAEMTt454/wDY1Pa1bhYX+9o5TCo4A WWnp7QTl+GqeM+tlof6RgroUNotwm1RS/LLPavV7byG06ryloY4KixKrqIR5+s8U Bpnnmaa7kl0qeH28qBNZHl7YwHOWXt3HmCmPA4ibbVDS04PAOBdnXTFqgBywoMYH JoNxAXAy8CqcIXRR6pKLbrd27jilIYVChMkE4atRkBZLywZyK7OC+qfrSEy+qNjX DrmTFrMqypFGMWCV04HPfCZR0XiJXtceaFcpQ== X-Virus-Scanned: amavisd-new at heinlein-support.de Date: Sat, 11 Feb 2017 16:26:24 +0100 From: Markus Zeindl To: Zsh Users Subject: Modify Zsh Configuration to Make M-backspace Remove Last Path Component Message-ID: <20170211162624.457f5cbe@priamos.m9net.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello Zsh-Community, I've started using zsh on GNU/Linux recently. When editing commands on the prompt (assumingly in the zle), I sometimes want to remove the last path component of an entered path descriptor, i.e. remove the basename of a path. The following description considers "M" to be the alt-key (or meta-key as in emacs key notation) Intuitively, I type M-backspace. This removes the whole path. Scenario 1 illustrates this. Scenario 1: Target: Change directory to /foo/bar/oof/rab Step 1: type target incorrectly as "% cd /foo/bar/oof/ran" Step 2: press M-backspace leading to a command-line of "% cd" Step 3: type target again completely leading to "% cd /foo/bar/oof/rab" I'm not familiar with Zsh Key notation at all. So, I'm not sure, what zle-command (or widget?) will be triggered on M-backspace using the key mapping in Mapping 1. Is it "backward-kill-word"? Mapping 1: Output of "% bindkey" "^@" set-mark-command "^A" beginning-of-line "^B" backward-char "^D" delete-char-or-list "^E" end-of-line "^F" forward-char "^G" send-break "^H" backward-delete-char "^I" expand-or-complete "^J" accept-line "^K" kill-line "^L" clear-screen "^M" accept-line "^N" down-line-or-history "^O" accept-line-and-down-history "^P" up-line-or-history "^Q" push-line "^R" history-incremental-search-backward "^S" history-incremental-search-forward "^T" transpose-chars "^U" kill-whole-line "^V" quoted-insert "^W" backward-kill-word "^X^B" vi-match-bracket "^X^F" vi-find-next-char "^X^J" vi-join "^X^K" kill-buffer "^X^N" infer-next-history "^X^O" overwrite-mode "^X^U" undo "^X^V" vi-cmd-mode "^X^X" exchange-point-and-mark "^X*" expand-word "^X=" what-cursor-position "^XG" list-expand "^Xg" list-expand "^Xr" history-incremental-search-backward "^Xs" history-incremental-search-forward "^Xu" undo "^Y" yank "^[^D" list-choices "^[^G" send-break "^[^H" backward-kill-word "^[^I" self-insert-unmeta "^[^J" self-insert-unmeta "^[^L" clear-screen "^[^M" self-insert-unmeta "^[^_" copy-prev-word "^[ " expand-history "^[!" expand-history "^[\"" quote-region "^[\$" spell-word "^['" quote-line "^[-" neg-argument "^[." insert-last-word "^[0" digit-argument "^[1" digit-argument "^[2" digit-argument "^[3" digit-argument "^[4" digit-argument "^[5" digit-argument "^[6" digit-argument "^[7" digit-argument "^[8" digit-argument "^[9" digit-argument "^[<" beginning-of-buffer-or-history "^[>" end-of-buffer-or-history "^[?" which-command "^[A" accept-and-hold "^[B" backward-word "^[C" capitalize-word "^[D" kill-word "^[F" forward-word "^[G" get-line "^[H" run-help "^[L" down-case-word "^[N" history-search-forward "^[OA" up-line-or-history "^[OB" down-line-or-history "^[OC" forward-char "^[OD" backward-char "^[OF" end-of-line "^[OH" beginning-of-line "^[P" history-search-backward "^[Q" push-line "^[S" spell-word "^[T" transpose-words "^[U" up-case-word "^[W" copy-region-as-kill "^[[2~" overwrite-mode "^[[3~" delete-char "^[[A" up-line-or-history "^[[B" down-line-or-history "^[[C" forward-char "^[[D" backward-char "^[_" insert-last-word "^[a" accept-and-hold "^[b" backward-word "^[c" capitalize-word "^[d" kill-word "^[f" forward-word "^[g" get-line "^[h" run-help "^[l" down-case-word "^[n" history-search-forward "^[p" history-search-backward "^[q" push-line "^[s" spell-word "^[t" transpose-words "^[u" up-case-word "^[w" copy-region-as-kill "^[x" execute-named-cmd "^[y" yank-pop "^[z" execute-last-named-cmd "^[|" vi-goto-column "^[^?" backward-kill-word "^_" undo " " magic-space "!"-";" self-insert ";5C" emacs-forward-word ";5D" emacs-backward-word "<"-"~" self-insert "^?" backward-delete-char "\M-^@"-"\M-." self-insert "\M-/" complete-word "\M-0"-"\M-^?" self-insert How can I modify my configuration to achieve Scenario 2? Scenario 2: Target: Change directory to /foo/bar/oof/rab Step 1: type target incorrectly as "% cd /foo/bar/oof/ran" Step 2: press M-backspace leading to a command-line of "% cd /foo/bar/oof/" Step 3: type only last path component "rab" again leading to "cd /foo/bar/oof/rab" Thanks a lot for every answer, helping me to improve my Zsh-experience. All The Best, Markus