Giter VIP home page Giter VIP logo

Comments (13)

FabioAntunes avatar FabioAntunes commented on June 9, 2024

Thanks for reporting the issue I will take a look during the weekend.

from fish-nvm.

nomaed avatar nomaed commented on June 9, 2024

Thanks.
Just wanted to let you know that if I install omf nvm, it works well.
Also, I tried installing only bass, following the advice from here nvm-sh/nvm#303 (comment)

function nvm
    bass source ~/.nvm/nvm.sh ';' nvm $argv
end

was enough to make everything work without the whole nvm package.

from fish-nvm.

FabioAntunes avatar FabioAntunes commented on June 9, 2024

You don't need this plugin at all, as you said just putting that on your config.fish is enough. What I don't like is if you do that slows your shell initiation by a couple of seconds, because it sources nvm everytime. That's why I created this plugin, to only source nvm when you use npm, or node or nvm

from fish-nvm.

nomaed avatar nomaed commented on June 9, 2024

If I add this as a new file, nvm.fish in the functions directory, shouldn't it do the same - source nvm only when the command is actually called?

from fish-nvm.

 avatar commented on June 9, 2024

@nomaed Do you really have to use nvm?

Some people have to use nvm, so this exists, but as you can see setting it up requires knowledge and some work which is why fnm also exists.

from fish-nvm.

nomaed avatar nomaed commented on June 9, 2024

@BRJ I want to use nvm. I need to test stuff on different node versions and it makes the job much easier than I would be otherwise.

Edit: I looked into fnm, and I'll give it a try. I need stuff that can work outside of fish as well.

from fish-nvm.

nomaed avatar nomaed commented on June 9, 2024

So, I installed fnm (fisher install fnm), got the latest node.
Now I'm getting this as an output for npm<Tab> on Ubuntu 16.04:

╰▶ npm 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\>/dev/null\)\)\ \|\|\ return\ \$\?         
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_LINE=\"\$COMP_LINE\"\ \\                
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_POINT=\"\$COMP_POINT\"\ \\              
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ npm\ completion\ --\ \"\$\{words\[@\]\}\"\ \\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\>/dev/null\)\)\ \|\|\ return\ \$\?                 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_LINE=\"\$line\"\ \\                             
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_POINT=\"\$point\"\ \\                           
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ npm\ completion\ --\ \"\$\{words\[@\]\}\"\ \\        
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\>/dev/null\)                                                   
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_LINE=\$BUFFER\ \\                                           
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ COMP_POINT=0\ \\                                                 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ npm\ completion\ --\ \"\$\{words\[@\]\}\"\ \\                    
\ \ \ \ \ \ _get_comp_words_by_ref\ -n\ =\ -n\ @\ -w\ words\ -i\ cword                             
\ \ \ \ \ \ cword=\"\$COMP_CWORD\"                                                                 
\ \ \ \ \ \ words=\(\"\$\{COMP_WORDS\[@\]\}\"\)                                                    
\ \ \ \ compadd\ --\ \$\(COMP_CWORD=\$\(\(CURRENT-1\)\)\ \\                                        
\ \ \ \ else                                                                                       
\ \ \ \ fi                                                                                         
\ \ \ \ if\ type\ _get_comp_words_by_ref\ \&\>/dev/null\;\ then                                    
\ \ \ \ IFS=\"\$si\"                                                                               
\ \ \ \ IFS=\$\'\\n\'\ COMPREPLY=\(\$\(COMP_CWORD=\"\$cword\"\ \\                                  
\ \ \ \ IFS=\$\'\\n\'\ reply=\(\$\(COMP_CWORD=\"\$cword\"\ \\                                      
\ \ \ \ IFS=\$si                                                                                   
\ \ \ \ let\ cword-=1                                                                              
\ \ \ \ local\ cword\ line\ point\ words\ si                                                       
\ \ \ \ local\ si=\"\$IFS\"                                                                        
\ \ \ \ local\ si=\$IFS                                                                            
\ \ \ \ local\ words\ cword                                                                        
\ \ \ \ read\ -Ac\ words                                                                           
\ \ \ \ read\ -cn\ cword                                                                           
\ \ \ \ read\ -l\ line                                                                             
\ \ \ \ read\ -ln\ point                                                                           
\ \ \ \ si=\"\$IFS\"                                                                               
\ \ _npm_completion\ \(\)\ \{                                                                      
\ \ _npm_completion\(\)\ \{                                                                        
\ \ compctl\ -K\ _npm_completion\ npm                                                              
\ \ compdef\ _npm_completion\ npm                                                                  
\ \ complete\ -o\ default\ -F\ _npm_completion\ npm                                                
\ \ \}                                                                                             
\#                                                                                                 
\#\ Installation:\ npm\ completion\ \>\>\ \~/.bashrc\ \ \(or\ \~/.zshrc\)                          
\#\ npm\ command\ completion\ script                                                               
\#\ Or,\ maybe:\ npm\ completion\ \>\ /usr/local/etc/bash_completion.d/npm                         
\#\#\#-begin-npm-completion-\#\#\#                                                                 
\#\#\#-end-npm-completion-\#\#\#                                                                   
add-user                                                              (Add a registry user account)
adduser                                                               (Add a registry user account)
bin                                                                        (Display npm bin folder)
bugs                                                    (Bugs for a package in a web browser maybe)
c                                                              (Manage the npm configuration files)
cache                                                                 (Manipulates package's cache)
config                                                         (Manage the npm configuration files)
ddp                                                                            (Reduce duplication)
dedupe                                                                         (Reduce duplication)
deprecate                                                        (Deprecate a version of a package)
docs                                                    (Docs for a package in a web browser maybe)
edit                                                                    (Edit an installed package)
elif\ type\ compctl\ \&\>/dev/null\;\ then                                                         
elif\ type\ compdef\ \&\>/dev/null\;\ then                                                         
explore                                                               (Browse an installed package)
faq                                                                    (Frequently Asked Questions)
fi                                                                                                 
find                                                                          (Search for packages)
find-dupes                                                                     (Reduce duplication)
get                                                               (Echo the config value to stdout)
help-search                                                         (Search npm help documentation)
home                                                    (Docs for a package in a web browser maybe)
i                                                                               (install a package)
if\ type\ complete\ \&\>/dev/null\;\ then                                                          
info                                                                           (View registry info)
install                                                                         (install a package)
isntall                                                                         (install a package)
issues                                                  (Bugs for a package in a web browser maybe)
la                                                                        (List installed packages)
link                                                                     (Symlink a package folder)
list                                                                      (List installed packages)
ll                                                                        (List installed packages)

fish -v
fish, version 2.3.0
fnm -v
fnm v1.8.0
fisher -v
fisherman version 2.10.0 ~/.config/fish/functions/fisher.fish
npm -v
3.10.1
nvm -v
No command 'nvm' found

from fish-nvm.

 avatar commented on June 9, 2024

Btw fnm has nothing to do with nvm.

Now, I was able to repro the problem with npm completions.

screenshot 2016-06-20 01 10 25

npm completions work okay with verman (which is what I use now).

Would you mind trying out verman also to see if npm completions work fine for you? That would help me determine this is a problem with how fnm creates the npm shim or npm (completions) itself.

https://github.com/fisherman/verman

from fish-nvm.

 avatar commented on June 9, 2024

With verman

screenshot 2016-06-20 01 15 25

from fish-nvm.

 avatar commented on June 9, 2024

I think the problem may be simply that fnm's npm shim is not inheriting npm completions. This should be doable adding --wraps=npm to the function definition, maybe.

from fish-nvm.

FabioAntunes avatar FabioAntunes commented on June 9, 2024

I think it has to do with fish-shell npm completions https://github.com/fish-shell/fish-shell/blob/master/share/completions/npm.fish

As soon I renamed the file /usr/share/fish/completions/npm.fish there's no more auto complete with "garbage". So now I need to discover if the problem is with Bass or with this plugin

from fish-nvm.

FabioAntunes avatar FabioAntunes commented on June 9, 2024

@nomaed It seems after all that the problem was not with the plugin, but with the official completions from fish shell, you can read more about it here fish-shell/fish-shell#3159

And the commit that fixes it fish-shell/fish-shell@10661bb :

The next release of fish shell will have the completions fixed but until then you can fix them manually by doing this:

wget https://raw.githubusercontent.com/fish-shell/fish-shell/master/share/completions/npm.fish

and then do sudo mv npm.fish /usr/share/fish/completions/

from fish-nvm.

nomaed avatar nomaed commented on June 9, 2024

That is great, thank you for following it up!

from fish-nvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.