Ⅰ. 插件描述
:metal: A simple plugin to insert the correct shebang of the file.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'sbdchd/vim-shebang-hands-off'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'sbdchd/vim-shebang-hands-off'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'sbdchd/vim-shebang-hands-off'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/sbdchd/vim-shebang
Ⅳ. 文档说明
A simple plugin to insert the correct shebang of the file.
Install
Plug 'sbdchd/vim-shebang'Usage
Run the command :ShebangInsert or use an autocmd e.g., au! BufNewFile * ShebangInsert.
Normally, :ShebangInsert will not overwrite an existing shebang.
By calling the command with a bang, :ShebangInsert!, any existing shebang
will be overwritten.
Additionally, a shebang can be specified by passing a name/filetype to :ShebangInsert.
:ShebangInsert pythonor
:ShebangInsert nodeYou can also directly pass your desired shebang to the function.
:ShebangInsert #!/bin/shConfig
To add/change/remove a shebang and filetype, simple create the dictionary g:shebang#shebangs
in your .vimrc.
let g:shebang#shebangs = {
\ 'python': '#!/bin/python',
\ 'sh': '',
\ 'newfiletype': '#!/bin/newshebang'
\ }Supported Filetypes
- Applescript
- Bash
- Erlang (Escript)
- Fish
- Lua
- Node
- Perl
- PHP
- Python
- Ruby
- Sh
- Zsh
