Merge remote-tracking branch 'osse/master'
This commit is contained in:
commit
09ba802800
@ -1,15 +1,32 @@
|
||||
global !p
|
||||
import vim
|
||||
|
||||
# Tests for the existence of a variable declared by Vim's filetype detection
|
||||
# suggesting the type of shell script of the current file
|
||||
def testShell(scope, shell):
|
||||
return vim.eval("exists('" + scope + ":is_" + shell + "')")
|
||||
|
||||
# Loops over the possible variables, checking for global variables
|
||||
# first since they indicate an override by the user.
|
||||
def getShell():
|
||||
for scope in ["g", "b"]:
|
||||
for shell in ["bash", "sh", "kornshell"]:
|
||||
if testShell(scope, shell) == "1":
|
||||
if shell == "kornshell":
|
||||
return "ksh"
|
||||
return shell
|
||||
return "sh"
|
||||
endglobal
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
snippet #!
|
||||
#!/bin/sh
|
||||
|
||||
`!p snip.rv = '#!/bin/' + getShell() + "\n\n" `
|
||||
endsnippet
|
||||
|
||||
snippet !env "#!/usr/bin/env (!env)"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
|
||||
endsnippet
|
||||
|
||||
snippet temp "Tempfile"
|
||||
|
13
UltiSnips/zsh.snippets
Normal file
13
UltiSnips/zsh.snippets
Normal file
@ -0,0 +1,13 @@
|
||||
extends sh
|
||||
|
||||
snippet #! "shebang" !
|
||||
#!/bin/zsh
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet !env "#!/usr/bin/env (!env)" !
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
@ -1291,6 +1291,7 @@ Contributors listed in chronological order:
|
||||
Theocrite (theocrite)
|
||||
Ferdinand Majerech (kiith-sa)
|
||||
Vivien Didelot
|
||||
Øystein Walle (osse)
|
||||
|
||||
Thank you for your support.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user