DEV Community

Cover image for OMZ: Some Plugins that I forget about
Vincenzo
Vincenzo

Posted on

OMZ: Some Plugins that I forget about

I have a terrible memory, that is why I posted this about how I setup my dev machine.

Recently also I have remember that not only I install ohmyzsh and set it up as I want, I usually setup some plugins (apart from the git one which comes in enabled as default).

Jira

If you have ever worked in IT you know that you have at least once used Jira, I hate it so much, that is why I started a sideproject to manage my sideprojects Kato/Kiffari (but that is something for another post).

Well one of the thing that jira has is ticket codes, say a project is called WEB PLATFORM, and your ticket is the 187th, your ticket code will be probably WEB-187 or something of the likes.

If you need to review some info on it, you usually have to go to the board, find your ticket, and click on it, but ohmyzsh has a nice little plugin that will open the ticket for you via shell:

jira WEB-187
Enter fullscreen mode Exit fullscreen mode

this will open the jira ticket on your default browser as long as you setup a ~/.jira-url file looking like this:

~
❯ cat ~/.jira-url
https://YOURCOMPANY.atlassian.net/

Enter fullscreen mode Exit fullscreen mode

How do you get it?
Well if you have ohmyzsh install you already have this plugin, you only need to enable it adding it to the plugin array in ~/.zshrc

❯ cat ~/.zshrc
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="refined"
plugins=(git jira)
// more stuff here
Enter fullscreen mode Exit fullscreen mode

NVM

Working with node and some old apps it always means that your default node version might be a bit too fresh for the project itself.

Hopefully you use nvm.

For example in my machine I have set by default the version 23.1.0, the stable one when I setup this machine.

~
❯ nvm list
       v18.20.4
       v20.18.0
->      v23.1.0
default -> stable (-> v23.1.0)
Enter fullscreen mode Exit fullscreen mode

But on a project I am working on I have a .nvmrc file that tells me NOPE.

some-project git:chore/some-branch-name
❯ cat .nvmrc
v18.20.4%
Enter fullscreen mode Exit fullscreen mode

The solution to make everything work fine is always to do a good old:

❯ nvm use
Found '~/code/some-project/.nvmrc' with version <v18.20.4>
Now using node v18.20.4 (npm v10.7.0)

Enter fullscreen mode Exit fullscreen mode

But if you have multiple windows/tabs and you need to run scripts elsewhere, it quickly gets annoying to remember to do it.

Introducing the NVM PLUGIN:

to enable it as the previous one just add the nvm string to the plugin folder, plus a little setting I have found useful:

❯ cat ~/.zshrc
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="refined"
plugins=(git jira nvm)

zstyle ':omz:plugins:nvm' autoload yes
Enter fullscreen mode Exit fullscreen mode

This last line makes the plugin autoload the correct node version when you switch in a folder with a .nvmrc file and switch to the default version when you cd out of it.

~
❯ cd code/some-project
Found '~/code/some-project/.nvmrc' with version <v18.20.4>
Now using node v18.20.4 (npm v10.7.0)


some-project git:chore/some-branch-name
❯ cd
Reverting to nvm default version
Now using node v23.1.0 (npm v10.9.0)

~
❯
Enter fullscreen mode Exit fullscreen mode

Easy peasy and one less thing to type in to get your code going.

More info on this plugin can be found here.

Top comments (0)