Coder Social home page Coder Social logo

zsh-better-npm-completion's Introduction

zsh-better-npm-completion

Better completion for npm

GitHub Donate Bitcoin Donate Lightning Donate

  • Makes npm install recommendations from npm cache
  • Makes npm uninstall recommendations from dependencies/devDependencies
  • Shows detailed information on script contents for npm run
  • Falls back to default npm completions if we don't have anything better

Installation

Using Antigen

Bundle zsh-better-npm-completion in your .zshrc

antigen bundle lukechilds/zsh-better-npm-completion

Using zplug

Load zsh-better-npm-completion as a plugin in your .zshrc

zplug "lukechilds/zsh-better-npm-completion", defer:2

Using zgen

Include the load command in your .zshrc

zgen load lukechilds/zsh-better-npm-completion

As an Oh My ZSH! custom plugin

Clone zsh-better-npm-completion into your custom plugins repo

git clone https://github.com/lukechilds/zsh-better-npm-completion ~/.oh-my-zsh/custom/plugins/zsh-better-npm-completion

Then load as a plugin in your .zshrc

plugins+=(zsh-better-npm-completion)

Manually

Clone this repository somewhere (~/.zsh-better-npm-completion for example)

git clone https://github.com/lukechilds/zsh-better-npm-completion.git ~/.zsh-better-npm-completion

Then source it in your .zshrc

source ~/.zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh

Related

  • zsh-nvm - Zsh plugin for installing, updating and loading nvm
  • gifgen - Simple high quality GIF encoding

License

MIT © Luke Childs

zsh-better-npm-completion's People

Contributors

adalinesimonian avatar lukechilds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsh-better-npm-completion's Issues

Add support for yarn

I came back over an old fork I've made that supported yarn completion. And I went through my mind that it could fit together in the same app. If you're in, just tell me :)

Completion functions should always be autoloaded

Completion functions should always be autoloaded (lazy loaded). Otherwise this slows down startup and increases memory overhead.

A _npm file should be in a dir in fpath with #compdef npm which is only defined when used.

This is zsh best practice.

error when export NVM_LAZY_LOAD=true

I get the following error when using "export NVM_LAZY_LOAD=true"

https-COLON--SLASH--SLASH-github.com-SLASH-lukechilds-SLASH-zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh:143: command not found: compdef

Yarn compatibility

Hello,
It would be nice if this plugin supports Yarn also.

Thank you.

Feuture request, npx completions

It should be easy to support npx command for project local binaries, by listing the files in node_modules/.bin and use them as completion suggestions.

Bug: npm install autocompletion not functional

Node Version: v10.1.0
Npm Version: [email protected]
Zsh Version: zsh 5.5.1 (x86_64-debian-linux-gnu)

npm install, followed by a tab, produces npm install _, which when further expanded lists _cacache, _locks, and _logs.

npm install gulp, for example, produces no output. Other npm commands appear to work.

my plugins dont work, please help me. thx

i tried using Antigen, as an Oh My ZSH custom plugin, and Manually three way to install zsh-better-npm-completion, try to make it work. but it doesnt.

i reload shell, still dont work.

$ source ~/.zshrc

i dont know what i did wrong, this is my .zshrc, please help me, thank you.

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=/Users/hejingguo/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=( git zsh-better-npm-completion)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias ws="webstorm"
# alias npm=npm-gif

export NVM_DIR="/Users/hejingguo/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

alias mnpm="npm --registry=http://r.npm.sankuai.com --cache=$HOME/.npm/.cache/mnpm --userconfig=$HOME/.mnpmrc"

export PATH="$HOME/.yarn/bin:$PATH"

Installation through antibody fails

I am trying to use the antigen alternative antibody with this plugin but it fails with the following:

/Users/marvinheilemann/Library/Caches/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-lukechilds-SLASH-zsh-better-npm-completion/zsh-better-npm-completion.plugin.zsh:143: command not found: compdef

I have added the plugin to my .zsh_plugins.txt file and ran antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh.

Autocompleting npm scripts adds spaces

When I use npm run something and the scripts object is indented, zsh-better-npm-completion adds the indentation like \ \ \ \ for 4 space indentation in front of the found script.

Feature request: hide pseudo-private scripts

First. I do like this tool very much, it's one of the most used plugins for me. Thank you!

Now about feature. I do have lots of scripts in my projects. To keep them clean and don't repeat myself, I prefer to group some common parts under sub-scripts, which may not make sense if executed standalone. For example:

"_watch": "...",
"watch:chromium": "npm run _watch -- 'chromium'...",
"watch:firefox": "npm run _watch -- 'firefox'...",

I will never execute _watch itself, so having it on the list of possible commands only harm.

Any chance, this plugin could have some default configuration, which I could use to hide my scripts from the list? E.g. _ on the beginning (same as people do it in JS) or any other (more unique) character. What do you think?

Feature request: Autocomplete directories in "npm install ../"

Feature request: Autocompleting directories when trying to install node modules from files system and not the registry.

This can be very handy when developing modules and you want to test them in some other project and want to install them from another directory and test them before publishing or making a pull request.

npm install ../guard
npm install ~/code/guard

Version tag

Hey, very cool project. Could you please add a tag for your latest release? The reason for this request is, I want to add this package to nixpkgs and it would help a lot :)

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.