Skip to content

Instantly share code, notes, and snippets.

@bryphe
Created February 12, 2018 22:33
Show Gist options
  • Save bryphe/561eda04e78be0c31e5d2ef9d8dcc36e to your computer and use it in GitHub Desktop.
Save bryphe/561eda04e78be0c31e5d2ef9d8dcc36e to your computer and use it in GitHub Desktop.
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