Created
February 12, 2018 22:33
-
-
Save bryphe/561eda04e78be0c31e5d2ef9d8dcc36e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const activate = (oni) => { | |
console.log("config activated") | |
// Per-workspace init.vim | |
const path = require("path") | |
const fs = require("fs") | |
const loadWorkspaceInitVim = () => { | |
if (oni.workspace.activeWorkspace) { | |
// We're assuming it lives in `.oni/init.vim` | |
const initVimFile = path.join(oni.workspace.activeWorkspace, ".oni", "init.vim") | |
if (fs.existsSync(initVimFile)) { | |
oni.editors.activeEditor.neovim.command(":so " + initVimFile) | |
} | |
} | |
} | |
// Load the per-workspace init vim whenever it changes | |
oni.workspace.onDirectoryChanged.subscribe(() => loadWorkspaceInitVim()) | |
// And also on startup, in case we already have a workspace | |
loadWorkspaceInitVim() | |
// End per-workspace init.vim | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment