[{"data":1,"prerenderedAt":1791},["ShallowReactive",2],{"tag-Zsh":3},[4,579],{"id":5,"title":6,"body":7,"date":560,"description":561,"extension":562,"image":563,"meta":564,"navigation":257,"path":566,"published":257,"seo":567,"snippet":568,"stem":569,"tags":570,"video":577,"__hash__":578},"articles\u002Farticles\u002Fan-elegant-way-of-managing-your-dot-files-with-git.md","An elegant way of managing your dot files with git",{"type":8,"value":9,"toc":551},"minimark",[10,19,22,29,34,37,40,44,47,50,65,95,109,115,162,165,203,207,210,213,219,222,230,233,239,242,294,297,301,304,367,374,459,462,482,485,489,500,504,512,516,547],[11,12,13,14,18],"p",{},"How to juggle all your configuration files between machines? a question probably asked many times. Lots of people store there configuration files or also so called dotfiles in git repos to more easily share them between machine. A commonly used method is having a repo with all the dotfiles in the $HOME directory and symbolic link the config files to the desired location like so ",[15,16,17],"code",{},"ln -s ~\u002F.dotfiles\u002F.zshrc ~\u002F.zshrc",". Syncing dotfiles with symbolic links can still be quite a chore especially when you clone your repo to a new machine and have to create all those symbolic links again.",[11,20,21],{},"Not to worry fortunately there is a more elegant way no more symbolic links and it only dependency is git.",[11,23,24,25,28],{},"How does it work, by making use of a bare repository you effectively only get the repository state without its working tree. With some flags you can use this repository with the ",[15,26,27],{},"$HOME"," directory as its working tree eliminating the need for carefully managing you symbolic links because all files are already in the right place. Neat right?",[30,31,33],"h2",{"id":32},"lest-get-started","Lest get started",[11,35,36],{},"If you have not tracked you dotfiles in a git repo you can get started in the next section right away..",[11,38,39],{},"If you already have a repository skip to the \"Migrate existing repository\".",[30,41,43],{"id":42},"setup-from-scratch","Setup from scratch",[11,45,46],{},"If you already track your dotfiles in a git repository.",[11,48,49],{},"with setting up your own dotfiles repo.",[11,51,52,53,56,57,60,61,64],{},"First things first lets create a folder for the bare repo ",[15,54,55],{},"mkdir ~\u002F.dots","\nnext we ",[15,58,59],{},"cd ~\u002F.dots"," and run ",[15,62,63],{},"git init --bare"," to setup our bare repo.",[11,66,67,68,71,72,75,76,79,80,71,83,86,87,90,91,94],{},"Next we're going to add an alias to our ",[15,69,70],{},"~\u002F.zshrc"," or ",[15,73,74],{},"~\u002F.bashrc","\nadd ",[15,77,78],{},"alias dots='\u002Fusr\u002Fbin\u002Fgit --git-dir=$HOME\u002F.dots\u002F --work-tree=$HOME'"," to a place of you liking, save and run ",[15,81,82],{},"source ~\u002F.zshrc",[15,84,85],{},"source ~\u002F.bashrc",".\nNow you can use the ",[15,88,89],{},"dots"," alias just as how you normally use the ",[15,92,93],{},"git"," command in a project folder.",[11,96,97,98,101,102,105,106,108],{},"Lets check our repos status with ",[15,99,100],{},"dots status",". As you can see git tries to make you aware that all you files in the home directory are untracked. this makes things a bit unclear. We can solve this by configuring the repo to only show changes that are already tracked by running ",[15,103,104],{},"dots config --local status.showUntrackedFiles no",". If we now run ",[15,107,100],{}," again we see there are no changes in the working tree.",[11,110,111,112,114],{},"We are all set to start tracking files. Lets commit our ",[15,113,70],{},".",[116,117,122],"pre",{"className":118,"code":119,"language":120,"meta":121,"style":121},"language-bash shiki shiki-themes github-light github-dark","dots status\ndots add ~\u002F.zshrc\ndots commit -m \"feat: add zsh config\"\n","bash","",[15,123,124,136,147],{"__ignoreMap":121},[125,126,129,132],"span",{"class":127,"line":128},"line",1,[125,130,89],{"class":131},"sScJk",[125,133,135],{"class":134},"sZZnC"," status\n",[125,137,139,141,144],{"class":127,"line":138},2,[125,140,89],{"class":131},[125,142,143],{"class":134}," add",[125,145,146],{"class":134}," ~\u002F.zshrc\n",[125,148,150,152,155,159],{"class":127,"line":149},3,[125,151,89],{"class":131},[125,153,154],{"class":134}," commit",[125,156,158],{"class":157},"sj4cs"," -m",[125,160,161],{"class":134}," \"feat: add zsh config\"\n",[11,163,164],{},"The only thing left to do is to add a remote and push our changes.",[116,166,168],{"className":118,"code":167,"language":120,"meta":121,"style":121},"dots remote add origin \u003Cyour-remote-repository>\ndots push\n",[15,169,170,196],{"__ignoreMap":121},[125,171,172,174,177,179,182,186,189,193],{"class":127,"line":128},[125,173,89],{"class":131},[125,175,176],{"class":134}," remote",[125,178,143],{"class":134},[125,180,181],{"class":134}," origin",[125,183,185],{"class":184},"szBVR"," \u003C",[125,187,188],{"class":134},"your-remote-repositor",[125,190,192],{"class":191},"sVt8B","y",[125,194,195],{"class":184},">\n",[125,197,198,200],{"class":127,"line":138},[125,199,89],{"class":131},[125,201,202],{"class":134}," push\n",[30,204,206],{"id":205},"migrate-existing-repository","Migrate existing repository",[11,208,209],{},"If you are setting up from scratch you can skip this section.",[11,211,212],{},"If you already track your files in a git repository you can easily migrate to this approach.",[11,214,215,216,218],{},"First off make sure the file and folder structure of your current dotfile repository mirrors your ",[15,217,27],{}," folder one to one.",[11,220,221],{},"For example something like this.",[116,223,228],{"className":224,"code":226,"language":227},[225],"language-text","dotfiles\n│   README.md\n│   .zshrc    \n│   .gitconfig\n│\n└───alacritty\n│   │   alacritty.conf\n│   \n└───htop\n    │   htoprc\n","text",[15,229,226],{"__ignoreMap":121},[11,231,232],{},"Should be changed to resemble your home directory like so.",[116,234,237],{"className":235,"code":236,"language":227},[225],"dotfiles\n│   README.md\n│   .zshrc    \n│   .gitconfig\n│\n└───.config\n    │\n    └───alacritty\n    │   │   alacritty.conf\n    │\n    └───htop\n        │   htoprc\n",[15,238,236],{"__ignoreMap":121},[11,240,241],{},"Next add this alias to you shell configuration file.",[116,243,245],{"className":118,"code":244,"filename":70,"language":120,"meta":121,"style":121},"# ~\u002F.zshrc\n\n...\n\nalias dots='\u002Fusr\u002Fbin\u002Fgit --git-dir=$HOME\u002F.dots\u002F --work-tree=$HOME'\n\n...\n",[15,246,247,253,259,264,269,284,289],{"__ignoreMap":121},[125,248,249],{"class":127,"line":128},[125,250,252],{"class":251},"sJ8bj","# ~\u002F.zshrc\n",[125,254,255],{"class":127,"line":138},[125,256,258],{"emptyLinePlaceholder":257},true,"\n",[125,260,261],{"class":127,"line":149},[125,262,263],{"class":157},"...\n",[125,265,267],{"class":127,"line":266},4,[125,268,258],{"emptyLinePlaceholder":257},[125,270,272,275,278,281],{"class":127,"line":271},5,[125,273,274],{"class":184},"alias",[125,276,277],{"class":191}," dots",[125,279,280],{"class":184},"=",[125,282,283],{"class":134},"'\u002Fusr\u002Fbin\u002Fgit --git-dir=$HOME\u002F.dots\u002F --work-tree=$HOME'\n",[125,285,287],{"class":127,"line":286},6,[125,288,258],{"emptyLinePlaceholder":257},[125,290,292],{"class":127,"line":291},7,[125,293,263],{"class":157},[11,295,296],{},"From then on it's the same as setting up a fresh machine follow the instructions from the next section to complete your migration.",[30,298,300],{"id":299},"setup-a-new-machine","Setup a new machine",[11,302,303],{},"To install your dotfiles to a new machine looks something like this.",[116,305,307],{"className":118,"code":306,"language":120,"meta":121,"style":121},"git clone --bare \u003Cyour-remote-repository> ~\u002F.dots\nalias dots='\u002Fusr\u002Fbin\u002Fgit --git-dir=$HOME\u002F.dots\u002F --work-tree=$HOME'\ndots config --local status.showUntrackedFiles no \ndots checkout\n",[15,308,309,331,341,360],{"__ignoreMap":121},[125,310,311,313,316,319,321,323,325,328],{"class":127,"line":128},[125,312,93],{"class":131},[125,314,315],{"class":134}," clone",[125,317,318],{"class":157}," --bare",[125,320,185],{"class":184},[125,322,188],{"class":134},[125,324,192],{"class":191},[125,326,327],{"class":184},">",[125,329,330],{"class":134}," ~\u002F.dots\n",[125,332,333,335,337,339],{"class":127,"line":138},[125,334,274],{"class":184},[125,336,277],{"class":191},[125,338,280],{"class":184},[125,340,283],{"class":134},[125,342,343,345,348,351,354,357],{"class":127,"line":149},[125,344,89],{"class":131},[125,346,347],{"class":134}," config",[125,349,350],{"class":157}," --local",[125,352,353],{"class":134}," status.showUntrackedFiles",[125,355,356],{"class":134}," no",[125,358,359],{"class":191}," \n",[125,361,362,364],{"class":127,"line":266},[125,363,89],{"class":131},[125,365,366],{"class":134}," checkout\n",[11,368,369,370,373],{},"Running ",[15,371,372],{},"dots checkout"," can result in something like this.",[116,375,377],{"className":118,"code":376,"language":120,"meta":121,"style":121},"error: The following untracked working tree files would be overwritten by checkout:\n    .zshrc\nPlease move or remove them before you can switch branches.\nAborting\n",[15,378,379,417,422,454],{"__ignoreMap":121},[125,380,381,384,387,390,393,396,399,402,405,408,411,414],{"class":127,"line":128},[125,382,383],{"class":131},"error:",[125,385,386],{"class":134}," The",[125,388,389],{"class":134}," following",[125,391,392],{"class":134}," untracked",[125,394,395],{"class":134}," working",[125,397,398],{"class":134}," tree",[125,400,401],{"class":134}," files",[125,403,404],{"class":134}," would",[125,406,407],{"class":134}," be",[125,409,410],{"class":134}," overwritten",[125,412,413],{"class":134}," by",[125,415,416],{"class":134}," checkout:\n",[125,418,419],{"class":127,"line":138},[125,420,421],{"class":131},"    .zshrc\n",[125,423,424,427,430,433,436,439,442,445,448,451],{"class":127,"line":149},[125,425,426],{"class":131},"Please",[125,428,429],{"class":134}," move",[125,431,432],{"class":134}," or",[125,434,435],{"class":134}," remove",[125,437,438],{"class":134}," them",[125,440,441],{"class":134}," before",[125,443,444],{"class":134}," you",[125,446,447],{"class":134}," can",[125,449,450],{"class":134}," switch",[125,452,453],{"class":134}," branches.\n",[125,455,456],{"class":127,"line":266},[125,457,458],{"class":131},"Aborting\n",[11,460,461],{},"You have two options:",[463,464,465,472],"ol",{},[466,467,468,469,114],"li",{},"overwrite the existing files if you feel confident you are not losing anything by running ",[15,470,471],{},"dots checkout -f",[466,473,474,475,478,479,481],{},"backup the existing files by renaming them like so ",[15,476,477],{},"mv ~\u002F.zshrc ~\u002F.zshrc.backup"," and when you're done, to backup your files run ",[15,480,372],{}," again.",[11,483,484],{},"At this point all your dotfiles should be in the right place.",[30,486,488],{"id":487},"alternatives","Alternatives",[11,490,491,492,499],{},"I prefer this method of managing dotfiles for its simplicity, but this is just one approach of many. If you're interested in other ways of managing your dotfiles I recommend checking out ",[493,494,498],"a",{"href":495,"rel":496},"https:\u002F\u002Fdotfiles.github.io\u002F",[497],"nofollow","dotfiles.github.io",". It has a lot of references of other people's dotsfiles, tutorials and projects centered around dotfiles.",[30,501,503],{"id":502},"wrapping-up","Wrapping up",[11,505,506,507,114],{},"Hope this post helps out a fellow developer on their config journey. If you have any questions or feedback you're always welcome to send me a message on ",[493,508,511],{"href":509,"rel":510},"https:\u002F\u002Ftwitter.com\u002FLiamEderzeel",[497],"@liamederzeel",[30,513,515],{"id":514},"sources","Sources",[517,518,519,529,538],"ul",{},[466,520,521,524,525],{},[125,522,523],{},"1"," ",[493,526,527],{"href":527,"rel":528},"https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=11070797",[497],[466,530,531,524,534],{},[125,532,533],{},"2",[493,535,536],{"href":536,"rel":537},"https:\u002F\u002Fwww.atlassian.com\u002Fgit\u002Ftutorials\u002Fdotfiles",[497],[466,539,540,524,543],{},[125,541,542],{},"3",[493,544,545],{"href":545,"rel":546},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=tBoLDpTWVOM",[497],[548,549,550],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":121,"searchDepth":138,"depth":138,"links":552},[553,554,555,556,557,558,559],{"id":32,"depth":138,"text":33},{"id":42,"depth":138,"text":43},{"id":205,"depth":138,"text":206},{"id":299,"depth":138,"text":300},{"id":487,"depth":138,"text":488},{"id":502,"depth":138,"text":503},{"id":514,"depth":138,"text":515},"2022-07-29","How to juggle all your configuration files between machines? a question probably asked many times. Lots of people store there configuration files or also so called dotfiles in git repos to more easily share them between machine. A commonly used method is having a repo with all the dotfiles in the $HOME directory and symbolic link the config files to the desired location like so ln -s ~\u002F.dotfiles\u002F.zshrc ~\u002F.zshrc. Syncing dotfiles with symbolic links can still be quite a chore especially when you clone your repo to a new machine and have to create all those symbolic links again.","md","\u002Fimages\u002Fdot-files.png",{"slug":565},"an-elegant-way-of-managing-your-dot-files-with-git","\u002Farticles\u002Fan-elegant-way-of-managing-your-dot-files-with-git",{"title":6,"description":561},"How to use a git bare repo to manage and sync your dotfiles the easy why.","articles\u002Fan-elegant-way-of-managing-your-dot-files-with-git",[571,572,573,574,575,576],"Linux","Config","Bash","Zsh","Terminal","Git",null,"NBMerbxK6qgbZ4h_PZrCqlAVsRR_hpQL-lwM2GyTfEg",{"id":580,"title":581,"body":582,"date":1780,"description":1781,"extension":562,"image":1782,"meta":1783,"navigation":257,"path":1785,"published":257,"seo":1786,"snippet":1787,"stem":1788,"tags":1789,"video":577,"__hash__":1790},"articles\u002Farticles\u002Ftmux-project-laucher.md","Build a Tmux project laucher",{"type":8,"value":583,"toc":1775},[584,589,598,613,616,619,633,637,644,664,667,670,673,850,853,856,859,885,888,919,922,1011,1018,1058,1061,1127,1131,1134,1715,1721,1727,1753,1756,1759,1761,1772],[585,586,588],"h1",{"id":587},"rationale","Rationale",[11,590,591,592,597],{},"I found myself growing increasingly frustrated with the need to rapidly switch between multiple coding projects. To tackle this, I resorted to managing various terminal sessions, utilizing ",[493,593,596],{"href":594,"rel":595},"https:\u002F\u002Fgithub.com\u002Fianyh\u002FAmethyst",[497],"Amethyst"," – a tiling window manager for macOS. The challenge arose when these sessions began to stack up, often reaching three or more terminals in full-screen mode, making it easy to lose track of which window corresponded to which project.",[11,599,600,601,606,607,612],{},"Although I had previously tried my hand at using ",[493,602,605],{"href":603,"rel":604},"https:\u002F\u002Fgithub.com\u002Ftmux\u002Ftmux\u002Fwiki",[497],"Tmux"," and even delved into experimenting with ",[493,608,611],{"href":609,"rel":610},"https:\u002F\u002Fgithub.com\u002Ftmuxinator\u002Ftmuxinator",[497],"Tmuxinator",", neither option truly resonated with me. The process of managing and navigating sessions was less intuitive than my initial expectations. Tasks like crafting sessions, renaming them, or typing out the complete tmuxinator command alongside the project name often felt cumbersome.",[11,614,615],{},"Recently, I was inspired by a video of ThePrimeagen, He implemented fzf a fuzzy search program for selecting his project folders, enabling seamless switching between projects, even when not yet within a tmux session.",[11,617,618],{},"This inspiration prompted me to develop a similar program with the following key objectives:",[517,620,621,624,627,630],{},[466,622,623],{},"It should exclusively list project directories.",[466,625,626],{},"It should instantiate a new tmux session at the root of the selected project.",[466,628,629],{},"It should provide the capability to attach from outside of tmux to an existing session, if one is available.",[466,631,632],{},"It should switch to an existing session, provided that it is already attached to an other a tmux session.",[585,634,636],{"id":635},"lets-get-started","Lets get started",[11,638,639,640,643],{},"Let's begin by creating a file named project-launcher within the ~\u002F.local\u002Fbin\u002F directory and open ",[15,641,642],{},"~\u002F.local\u002Fbin\u002Fproject-launcher"," in your text editor of choice.",[116,645,649],{"className":646,"code":647,"language":648,"meta":121,"style":121},"language-console shiki shiki-themes github-light github-dark","#!\u002Fusr\u002Fbin\u002Fenv bash\n\n...\n","console",[15,650,651,656,660],{"__ignoreMap":121},[125,652,653],{"class":127,"line":128},[125,654,655],{"class":157},"#!\u002Fusr\u002Fbin\u002Fenv bash\n",[125,657,658],{"class":127,"line":138},[125,659,258],{"emptyLinePlaceholder":257},[125,661,662],{"class":127,"line":149},[125,663,263],{"class":157},[11,665,666],{},"Let's begin by addressing our inputs, specifically the project folders that we intend to present as options. All of my project directories are situated within ~\u002Fprojects, categorized into either personal projects or various organization projects. The structure involves a distinct directory for personal projects and multiple directories housing organizational projects.",[11,668,669],{},"Consequently, our objective is to accommodate the passage of multiple paths, which will subsequently feature in our fuzzy search functionality. To achieve this, we'll designate these paths under the -d flag. Furthermore, we should account for handling the --help and -h flags, while ensuring that any other scenarios prompt an appropriate error message.",[11,671,672],{},"With the aid of optargs, our implementation might take the following form:",[116,674,676],{"className":646,"code":675,"language":648,"meta":121,"style":121},"...\n\noptstring=\":hd:-:\"\nwhile getopts ${optstring} arg; do\n  case ${arg} in\n    -)\n      case \"${OPTARG}\" in\n        help)\n            usage\n            ;;\n        *)\n            if [ \"$OPTERR\" = 1 ] && [ \"${optspec:0:1}\" != \":\" ]; then\n                echo \"Invalid option --${OPTARG}\" >&2\n            fi\n            ;;\n      esac;;\n    h)\n      usage\n      ;;\n    d)\n      multi+=(\"$OPTARG\")\n      ;;\n    ?)\n      echo \"Invalid option: -${OPTARG}.\"\n      exit 2\n      ;;\n  esac\ndone\nshift $(expr $OPTIND - 1 )\n\n...\n",[15,677,678,682,686,691,696,701,706,711,717,723,729,735,741,747,753,758,764,770,776,782,788,794,799,805,811,817,822,828,834,840,845],{"__ignoreMap":121},[125,679,680],{"class":127,"line":128},[125,681,263],{"class":157},[125,683,684],{"class":127,"line":138},[125,685,258],{"emptyLinePlaceholder":257},[125,687,688],{"class":127,"line":149},[125,689,690],{"class":157},"optstring=\":hd:-:\"\n",[125,692,693],{"class":127,"line":266},[125,694,695],{"class":157},"while getopts ${optstring} arg; do\n",[125,697,698],{"class":127,"line":271},[125,699,700],{"class":157},"  case ${arg} in\n",[125,702,703],{"class":127,"line":286},[125,704,705],{"class":157},"    -)\n",[125,707,708],{"class":127,"line":291},[125,709,710],{"class":157},"      case \"${OPTARG}\" in\n",[125,712,714],{"class":127,"line":713},8,[125,715,716],{"class":157},"        help)\n",[125,718,720],{"class":127,"line":719},9,[125,721,722],{"class":157},"            usage\n",[125,724,726],{"class":127,"line":725},10,[125,727,728],{"class":157},"            ;;\n",[125,730,732],{"class":127,"line":731},11,[125,733,734],{"class":157},"        *)\n",[125,736,738],{"class":127,"line":737},12,[125,739,740],{"class":157},"            if [ \"$OPTERR\" = 1 ] && [ \"${optspec:0:1}\" != \":\" ]; then\n",[125,742,744],{"class":127,"line":743},13,[125,745,746],{"class":157},"                echo \"Invalid option --${OPTARG}\" >&2\n",[125,748,750],{"class":127,"line":749},14,[125,751,752],{"class":157},"            fi\n",[125,754,756],{"class":127,"line":755},15,[125,757,728],{"class":157},[125,759,761],{"class":127,"line":760},16,[125,762,763],{"class":157},"      esac;;\n",[125,765,767],{"class":127,"line":766},17,[125,768,769],{"class":157},"    h)\n",[125,771,773],{"class":127,"line":772},18,[125,774,775],{"class":157},"      usage\n",[125,777,779],{"class":127,"line":778},19,[125,780,781],{"class":157},"      ;;\n",[125,783,785],{"class":127,"line":784},20,[125,786,787],{"class":157},"    d)\n",[125,789,791],{"class":127,"line":790},21,[125,792,793],{"class":157},"      multi+=(\"$OPTARG\")\n",[125,795,797],{"class":127,"line":796},22,[125,798,781],{"class":157},[125,800,802],{"class":127,"line":801},23,[125,803,804],{"class":157},"    ?)\n",[125,806,808],{"class":127,"line":807},24,[125,809,810],{"class":157},"      echo \"Invalid option: -${OPTARG}.\"\n",[125,812,814],{"class":127,"line":813},25,[125,815,816],{"class":157},"      exit 2\n",[125,818,820],{"class":127,"line":819},26,[125,821,781],{"class":157},[125,823,825],{"class":127,"line":824},27,[125,826,827],{"class":157},"  esac\n",[125,829,831],{"class":127,"line":830},28,[125,832,833],{"class":157},"done\n",[125,835,837],{"class":127,"line":836},29,[125,838,839],{"class":157},"shift $(expr $OPTIND - 1 )\n",[125,841,843],{"class":127,"line":842},30,[125,844,258],{"emptyLinePlaceholder":257},[125,846,848],{"class":127,"line":847},31,[125,849,263],{"class":157},[11,851,852],{},"Next, our focus is on utilizing the paths provided under the -d flag to generate two lists: one consisting of paths to all subdirectories containing projects, and the other containing project names to be displayed when we select a project.",[11,854,855],{},"To accomplish this, consider the following approach:",[11,857,858],{},"To begin, we pass the project paths to the find command, specifying an argument to limit the search to a single level deep.",[116,860,862],{"className":646,"code":861,"language":648,"meta":121,"style":121},"...\n\nprojectPaths=($(find ${multi[@]} -mindepth 1 -maxdepth 1 -type d))\n\n...\n",[15,863,864,868,872,877,881],{"__ignoreMap":121},[125,865,866],{"class":127,"line":128},[125,867,263],{"class":157},[125,869,870],{"class":127,"line":138},[125,871,258],{"emptyLinePlaceholder":257},[125,873,874],{"class":127,"line":149},[125,875,876],{"class":157},"projectPaths=($(find ${multi[@]} -mindepth 1 -maxdepth 1 -type d))\n",[125,878,879],{"class":127,"line":266},[125,880,258],{"emptyLinePlaceholder":257},[125,882,883],{"class":127,"line":271},[125,884,263],{"class":157},[11,886,887],{},"Additionally, we require the name of the session to which we are currently attached, along with a list of active sessions.",[116,889,891],{"className":646,"code":890,"language":648,"meta":121,"style":121},"...\n\nattachedSessionName=$(tmux display-message -p \\#S)\nsessions=$(tmux list-session -F \\#S)\n\n...\n",[15,892,893,897,901,906,911,915],{"__ignoreMap":121},[125,894,895],{"class":127,"line":128},[125,896,263],{"class":157},[125,898,899],{"class":127,"line":138},[125,900,258],{"emptyLinePlaceholder":257},[125,902,903],{"class":127,"line":149},[125,904,905],{"class":157},"attachedSessionName=$(tmux display-message -p \\#S)\n",[125,907,908],{"class":127,"line":266},[125,909,910],{"class":157},"sessions=$(tmux list-session -F \\#S)\n",[125,912,913],{"class":127,"line":271},[125,914,258],{"emptyLinePlaceholder":257},[125,916,917],{"class":127,"line":286},[125,918,263],{"class":157},[11,920,921],{},"We iterate through each project path to create a roster of project names, which will be display through fzf. Moreover, we assess the activity status of the session, accentuating the name in blue if it's active. Furthermore, if the project name corresponds to the existing tmux session name, we emphasize this particular project in yellow.",[116,923,925],{"className":646,"code":924,"language":648,"meta":121,"style":121},"...\n\nprojectDisplayNames=()\nprojectNames=()\n\nfor key in ${projectPaths[@]}; do\n  value=$(basename \"$(dirname \"${key}\")\")\"\u002F\"$(basename \"${key}\")\n    projectNames+=($value)\n  if [[ $value == $attachedSessionName ]]; then \n    projectDisplayNames+=(\"\u001b[33m$value\u001b[0m\")\n  elif $(contains ${value} ${sessions[@]}); then \n    projectDisplayNames+=(\"\u001b[34m$value\u001b[0m\")\n  else\n    projectDisplayNames+=($value)\n  fi\ndone\n\n...\n",[15,926,927,931,935,940,945,949,954,959,964,969,974,979,984,989,994,999,1003,1007],{"__ignoreMap":121},[125,928,929],{"class":127,"line":128},[125,930,263],{"class":157},[125,932,933],{"class":127,"line":138},[125,934,258],{"emptyLinePlaceholder":257},[125,936,937],{"class":127,"line":149},[125,938,939],{"class":157},"projectDisplayNames=()\n",[125,941,942],{"class":127,"line":266},[125,943,944],{"class":157},"projectNames=()\n",[125,946,947],{"class":127,"line":271},[125,948,258],{"emptyLinePlaceholder":257},[125,950,951],{"class":127,"line":286},[125,952,953],{"class":157},"for key in ${projectPaths[@]}; do\n",[125,955,956],{"class":127,"line":291},[125,957,958],{"class":157},"  value=$(basename \"$(dirname \"${key}\")\")\"\u002F\"$(basename \"${key}\")\n",[125,960,961],{"class":127,"line":713},[125,962,963],{"class":157},"    projectNames+=($value)\n",[125,965,966],{"class":127,"line":719},[125,967,968],{"class":157},"  if [[ $value == $attachedSessionName ]]; then \n",[125,970,971],{"class":127,"line":725},[125,972,973],{"class":157},"    projectDisplayNames+=(\"\u001b[33m$value\u001b[0m\")\n",[125,975,976],{"class":127,"line":731},[125,977,978],{"class":157},"  elif $(contains ${value} ${sessions[@]}); then \n",[125,980,981],{"class":127,"line":737},[125,982,983],{"class":157},"    projectDisplayNames+=(\"\u001b[34m$value\u001b[0m\")\n",[125,985,986],{"class":127,"line":743},[125,987,988],{"class":157},"  else\n",[125,990,991],{"class":127,"line":749},[125,992,993],{"class":157},"    projectDisplayNames+=($value)\n",[125,995,996],{"class":127,"line":755},[125,997,998],{"class":157},"  fi\n",[125,1000,1001],{"class":127,"line":760},[125,1002,833],{"class":157},[125,1004,1005],{"class":127,"line":766},[125,1006,258],{"emptyLinePlaceholder":257},[125,1008,1009],{"class":127,"line":772},[125,1010,263],{"class":157},[11,1012,1013,1014,1017],{},"Now, utilizing ",[15,1015,1016],{},"projectDisplayNames"," and prompt the user to select an option using fzf. The chosen option will then be used to retrieve the corresponding project path.",[116,1019,1021],{"className":646,"code":1020,"language":648,"meta":121,"style":121},"...\n\nselectedProjectName=$(printf \"%s\\n\" \"${projectDisplayNames[@]}\" | fzf --ansi)\n\nindex=$(indexOf ${selectedProjectName} ${projectNames[@]})\nselectedPath=\"${projectPaths[$index]}\"\n\n...\n",[15,1022,1023,1027,1031,1036,1040,1045,1050,1054],{"__ignoreMap":121},[125,1024,1025],{"class":127,"line":128},[125,1026,263],{"class":157},[125,1028,1029],{"class":127,"line":138},[125,1030,258],{"emptyLinePlaceholder":257},[125,1032,1033],{"class":127,"line":149},[125,1034,1035],{"class":157},"selectedProjectName=$(printf \"%s\\n\" \"${projectDisplayNames[@]}\" | fzf --ansi)\n",[125,1037,1038],{"class":127,"line":266},[125,1039,258],{"emptyLinePlaceholder":257},[125,1041,1042],{"class":127,"line":271},[125,1043,1044],{"class":157},"index=$(indexOf ${selectedProjectName} ${projectNames[@]})\n",[125,1046,1047],{"class":127,"line":286},[125,1048,1049],{"class":157},"selectedPath=\"${projectPaths[$index]}\"\n",[125,1051,1052],{"class":127,"line":291},[125,1053,258],{"emptyLinePlaceholder":257},[125,1055,1056],{"class":127,"line":713},[125,1057,263],{"class":157},[11,1059,1060],{},"The final step is to utilize the output from fzf, and us this to attach, switch to, or create a new tmux session. In case the user opts not to make a selection, we gracefully exit the process.",[116,1062,1064],{"className":646,"code":1063,"language":648,"meta":121,"style":121},"if [[ -z $selectedProjectName ]]; then\n    exit 0\nfi\n\nif ! $(contains ${selectedProjectName} ${sessions[@]} ); then\n  tmux new-session -ds $selectedProjectName -c $selectedPath\nfi\n\nif ! [[ -z $TMUX ]]; then\n  tmux switch-client -t $selectedProjectName\nelse\n  tmux attach-session -t=$selectedProjectName\nfi\n\n",[15,1065,1066,1071,1076,1081,1085,1090,1095,1099,1103,1108,1113,1118,1123],{"__ignoreMap":121},[125,1067,1068],{"class":127,"line":128},[125,1069,1070],{"class":157},"if [[ -z $selectedProjectName ]]; then\n",[125,1072,1073],{"class":127,"line":138},[125,1074,1075],{"class":157},"    exit 0\n",[125,1077,1078],{"class":127,"line":149},[125,1079,1080],{"class":157},"fi\n",[125,1082,1083],{"class":127,"line":266},[125,1084,258],{"emptyLinePlaceholder":257},[125,1086,1087],{"class":127,"line":271},[125,1088,1089],{"class":157},"if ! $(contains ${selectedProjectName} ${sessions[@]} ); then\n",[125,1091,1092],{"class":127,"line":286},[125,1093,1094],{"class":157},"  tmux new-session -ds $selectedProjectName -c $selectedPath\n",[125,1096,1097],{"class":127,"line":291},[125,1098,1080],{"class":157},[125,1100,1101],{"class":127,"line":713},[125,1102,258],{"emptyLinePlaceholder":257},[125,1104,1105],{"class":127,"line":719},[125,1106,1107],{"class":157},"if ! [[ -z $TMUX ]]; then\n",[125,1109,1110],{"class":127,"line":725},[125,1111,1112],{"class":157},"  tmux switch-client -t $selectedProjectName\n",[125,1114,1115],{"class":127,"line":731},[125,1116,1117],{"class":157},"else\n",[125,1119,1120],{"class":127,"line":737},[125,1121,1122],{"class":157},"  tmux attach-session -t=$selectedProjectName\n",[125,1124,1125],{"class":127,"line":743},[125,1126,1080],{"class":157},[30,1128,1130],{"id":1129},"the-final-product","The final product",[11,1132,1133],{},"The end result should resemble something like this.",[116,1135,1137],{"className":646,"code":1136,"filename":642,"language":648,"meta":121,"style":121},"#!\u002Fusr\u002Fbin\u002Fenv bash\n\nfunction usage {\n  echo \"Project Launcher\"\n  echo \"\"\n  echo \"Launch tmux session at your project directory or attach\u002Fswitch to an existing session\"\n  echo \"Supports fuzzy search power by fzf in multiple project directories\"\n  echo \"\"\n  echo \"Usage: $(basename $0) [-d \u003Carg>...] [--] [DIRECTORY...]\" 2>&1\n  echo \"\"\n  echo \"projectPaths:\"\n  echo \"   -d           add directory for fuzzy search\"\n  echo \"   -h|--help    show usage\"\n  exit 1\n}\n\noptstring=\":hd:-:\"\nwhile getopts ${optstring} arg; do\n  case ${arg} in\n    -)\n      case \"${OPTARG}\" in\n        help)\n            usage\n            ;;\n        *)\n            if [ \"$OPTERR\" = 1 ] && [ \"${optspec:0:1}\" != \":\" ]; then\n                echo \"Invalid option --${OPTARG}\" >&2\n            fi\n            ;;\n      esac;;\n    h)\n      usage\n      ;;\n    d)\n      multi+=(\"$OPTARG\")\n      ;;\n    ?)\n      echo \"Invalid option: -${OPTARG}.\"\n      exit 2\n      ;;\n  esac\ndone\nshift $(expr $OPTIND - 1 )\n\nfunction contains () {\n  local value=$1\n  shift\n  local elements=(\"$@\")\n\n  for el in ${elements[@]}; do\n    if [[ \"${el}\" = \"${value}\" ]]; then\n      return 0\n    fi\n  done\n\n  return 1\n}\n\nfunction indexOf () {\n  local value=$1\n  shift\n  local elements=(\"$@\")\n\n  for i in \"${!elements[@]}\"; do\n    if [[ \"${elements[$i]}\" = \"${value}\" ]]; then\n      echo \"${i}\";\n      break;\n    fi\n  done\n}\n\nif [[ $# -eq 1 ]]; then\n    selectedProjectName=$1\nelse\n  projectPaths=($(find ${multi[@]} -mindepth 1 -maxdepth 1 -type d))\n\n    attachedSessionName=$(tmux display-message -p \\#S)\n    sessions=$(tmux list-session -F \\#S)\n    projectDisplayNames=()\n    projectNames=()\n\n    for key in ${projectPaths[@]}; do\n      value=$(basename \"$(dirname \"${key}\")\")\"\u002F\"$(basename \"${key}\")\n        projectNames+=($value)\n      if [[ $value == $attachedSessionName ]]; then \n        projectDisplayNames+=(\"\u001b[33m$value\u001b[0m\")\n      elif $(contains ${value} ${sessions[@]}); then \n        projectDisplayNames+=(\"\u001b[34m$value\u001b[0m\")\n      else\n        projectDisplayNames+=($value)\n      fi\n    done\n\n    selectedProjectName=$(printf \"%s\\n\" \"${projectDisplayNames[@]}\" | fzf --ansi)\n\n    index=$(indexOf ${selectedProjectName} ${projectNames[@]})\n    selectedPath=\"${projectPaths[$index]}\"\nfi\n\nif [[ -z $selectedProjectName ]]; then\n    exit 0\nfi\n\nif ! $(contains ${selectedProjectName} ${sessions[@]} ); then\n  tmux new-session -ds $selectedProjectName -c $selectedPath\nfi\n\nif ! [[ -z $TMUX ]]; then\n  tmux switch-client -t $selectedProjectName\nelse\n  tmux attach-session -t=$selectedProjectName\nfi\n",[15,1138,1139,1143,1147,1152,1157,1162,1167,1172,1176,1181,1185,1190,1195,1200,1205,1210,1214,1218,1222,1226,1230,1234,1238,1242,1246,1250,1254,1258,1262,1266,1270,1274,1279,1284,1289,1294,1299,1304,1309,1314,1319,1324,1329,1334,1339,1345,1351,1357,1363,1368,1374,1380,1386,1392,1398,1403,1409,1414,1419,1425,1430,1435,1440,1445,1451,1457,1463,1469,1474,1479,1484,1489,1495,1501,1506,1512,1517,1523,1529,1535,1541,1546,1552,1558,1564,1570,1576,1582,1588,1594,1600,1606,1612,1617,1623,1628,1634,1640,1645,1650,1655,1660,1665,1670,1675,1680,1685,1690,1695,1700,1705,1710],{"__ignoreMap":121},[125,1140,1141],{"class":127,"line":128},[125,1142,655],{"class":157},[125,1144,1145],{"class":127,"line":138},[125,1146,258],{"emptyLinePlaceholder":257},[125,1148,1149],{"class":127,"line":149},[125,1150,1151],{"class":157},"function usage {\n",[125,1153,1154],{"class":127,"line":266},[125,1155,1156],{"class":157},"  echo \"Project Launcher\"\n",[125,1158,1159],{"class":127,"line":271},[125,1160,1161],{"class":157},"  echo \"\"\n",[125,1163,1164],{"class":127,"line":286},[125,1165,1166],{"class":157},"  echo \"Launch tmux session at your project directory or attach\u002Fswitch to an existing session\"\n",[125,1168,1169],{"class":127,"line":291},[125,1170,1171],{"class":157},"  echo \"Supports fuzzy search power by fzf in multiple project directories\"\n",[125,1173,1174],{"class":127,"line":713},[125,1175,1161],{"class":157},[125,1177,1178],{"class":127,"line":719},[125,1179,1180],{"class":157},"  echo \"Usage: $(basename $0) [-d \u003Carg>...] [--] [DIRECTORY...]\" 2>&1\n",[125,1182,1183],{"class":127,"line":725},[125,1184,1161],{"class":157},[125,1186,1187],{"class":127,"line":731},[125,1188,1189],{"class":157},"  echo \"projectPaths:\"\n",[125,1191,1192],{"class":127,"line":737},[125,1193,1194],{"class":157},"  echo \"   -d           add directory for fuzzy search\"\n",[125,1196,1197],{"class":127,"line":743},[125,1198,1199],{"class":157},"  echo \"   -h|--help    show usage\"\n",[125,1201,1202],{"class":127,"line":749},[125,1203,1204],{"class":157},"  exit 1\n",[125,1206,1207],{"class":127,"line":755},[125,1208,1209],{"class":157},"}\n",[125,1211,1212],{"class":127,"line":760},[125,1213,258],{"emptyLinePlaceholder":257},[125,1215,1216],{"class":127,"line":766},[125,1217,690],{"class":157},[125,1219,1220],{"class":127,"line":772},[125,1221,695],{"class":157},[125,1223,1224],{"class":127,"line":778},[125,1225,700],{"class":157},[125,1227,1228],{"class":127,"line":784},[125,1229,705],{"class":157},[125,1231,1232],{"class":127,"line":790},[125,1233,710],{"class":157},[125,1235,1236],{"class":127,"line":796},[125,1237,716],{"class":157},[125,1239,1240],{"class":127,"line":801},[125,1241,722],{"class":157},[125,1243,1244],{"class":127,"line":807},[125,1245,728],{"class":157},[125,1247,1248],{"class":127,"line":813},[125,1249,734],{"class":157},[125,1251,1252],{"class":127,"line":819},[125,1253,740],{"class":157},[125,1255,1256],{"class":127,"line":824},[125,1257,746],{"class":157},[125,1259,1260],{"class":127,"line":830},[125,1261,752],{"class":157},[125,1263,1264],{"class":127,"line":836},[125,1265,728],{"class":157},[125,1267,1268],{"class":127,"line":842},[125,1269,763],{"class":157},[125,1271,1272],{"class":127,"line":847},[125,1273,769],{"class":157},[125,1275,1277],{"class":127,"line":1276},32,[125,1278,775],{"class":157},[125,1280,1282],{"class":127,"line":1281},33,[125,1283,781],{"class":157},[125,1285,1287],{"class":127,"line":1286},34,[125,1288,787],{"class":157},[125,1290,1292],{"class":127,"line":1291},35,[125,1293,793],{"class":157},[125,1295,1297],{"class":127,"line":1296},36,[125,1298,781],{"class":157},[125,1300,1302],{"class":127,"line":1301},37,[125,1303,804],{"class":157},[125,1305,1307],{"class":127,"line":1306},38,[125,1308,810],{"class":157},[125,1310,1312],{"class":127,"line":1311},39,[125,1313,816],{"class":157},[125,1315,1317],{"class":127,"line":1316},40,[125,1318,781],{"class":157},[125,1320,1322],{"class":127,"line":1321},41,[125,1323,827],{"class":157},[125,1325,1327],{"class":127,"line":1326},42,[125,1328,833],{"class":157},[125,1330,1332],{"class":127,"line":1331},43,[125,1333,839],{"class":157},[125,1335,1337],{"class":127,"line":1336},44,[125,1338,258],{"emptyLinePlaceholder":257},[125,1340,1342],{"class":127,"line":1341},45,[125,1343,1344],{"class":157},"function contains () {\n",[125,1346,1348],{"class":127,"line":1347},46,[125,1349,1350],{"class":157},"  local value=$1\n",[125,1352,1354],{"class":127,"line":1353},47,[125,1355,1356],{"class":157},"  shift\n",[125,1358,1360],{"class":127,"line":1359},48,[125,1361,1362],{"class":157},"  local elements=(\"$@\")\n",[125,1364,1366],{"class":127,"line":1365},49,[125,1367,258],{"emptyLinePlaceholder":257},[125,1369,1371],{"class":127,"line":1370},50,[125,1372,1373],{"class":157},"  for el in ${elements[@]}; do\n",[125,1375,1377],{"class":127,"line":1376},51,[125,1378,1379],{"class":157},"    if [[ \"${el}\" = \"${value}\" ]]; then\n",[125,1381,1383],{"class":127,"line":1382},52,[125,1384,1385],{"class":157},"      return 0\n",[125,1387,1389],{"class":127,"line":1388},53,[125,1390,1391],{"class":157},"    fi\n",[125,1393,1395],{"class":127,"line":1394},54,[125,1396,1397],{"class":157},"  done\n",[125,1399,1401],{"class":127,"line":1400},55,[125,1402,258],{"emptyLinePlaceholder":257},[125,1404,1406],{"class":127,"line":1405},56,[125,1407,1408],{"class":157},"  return 1\n",[125,1410,1412],{"class":127,"line":1411},57,[125,1413,1209],{"class":157},[125,1415,1417],{"class":127,"line":1416},58,[125,1418,258],{"emptyLinePlaceholder":257},[125,1420,1422],{"class":127,"line":1421},59,[125,1423,1424],{"class":157},"function indexOf () {\n",[125,1426,1428],{"class":127,"line":1427},60,[125,1429,1350],{"class":157},[125,1431,1433],{"class":127,"line":1432},61,[125,1434,1356],{"class":157},[125,1436,1438],{"class":127,"line":1437},62,[125,1439,1362],{"class":157},[125,1441,1443],{"class":127,"line":1442},63,[125,1444,258],{"emptyLinePlaceholder":257},[125,1446,1448],{"class":127,"line":1447},64,[125,1449,1450],{"class":157},"  for i in \"${!elements[@]}\"; do\n",[125,1452,1454],{"class":127,"line":1453},65,[125,1455,1456],{"class":157},"    if [[ \"${elements[$i]}\" = \"${value}\" ]]; then\n",[125,1458,1460],{"class":127,"line":1459},66,[125,1461,1462],{"class":157},"      echo \"${i}\";\n",[125,1464,1466],{"class":127,"line":1465},67,[125,1467,1468],{"class":157},"      break;\n",[125,1470,1472],{"class":127,"line":1471},68,[125,1473,1391],{"class":157},[125,1475,1477],{"class":127,"line":1476},69,[125,1478,1397],{"class":157},[125,1480,1482],{"class":127,"line":1481},70,[125,1483,1209],{"class":157},[125,1485,1487],{"class":127,"line":1486},71,[125,1488,258],{"emptyLinePlaceholder":257},[125,1490,1492],{"class":127,"line":1491},72,[125,1493,1494],{"class":157},"if [[ $# -eq 1 ]]; then\n",[125,1496,1498],{"class":127,"line":1497},73,[125,1499,1500],{"class":157},"    selectedProjectName=$1\n",[125,1502,1504],{"class":127,"line":1503},74,[125,1505,1117],{"class":157},[125,1507,1509],{"class":127,"line":1508},75,[125,1510,1511],{"class":157},"  projectPaths=($(find ${multi[@]} -mindepth 1 -maxdepth 1 -type d))\n",[125,1513,1515],{"class":127,"line":1514},76,[125,1516,258],{"emptyLinePlaceholder":257},[125,1518,1520],{"class":127,"line":1519},77,[125,1521,1522],{"class":157},"    attachedSessionName=$(tmux display-message -p \\#S)\n",[125,1524,1526],{"class":127,"line":1525},78,[125,1527,1528],{"class":157},"    sessions=$(tmux list-session -F \\#S)\n",[125,1530,1532],{"class":127,"line":1531},79,[125,1533,1534],{"class":157},"    projectDisplayNames=()\n",[125,1536,1538],{"class":127,"line":1537},80,[125,1539,1540],{"class":157},"    projectNames=()\n",[125,1542,1544],{"class":127,"line":1543},81,[125,1545,258],{"emptyLinePlaceholder":257},[125,1547,1549],{"class":127,"line":1548},82,[125,1550,1551],{"class":157},"    for key in ${projectPaths[@]}; do\n",[125,1553,1555],{"class":127,"line":1554},83,[125,1556,1557],{"class":157},"      value=$(basename \"$(dirname \"${key}\")\")\"\u002F\"$(basename \"${key}\")\n",[125,1559,1561],{"class":127,"line":1560},84,[125,1562,1563],{"class":157},"        projectNames+=($value)\n",[125,1565,1567],{"class":127,"line":1566},85,[125,1568,1569],{"class":157},"      if [[ $value == $attachedSessionName ]]; then \n",[125,1571,1573],{"class":127,"line":1572},86,[125,1574,1575],{"class":157},"        projectDisplayNames+=(\"\u001b[33m$value\u001b[0m\")\n",[125,1577,1579],{"class":127,"line":1578},87,[125,1580,1581],{"class":157},"      elif $(contains ${value} ${sessions[@]}); then \n",[125,1583,1585],{"class":127,"line":1584},88,[125,1586,1587],{"class":157},"        projectDisplayNames+=(\"\u001b[34m$value\u001b[0m\")\n",[125,1589,1591],{"class":127,"line":1590},89,[125,1592,1593],{"class":157},"      else\n",[125,1595,1597],{"class":127,"line":1596},90,[125,1598,1599],{"class":157},"        projectDisplayNames+=($value)\n",[125,1601,1603],{"class":127,"line":1602},91,[125,1604,1605],{"class":157},"      fi\n",[125,1607,1609],{"class":127,"line":1608},92,[125,1610,1611],{"class":157},"    done\n",[125,1613,1615],{"class":127,"line":1614},93,[125,1616,258],{"emptyLinePlaceholder":257},[125,1618,1620],{"class":127,"line":1619},94,[125,1621,1622],{"class":157},"    selectedProjectName=$(printf \"%s\\n\" \"${projectDisplayNames[@]}\" | fzf --ansi)\n",[125,1624,1626],{"class":127,"line":1625},95,[125,1627,258],{"emptyLinePlaceholder":257},[125,1629,1631],{"class":127,"line":1630},96,[125,1632,1633],{"class":157},"    index=$(indexOf ${selectedProjectName} ${projectNames[@]})\n",[125,1635,1637],{"class":127,"line":1636},97,[125,1638,1639],{"class":157},"    selectedPath=\"${projectPaths[$index]}\"\n",[125,1641,1643],{"class":127,"line":1642},98,[125,1644,1080],{"class":157},[125,1646,1648],{"class":127,"line":1647},99,[125,1649,258],{"emptyLinePlaceholder":257},[125,1651,1653],{"class":127,"line":1652},100,[125,1654,1070],{"class":157},[125,1656,1658],{"class":127,"line":1657},101,[125,1659,1075],{"class":157},[125,1661,1663],{"class":127,"line":1662},102,[125,1664,1080],{"class":157},[125,1666,1668],{"class":127,"line":1667},103,[125,1669,258],{"emptyLinePlaceholder":257},[125,1671,1673],{"class":127,"line":1672},104,[125,1674,1089],{"class":157},[125,1676,1678],{"class":127,"line":1677},105,[125,1679,1094],{"class":157},[125,1681,1683],{"class":127,"line":1682},106,[125,1684,1080],{"class":157},[125,1686,1688],{"class":127,"line":1687},107,[125,1689,258],{"emptyLinePlaceholder":257},[125,1691,1693],{"class":127,"line":1692},108,[125,1694,1107],{"class":157},[125,1696,1698],{"class":127,"line":1697},109,[125,1699,1112],{"class":157},[125,1701,1703],{"class":127,"line":1702},110,[125,1704,1117],{"class":157},[125,1706,1708],{"class":127,"line":1707},111,[125,1709,1122],{"class":157},[125,1711,1713],{"class":127,"line":1712},112,[125,1714,1080],{"class":157},[11,1716,1717,1718,114],{},"to use the program we have writen you can run ",[15,1719,1720],{},"project-launcher -d ~\u002Fprojects\u002Fpersonal\u002F -d ~\u002Fprojects\u002Fwork",[11,1722,1723,1724,1726],{},"I prever to put this command behind an alias in my ",[15,1725,70],{}," like so",[116,1728,1730],{"className":646,"code":1729,"language":648,"meta":121,"style":121},"...\n\nalias p=\"project-launcher -d ~\u002Fprojects\u002Fpersonal\u002F -d ~\u002Fprojects\u002Fwork\"\n\n...\n",[15,1731,1732,1736,1740,1745,1749],{"__ignoreMap":121},[125,1733,1734],{"class":127,"line":128},[125,1735,263],{"class":157},[125,1737,1738],{"class":127,"line":138},[125,1739,258],{"emptyLinePlaceholder":257},[125,1741,1742],{"class":127,"line":149},[125,1743,1744],{"class":157},"alias p=\"project-launcher -d ~\u002Fprojects\u002Fpersonal\u002F -d ~\u002Fprojects\u002Fwork\"\n",[125,1746,1747],{"class":127,"line":266},[125,1748,258],{"emptyLinePlaceholder":257},[125,1750,1751],{"class":127,"line":271},[125,1752,263],{"class":157},[30,1754,1755],{"id":502},"Wrapping Up",[11,1757,1758],{},"I've been using this little script for a few weeks, and I must say, I'm committed to continuing using tmux this time. I hope that this serves as motivation for you to also develop your personal tools, ultimately enhancing both your productivity and workflow.",[30,1760,515],{"id":514},[517,1762,1763],{},[466,1764,1765,524,1767],{},[125,1766,523],{},[493,1768,1771],{"href":1769,"rel":1770},"https:\u002F\u002Fgithub.com\u002FThePrimeagen\u002F.dotfiles\u002Fblob\u002Fdbfcb9f56e74e035212dcfdeb1675583d13210c6\u002Fbin\u002F.local\u002Fbin\u002Ftmux-sessionizer",[497],"https:\u002F\u002Fgithub.com\u002FThePrimeagen\u002F.dotfiles",[548,1773,1774],{},"html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":121,"searchDepth":138,"depth":138,"links":1776},[1777,1778,1779],{"id":1129,"depth":138,"text":1130},{"id":502,"depth":138,"text":1755},{"id":514,"depth":138,"text":515},"2022-07-27","I found myself growing increasingly frustrated with the need to rapidly switch between multiple coding projects. To tackle this, I resorted to managing various terminal sessions, utilizing Amethyst – a tiling window manager for macOS. The challenge arose when these sessions began to stack up, often reaching three or more terminals in full-screen mode, making it easy to lose track of which window corresponded to which project.","\u002Fimages\u002Fbuild-a-tmux-project-launcher.png",{"slug":1784},"build-a-tmux-project-launcher","\u002Farticles\u002Ftmux-project-laucher",{"title":581,"description":1781},"Build a Tmux project laucher in shell script in a few minutes.","articles\u002Ftmux-project-laucher",[575,605,574,573],"vKLt6oJTDl6uLO-TmTxnX7IRceTWTBpgelhicfsSrxE",1793104389572]