close
The Wayback Machine - https://web.archive.org/web/20210121050434/https://github.com/Rpinski/vscode-shebang-snippets
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Shebang Snippets

Visual Studio Marketplace

Set of snippets for Visual Studio Code to insert "shebang" lines for various types of scripts and interpreters used on Unix-like systems.

Features

After opening a new file you can just type:

  • #! or shebang if the file type is detected Shebang Snippets in action Note: For most of the supported languages # means the beginning of a comment, so there you always have to press CTRL + SPACE after #! to see the snippet due to VSCode behavior with comments.
  • #! and the interpreter name if the file type is NOT detected Shebang Snippets in action

to add the full line. Currently supported shebang snippets:

  • Shell:
    • #!sh -> #!/usr/bin/env sh
    • #!bash -> #!/usr/bin/env bash
  • Expect: #!expect -> #!/usr/bin/expect -f
  • Perl: #!perl -> #!/usr/bin/env perl
  • Lua: #!lua -> #!/usr/bin/env lua
  • Python:
    • #!python -> #!/usr/bin/env python
    • #!python+encoding ->
      • #!/usr/bin/env python
      • # -*- coding: utf-8 -*-
  • PHP: #!php -> #!/usr/bin/env php
  • Node: #!node -> #!/usr/bin/env node
  • F#: #!fsharp -> #!/usr/bin/env fsharpi --exec
  • Ruby:
    • #!ruby -> #!/usr/bin/env ruby
    • #!ruby+encoding ->
      • #!/usr/bin/env ruby
      • # -*- coding: utf-8 -*-
  • Groovy: #!groovy -> #!/usr/bin/env groovy
  • PowerShell Core: #!pwsh or #!powershell -> #!/usr/bin/env pwsh

To insert the magic comment for encoding (# -*- coding: utf-8 -*-) you can also just type #encoding. The snippet offers different encodings for selection.

If you have already saved your script with appropriate file extension and need the shebang, you can alternatively just start typing shebang to complete the line for your script type.

You can’t perform that action at this time.