From 5e42ac97a65d15a69f66cca7f12e18c4b535383e Mon Sep 17 00:00:00 2001 From: Alex Norman Date: Sat, 7 Mar 2020 13:03:21 -0800 Subject: [PATCH 1/2] prefer bin path one up from SCVim.sc --- sc/SCVim.sc | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/sc/SCVim.sc b/sc/SCVim.sc index d11f4f2..e801a26 100644 --- a/sc/SCVim.sc +++ b/sc/SCVim.sc @@ -42,33 +42,44 @@ SCVim { }; StartUp.add { - var classList, file, hugeString = "syn keyword scObject", basePath; + var classList, file, hugeString = "syn keyword scObject", basePath, binPath, ftpluginPath; - // search in vim's standard 'pack' directories - PathName("~/.vim/pack/*/*/".standardizePath).folders.do{ |folder| - if(folder.fullPath.contains("scvim")) { - basePath = folder.fullPath; - }; - }; + // see if this file in the 'scvim' directory, prefer that + basePath = PathName(this.class.filenameSymbol.asString.dirname) +/+ PathName(".."); - // search two folders deep below ~/.vim for a folder named "*scvim*" - if(basePath.isNil) { - PathName("~/.vim".standardizePath).folders.do{ |folder| + binPath = basePath +/+ PathName("bin/"); + ftpluginPath = basePath +/+ PathName("ftplugin/"); + + if(File.exists(binPath.fullPath) && File.exists(ftpluginPath.fullPath)) { + basePath = basePath.fullPath; + } { + basePath = nil; + // search in vim's standard 'pack' directories + PathName("~/.vim/pack/*/*/".standardizePath).folders.do{ |folder| if(folder.fullPath.contains("scvim")) { basePath = folder.fullPath; - } { - folder.folders.do{ |subfolder| - if(subfolder.fullPath.contains("scvim")) { - basePath = subfolder.fullPath; + }; + }; + + // search two folders deep below ~/.vim for a folder named "*scvim*" + if(basePath.isNil) { + PathName("~/.vim".standardizePath).folders.do{ |folder| + if(folder.fullPath.contains("scvim")) { + basePath = folder.fullPath; + } { + folder.folders.do{ |subfolder| + if(subfolder.fullPath.contains("scvim")) { + basePath = subfolder.fullPath; + } } - } + }; }; }; }; if(basePath.isNil) { ("\nSCVim could not be initialized.\n" - ++ "Consult the README to see how to install scvim.\n").error + ++ "Consult the README to see how to install scvim.\n").error } { //collect all class names as strings in a Array classList = Object.allSubclasses.collect{ arg i; var name; @@ -79,7 +90,7 @@ SCVim { file = File((basePath ++ "/syntax/supercollider_objects.vim").standardizePath,"w"); file.write(hugeString); file.close; - } + }; }; } From 0e6cb8d6b5f7e0469384fcd7cbdef1e59ed898bb Mon Sep 17 00:00:00 2001 From: Alex Norman Date: Thu, 26 Mar 2020 11:51:46 -0700 Subject: [PATCH 2/2] PathName("..") didn't work on osx --- sc/SCVim.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/SCVim.sc b/sc/SCVim.sc index e801a26..09f61f1 100644 --- a/sc/SCVim.sc +++ b/sc/SCVim.sc @@ -45,7 +45,7 @@ SCVim { var classList, file, hugeString = "syn keyword scObject", basePath, binPath, ftpluginPath; // see if this file in the 'scvim' directory, prefer that - basePath = PathName(this.class.filenameSymbol.asString.dirname) +/+ PathName(".."); + basePath = PathName(this.class.filenameSymbol.asString.dirname) +/+ ".."; binPath = basePath +/+ PathName("bin/"); ftpluginPath = basePath +/+ PathName("ftplugin/");