Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node version slice when using nvm #47

Open
jhacksworth opened this issue Dec 17, 2015 · 1 comment
Open

Node version slice when using nvm #47

jhacksworth opened this issue Dec 17, 2015 · 1 comment

Comments

@jhacksworth
Copy link

If you're using nvm (Node Version Manager), this will show the active Node.js/io.js version:

'$(nvm_ls_current 2>/dev/null | grep -v none)'

Here's my preset, for example, where I put the node version in the a section:

let g:promptline_preset = {
        \'a'    : [ promptline#slices#python_virtualenv(), '$(nvm_ls_current 2>/dev/null | grep -v none)', '$USER', promptline#slices#host({ 'only_if_ssh': 1 })],
        \'b'    : [ promptline#slices#vcs_branch(), promptline#slices#git_status() ],
        \'c'    : [ '\w' ],
        \'warn' : [ promptline#slices#last_exit_code() ]}

The a section will show virtualenv, node version, user name and, if logged in through ssh, host name.

Is there a proper place to save these type of examples, maybe a wiki page?

@edkolev
Copy link
Owner

edkolev commented Dec 18, 2015

Sure, you can add a wiki page with details about this.

BTW you can use something like this to avoid calling grep:

$( nvm_version="$(nvm_ls_current)"; echo ${nvm_version#none} )

I haven't tested it much though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants