There is still hope to your ZSH config
I started to work with Linux almost 10 years ago, and back there I discovered how my Ubuntu/Debian terminal could make a lot more for me if I start to personalize him. Started with little things, an alias, a shortcut or maybe an environment variable here or there.
But at some point, my .zshrc had 200 lines and my feeling was that I could not maintain it anymore.
First step — add a package manager
I heard once that:
“A good developer is a lazy developer.”
And for me, this means automatize as much as possible in terms of my terminal. With years I started to have plugins for everything, from a beautiful PS1 line to a script to extract any compressed format.
Stop to deal with that manually and use a package manager! In my case, I started to use antigen and now my plugins block looks like that:
Second step — componentize your .zshrc
You can add practically anything to your .zshrc in order to automatize your tasks and for me, these means have a lot of things that don't really fit with each other.
And by extracting things to similar domains by simply checking if the script exists, I’m able to add and remove sensible code or proprietary configurations deleting an import. And that mess turns into this:
Create your own plugins
Antigen has a nice approach to plugins, you can reference and import any GitHub repository that has .zsh extensions and load on your session.
That old functions you lost in your .zshrc can become a GitHub repository and not only be shared but pretty well organized inside your system.
Homesick is the way I found to automatize the installation of my dotfiles whenever I had to in simple steps.
~/$ homesick clone alexrochas/dotfiles~/$ homesick link dotfiles
I know, there is a lot of creative ways to do that, but I really liked this one and extend this for almost every dotfile I had.
Powerline is a theme for ZSH that does exactly what I need. Again, I liked so much that I even installed on my .vimrc.
You may already hear that “z is the new j”. Well, Z is a tool to navigate between folder in a faster peace.
~/$ cd ./Development/ProjectX/some/folder/
You can just:
~/$ z proj fol #and let z resolves the pattern
The best approach at the end is the one that works for you. Doesn’t matter if it is bash, zsh, fish or whatever. The important thing is to try to work in smart ways.
What do you think? I forgot something or you found a different way? Let me know in the comments and check my dotfiles in GitHub.