~glacambre/firenvim

ref: 6c5ec95986171814433de7a7396a5ab757f53381 firenvim/tests/_vimrc.ts -rw-r--r-- 716 bytes
6c5ec959glacambre package-lock.json: version bump Firenvim 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const fs = require("fs");
const os = require("os");
const path = require("path");
const process = require("process");
const spawn = require("child_process").spawn;

export function setupVimrc() {
        process.env.XDG_CONFIG_HOME = os.tmpdir();
        const nvimdir = path.join(process.env.XDG_CONFIG_HOME, "nvim");
        try {
                fs.mkdirSync(nvimdir);
        } catch (e) {}
        process.env.MYVIMRC = path.join(nvimdir, "init.vim");
        writeVimrc(`set rtp+=${process.cwd()}\n`);
};

export function readVimrc() {
        return fs.readFileSync(process.env.MYVIMRC).toString();
};

export function writeVimrc(content: string) {
        fs.writeFileSync(process.env.MYVIMRC, content);
};