Guest User

Untitled

a guest
Feb 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. const activate = (oni) => {
  2. console.log("config activated")
  3.  
  4. // Per-workspace init.vim
  5. const path = require("path")
  6. const fs = require("fs")
  7.  
  8. const loadWorkspaceInitVim = () => {
  9. if (oni.workspace.activeWorkspace) {
  10. // We're assuming it lives in `.oni/init.vim`
  11. const initVimFile = path.join(oni.workspace.activeWorkspace, ".oni", "init.vim")
  12.  
  13. if (fs.existsSync(initVimFile)) {
  14. oni.editors.activeEditor.neovim.command(":so " + initVimFile)
  15. }
  16. }
  17. }
  18.  
  19. // Load the per-workspace init vim whenever it changes
  20. oni.workspace.onDirectoryChanged.subscribe(() => loadWorkspaceInitVim())
  21. // And also on startup, in case we already have a workspace
  22. loadWorkspaceInitVim()
  23. // End per-workspace init.vim
  24. ...
  25. }
Add Comment
Please, Sign In to add comment