1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["28477"],{13926(e,n,o){o.r(n),o.d(n,{metadata:()=>i,default:()=>m,frontMatter:()=>s,contentTitle:()=>p,toc:()=>c,assets:()=>r});var i=JSON.parse('{"id":"completion","title":"Command line tab-completion","description":"Completion for pnpm v9+ is incompatible with completion for older pnpm versions.","source":"@site/versioned_docs/version-12.x/completion.md","sourceDirName":".","slug":"/completion","permalink":"/completion","draft":false,"unlisted":false,"editUrl":"https://github.com/pnpm/pnpm.io/edit/main/docs/completion.md","tags":[],"version":"12.x","lastUpdatedBy":null,"lastUpdatedAt":null,"frontMatter":{"id":"completion","title":"Command line tab-completion"},"sidebar":"docs","previous":{"title":"Aliases","permalink":"/aliases"},"next":{"title":"Git Branch Lockfiles","permalink":"/git_branch_lockfiles"}}'),t=o(91987),l=o(67008);let s={id:"completion",title:"Command line tab-completion"},p,r={},c=[{value:"g-plane/pnpm-shell-completion",id:"g-planepnpm-shell-completion",level:2}];function a(e){let n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,l.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.admonition,{type:"info",children:(0,t.jsxs)(n.p,{children:["Completion for pnpm v9+ is incompatible with completion for older pnpm versions.\nIf you have already installed pnpm completion for a version older than v9, you must uninstall it first to ensure that completion for v9+ works properly.\nYou can do this by removing the section of code that c
1ontains ",(0,t.jsx)(n.code,{children:"__tabtab"})," in your dot files."]})}),"\n",(0,t.jsx)(n.p,{children:"Unlike other popular package managers, which usually require plugins, pnpm\nsupports command line tab-completion for Bash, Zsh, Fish, and similar shells."}),"\n",(0,t.jsx)(n.p,{children:"To setup autocompletion for Bash, run:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-text",children:"pnpm completion bash > ~/completion-for-pnpm.bash\necho 'source ~/completion-for-pnpm.bash' >> ~/.bashrc\n"})}),"\n",(0,t.jsx)(n.p,{children:"To setup autocompletion for Fish, run:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-text",children:"pnpm completion fish > ~/.config/fish/completions/pnpm.fish\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Since v12.4.0, the generated completions cover the ",(0,t.jsxs)(n.a,{href:"/pnpm-cli#short-aliases",children:[(0,t.jsx)(n.code,{children:"pn"})," alias"]})," as well, in Bash, Fish, PowerShell, and Zsh."]}),"\n",(0,t.jsx)(n.h2,{id:"g-planepnpm-shell-completion",children:"g-plane/pnpm-shell-completion"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.a,{href:"https://github.com/g-plane/pnpm-shell-completion",children:"pnpm-shell-completion"})," is a shell plugin maintained by Pig Fang on Github."]}),"\n",(0,t.jsx)(n.p,{children:"Features:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["Provide completion for ",(0,t.jsx)(n.code,{children:"pnpm --filter <package>"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:["Provide completion for ",(0,t.jsx)(n.code,{children:"pnpm remove"})," command, even in workspace's packages (by specifying ",(0,t.jsx)(n.code,{children:"--filter"})," option)."]}),"\n",(0,t.jsxs)(n.li,{children:["Provide completion for scripts in ",(0,t.jsx)(n.code,{children:"package.json"}),"."]}),"\n"]})]})}function m(e={}){let{wrapper:n}={...(0,l.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},67008(e,n,o){o.d(n,{R:()=>s,x:()=>p});var i=o(71763);let t={},l=i.createContext(t);function s(e){let n=i.useContext(l);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function p(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:s(e.components),i.createElement(l.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.