笔记

nodejs笔记

npm安装包失败的解决方法

镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

  1. 通过config命令

     npm config set registry http://registry.cnpmjs.org 
     npm info underscore (如果上面配置正确这个命令会有字符串response)
    
  2. 命令行指定

     npm --registry http://registry.cnpmjs.org info underscore 
    
  3. 编辑 ~/.npmrc,win下为nodejs安装目录下的npmrc ,加入下面内容:

     registry = http://registry.cnpmjs.org
    

搜索镜像: http://cnpmjs.org

建立或使用镜像,参考: https://github.com/fenmgk2/cnpmjs.org

引用自:
使用npm安装一些包失败了的看过来(npm国内镜像介绍) - CNode

vim笔记

Windows下设置别名

  • 新建一个vi.bat放到%path%下,如c:\windows\system32下,写入以下内容:

      \path\to\vim.exe %1%
    
  • 方法二,批量设置别名 (推荐)

      1. 新建一个文件`aliases.txt`,放在任意目录下,写入如下别名内容:
    
              ls=dir /ONE $*
              ll=dir /ONE $*
              cat=type $*
              rm=del $*
              cd=cd /d $*
              vi=G:\falconDisk\Vim\vim74\gvim $*
    
      2. 新建另一个文件 `autorun.bat` ,放在任意目录,内容如下:
    
              @echo off
              cls
              color 0A
              doskey /macrofile=\path\to\aliases.txt
      3.  找到注册表如下位置:
    
          [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    
          添加一个字符串值Autorun,值为\path\to\autorun.bat
    
      4. 启动命令行可以看到效果了