Add test to determine shell
The 'sh' filetype in Vim covers sh, bash and ksh. This function looks for declared variables that results from Vim's own test. The global variables are checked first since they are typically specifed by the user in .vimrc
This commit is contained in:
parent
5f1f8d6700
commit
630b74872b
@ -1,3 +1,17 @@
|
|||||||
|
global !p
|
||||||
|
import vim
|
||||||
|
def testShell(scope, shell):
|
||||||
|
return vim.eval("exists('" + scope + ":is_" + shell + "')")
|
||||||
|
|
||||||
|
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 #
|
# TextMate Snippets #
|
||||||
|
Loading…
Reference in New Issue
Block a user