From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6075 invoked by alias); 11 Feb 2017 16:20:27 -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: 22447 Received: (qmail 16338 invoked from network); 11 Feb 2017 16:20:27 -0000 X-Qmail-Scanner-Diagnostics: from mx1.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.212):SA:0(-0.7/5.0):. Processed in 1.475892 secs); 11 Feb 2017 16:20:27 -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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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.212 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 :references:in-reply-to:message-id:subject:subject:from:from :date:date:received; s=mail20150812; t=1486830017; bh=pUOgY048pR FsxfJHE1HyD22AVNMWLSlRHF+eFHdcOFI=; b=Vn2FSlprImsMEO5Q6cX1bvMmpp /Z+LLQj/Ty/mzPUApR9D/b633XUxM2Zg87R+yNYDV3WLINSH2Gj/HSu3eqaQf+yR Z8PRiPoWzSmMWHCrlw6KYHDzTw+H4JRbYBaZvMhP4GOPw8+IvO0EroYdChVH6Flc QStSqojQLXLrDDodO+H+v8umKBggn710/s9p35mmuwwcZLPzFsLf0w/G/EOhpxHG p702TegFwFevW7As0DG7ZOEz0anINhlfgjYKS5mMl0lyG25TK9OOLawPKwkhLKps Tze7+hCaXkm0Yp6KqNorz/wN3I0PzxCzh9Vnjkh9AF44F6evpuexanSC4ReA== X-Virus-Scanned: amavisd-new at heinlein-support.de Date: Sat, 11 Feb 2017 17:20:15 +0100 From: Markus Zeindl To: Zsh Users Subject: Re: Modify Zsh Configuration to Make M-backspace Remove Last Path Component Message-ID: <20170211172015.7423e726@priamos.m9net.local> In-Reply-To: References: <20170211162624.457f5cbe@priamos.m9net.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Thank you! This was exactly what I was looking for! Am Sat, 11 Feb 2017 17:01:31 +0100 schrieb Julien Jehannet : > You can change the WORDCHARS setting by removing slash character: > > WORDCHARS=${WORDCHARS:s@/@} > > 2017-02-11 16:26 GMT+01:00 Markus Zeindl : > > > 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 > > > > >