1
0
mirror of https://github.com/amix/vimrc synced 2025-07-10 11:44:59 +08:00

Add markdown preview, update rust.vim

This commit is contained in:
Kurtis Moxley
2022-05-19 20:12:11 +08:00
parent d26bc75459
commit d6ef288a88
156 changed files with 29900 additions and 0 deletions

View File

@ -0,0 +1 @@
export declare function getIP(): string;

View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIP = void 0;
function getIP() {
const interfaces = require('os').networkInterfaces();
let IP = '';
Object.keys(interfaces).some(devName => {
const iface = interfaces[devName];
for (const alias of iface) {
if (alias.family === 'IPv4' &&
alias.address !== '127.0.0.1' &&
!alias.internal) {
IP = alias.address;
return true;
}
}
return false;
});
return IP;
}
exports.getIP = getIP;

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const fs_1 = tslib_1.__importDefault(require("fs"));
const log4js_1 = tslib_1.__importDefault(require("log4js"));
const os_1 = tslib_1.__importDefault(require("os"));
const path_1 = tslib_1.__importDefault(require("path"));
const MAX_LOG_SIZE = 1024 * 1024;
const MAX_LOG_BACKUPS = 10;
const LOG_FILE_PATH = process.env.NVIM_MKDP_LOG_FILE || path_1.default.join(os_1.default.tmpdir(), 'mkdp-nvim.log');
const level = process.env.NVIM_MKDP_LOG_LEVEL || 'info';
if (level === 'debug') {
fs_1.default.writeFileSync(LOG_FILE_PATH, '', 'utf8');
}
const isRoot = process.getuid && process.getuid() === 0;
if (!isRoot) {
log4js_1.default.configure({
appenders: {
out: {
type: 'file',
filename: LOG_FILE_PATH,
maxLogSize: MAX_LOG_SIZE,
backups: MAX_LOG_BACKUPS,
layout: {
type: 'pattern',
// Format log in following pattern:
// yyyy-MM-dd HH:mm:ss.mil $Level (pid:$pid) $categroy - $message.
pattern: `%d{yyyy-MM-dd hh:mm:ss} %p (pid:${process.pid}) [%c] - %m`
}
}
},
categories: {
default: { appenders: ['out'], level }
}
});
}
module.exports = (name = 'mkdp') => {
return log4js_1.default.getLogger(name);
};

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/*
* fork from https://github.com/domenic/opener
*/
const child_process_1 = tslib_1.__importDefault(require("child_process"));
const os_1 = tslib_1.__importDefault(require("os"));
module.exports = function opener(args, tool) {
let platform = process.platform;
args = [].concat(args);
// Attempt to detect Windows Subystem for Linux (WSL).
// WSL itself as Linux (which works in most cases), but in
// this specific case we need to treat it as actually being Windows.
// The "Windows-way" of opening things through cmd.exe works just fine here,
// whereas using xdg-open does not, since there is no X Windows in WSL.
if (platform === 'linux' && os_1.default.release().toLowerCase().indexOf('microsoft') !== -1) {
platform = 'win32';
}
// http://stackoverflow.com/q/1480971/3191, but see below for Windows.
let command;
switch (platform) {
case 'win32': {
command = 'cmd.exe';
if (tool) {
args.unshift(tool);
}
break;
}
case 'darwin': {
command = 'open';
if (tool) {
args.unshift(tool);
args.unshift('-a');
}
break;
}
default: {
command = tool || 'xdg-open';
break;
}
}
if (platform === 'win32') {
// On Windows, we really want to use the "start" command.
// But, the rules regarding arguments with spaces, and escaping them with quotes,
// can get really arcane. So the easiest way to deal with this is to pass off the
// responsibility to "cmd /c", which has that logic built in.
//
// Furthermore, if "cmd /c" double-quoted the first parameter,
// then "start" will interpret it as a window title,
// so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
//
// Additionally, on Windows ampersand needs to be escaped when passed to "start"
args = args.map(value => {
return value.replace(/&/g, '^&');
});
args = ['/c', 'start', '""'].concat(args);
}
return child_process_1.default.spawn(command, args, {
shell: false,
detached: true
});
};