{"id":23344440,"url":"https://github.com/rec/pppp","last_synced_at":"2025-04-07T16:47:02.585Z","repository":{"id":137549490,"uuid":"188675611","full_name":"rec/pppp","owner":"rec","description":"🍿 pppp: a tiny bash utility to keep a stack of project directories 🍿","archived":false,"fork":false,"pushed_at":"2020-05-11T17:00:55.000Z","size":41,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T18:53:01.327Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rec.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-26T11:41:45.000Z","updated_at":"2020-05-11T17:00:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"5da03d88-c952-43de-818a-ce56c1d53426","html_url":"https://github.com/rec/pppp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fpppp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fpppp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fpppp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rec%2Fpppp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rec","download_url":"https://codeload.github.com/rec/pppp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247693599,"owners_count":20980710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-21T06:26:39.547Z","updated_at":"2025-04-07T16:47:02.558Z","avatar_url":"https://github.com/rec.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"🍿 pppp: a tiny bash utility to manage project directories 🍿\n--------------------------------------\n\nDo you frequently type ``cd``?  Do you often switch between different\nprojects several times a day?  Then pppp is for you.\n\npppp is a tiny utility for Bash that does one thing well - it keeps a stack of\nworking directories across Bash shells and terminal sessions.\n\nLike many programmers, I have many projects and subprojects working at once, and\nI often get interrupted with bug reports, requests or sudden inspiration, and\neven get interrupted during interruptions, so I'm constantly moving between\nmultiple terminal windows and forgetting where I was.\n\nYou can learn pppp in two minutes and it has copious documentation.\n\npppp saves me minutes a day, reminds of where I was when I get interrupted, and\nnever gets in my way.\n\nInstallation\n---------------\n\nDownload the file\n`pppp.sh \u003chttps://raw.githubusercontent.com/rec/pppp/master/pppp.sh\u003e`_\nand save it somewhere convenient.\n\nThen in your .bashrc, add a line ``source /path/to/your/pppp.sh`` to define the\nBash function ``pppp``. Many users add ``alias p=pppp``, and the documentation\nbelow assumes that.\n\n\n``pppp`` Commands\n-------------------\n\nCommands can be abbreviated down to a single character, so ``p rotate``,\n``p rot`` and ``p r`` all mean the same thing.\n\n\"cd\" is short for \"change the current working directory in the shell\".\n\nPush\n==========\n* ``p \u003cdirectory\u003e``\n* ``p push \u003cdirectory\u003e``\n\n  Push ``\u003cdirectory\u003e`` onto the stack and cd to it\n\n\nChange directory\n==================\n\nThe change directory commands don't change the stack, only the current\ndirectory.\n\n* ``p``\n* ``p 0``\n* ``p cd 0``\n\n  cd to the top of the stack, or print the stack if you are already there.\n\n* ``p 1``\n* ``p 2``\n* ``p \u003cn\u003e``\n\n  cd to the first, second or nth below the top of the stack\n\n* ``p -1``\n* ``p -2``\n* ``p -\u003cn\u003e``\n\n  cd to directories at the bottom of the stack\n\n\nPop\n==========\n\n* ``p pop``\n* ``p pop 0``\n* ``p p``\n\n  Pop the top directory off the stack and cd to the new top\n\n* ``p pop \u003cn\u003e``\n\n  Pop the \u003cn\u003eth directory.  If n is 0, cd to the new top\n\n\nReordering the stack: swap and rotate\n=======================\n\nThese commands change the stack, and then cd to its top\n\n* ``p swap``\n* ``p s``\n\n  Swap the top two directories in the stack\n\n------\n\n* ``p rotate 1``\n* ``p rotate``\n* ``p rot``\n* ``p r``\n\n  Rotate the whole stack forward so the top moves to the bottom\n\n* ``p rot 2``\n\n  Rotate the stack two steps forward\n\n* ``p rot -1``\n* ``p rot -``\n\n  Rotate the stack one step backward so the bottom moves to the top\n\n* ``p rot -3``\n\n  Rotate the stack two steps backward\n\n* ``p rot 0``\n\n  Does nothing\n\n\nHousekeeping: list, clear, undo\n==================================\n\n* ``p list``\n\n  List the stack\n\n* ``p clear``\n\n  Clear the stack\n\n* ``p undo``\n\n  Undo the previous change to the stack and cds to the top of it\n\nTips:\n-----------\n\nIf you want to jump back to the directory you were in before you typed ``p``,\nuse ``cd -``.\n\nBy default, pppp prints what it has done, and prints the whole stack every\ntime it changes.  You can disable that by either passing in the\n``-q``/``--quiet`` flag, or setting the ``PPPP_QUIET`` environment variable.\n\n\nMy ``p`` workflow\n-------------------------------\n\n* I alias ``pppp`` to ``p`` to avoid typing.\n\n* When I switch to a terminal window or open a new one, I type ``p`` to cd to my\n  top project.\n\n* When I get a new project I use ``p \u003cdirname\u003e`` to start work on it as my new\n  top project, pushing the previous one down a level.\n\n* Later I use ``p p`` (pop) to cd back to the previous project, if the new\n  project is finished.\n\n* Or if it is not, I use ``p r`` (rotate) to rotate the new project to the\n  bottom and cd back to the previous project.\n\n* When I'm cleaning up clutter. I use ``p p -1`` (pop) to pop my oldest task\n\n* When I'm working with two directories I push them both and then use ``p s``\n  (swap) to move back and forth.\n\n* And I use ``p u`` (undo) when I make a mistake.\n\n\nFAQ:\n-----------\n\nQ: Why ``pppp``?\n\nA: It's a Project to Push and Pop other Projects.  Also, I use ``p`` as a\nshortcut but ``p``, ``pp``, and ``ppp`` are too short or already taken.\n\nQ: What new features are expected?\n\nA: None.  Enough is as good as a feast.  (But I am very open to feature requests\nthat do not expand the scope of the project excessively.)\n\nQ: Where does ``pppp`` store the the persistent stack?\n\nA: In a file named ``.pppp.json``, which by default is in the config directory\n``$HOME/.config/``.  To change this config directory, set the environment\nvariable ``XDG_CONFIG_HOME``.\n\nQ: What's this XDG thing?\n\nA: `This specification\n\u003chttps://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\u003e`_\nfor where your config files should go .\n\nSee also `this article \u003chttps://0x46.net/thoughts/2019/02/01/dotfile-madness/\u003e`.\n\nQ: Why is there Python code embedded in a Bash script?  Why the Makefile and the\nbuild step?  Why not just distribute a Python script?\n\nA: Pure Python cannot change the directory in your shell - some Bash is needed.\nBut doing the whole thing in Bash was too hard.\n\nI could have distributed it as a Python file and a small Bash file but I felt a\nsingle file was better for everyone, even though it's a little more complicated\nbehind the scenes.\n\nSee also `this discussion\n\u003chttps://stackoverflow.com/questions/2375003/how-do-i-set-the-working-directory-of-the-parent-process\u003e`_\nwhich seems to show that no better way is possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frec%2Fpppp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frec%2Fpppp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frec%2Fpppp/lists"}