promptline.vim
promptline.vim copied to clipboard
Node version slice when using nvm
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?
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