mirror of
https://github.com/bramses/bramses-highly-opinionated-vault-2023.git
synced 2025-02-26 07:53:55 +00:00
vault backup: 2022-12-10 00:31:33
This commit is contained in:
2319
.obsidian/plugins/obsidian-linter/main.js
vendored
Normal file
2319
.obsidian/plugins/obsidian-linter/main.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
.obsidian/plugins/obsidian-linter/manifest.json
vendored
Normal file
10
.obsidian/plugins/obsidian-linter/manifest.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-linter",
|
||||||
|
"name": "Linter",
|
||||||
|
"version": "1.9.1",
|
||||||
|
"minAppVersion": "0.15.6",
|
||||||
|
"description": "Formats and styles your notes. It can be used to format YAML tags, aliases, arrays, and metadata; footnotes; headings; spacing; math blocks; regular markdown contents like list, italics, and bold styles; and more with the use of custom rule options as well.",
|
||||||
|
"author": "Victor Tao",
|
||||||
|
"authorUrl": "https://github.com/platers",
|
||||||
|
"isDesktopOnly": false
|
||||||
|
}
|
||||||
143
.obsidian/plugins/obsidian-linter/styles.css
vendored
Normal file
143
.obsidian/plugins/obsidian-linter/styles.css
vendored
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/**
|
||||||
|
* Based on https://github.com/Fevol/obsidian-translate/blob/master/src/ui/translator-components/SettingsPage.svelte
|
||||||
|
*/
|
||||||
|
|
||||||
|
.linter-navigation-item {
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 100px;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 8px 8px 2px 2px;
|
||||||
|
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
padding: 4px 6px;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
background-color: var(--background-primary-secondary-alt);
|
||||||
|
|
||||||
|
transition: color 0.25s ease-in-out,
|
||||||
|
padding 0.25s ease-in-out,
|
||||||
|
background-color 0.35s cubic-bezier(0.45, 0.25, 0.83, 0.67),
|
||||||
|
max-width 0.35s cubic-bezier(0.57, 0.04, 0.58, 1);
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1325px) {
|
||||||
|
.linter-navigation-item.linter-desktop {
|
||||||
|
max-width: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 800px) {
|
||||||
|
.linter-navigation-item.linter-mobile {
|
||||||
|
max-width: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-navigation-item-icon {
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-navigation-item:hover {
|
||||||
|
border-color: var(--interactive-accent-hover);
|
||||||
|
border-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-navigation-item-selected {
|
||||||
|
background-color: var(--interactive-accent) !important;
|
||||||
|
color: var(--text-on-accent);
|
||||||
|
padding: 4px 9px !important;
|
||||||
|
max-width: 200px !important;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 8px 8px 2px 2px;
|
||||||
|
border-bottom: 0px;
|
||||||
|
transition: color 0.25s ease-in-out,
|
||||||
|
padding 0.25s ease-in-out,
|
||||||
|
background-color 0.35s cubic-bezier(0.45, 0.25, 0.83, 0.67),
|
||||||
|
max-width 0.45s cubic-bezier(0.57, 0.04, 0.58, 1) 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Based on https://github.com/phibr0/obsidian-commander/blob/main/src/styles.scss
|
||||||
|
*/
|
||||||
|
.linter {
|
||||||
|
transition: transform 400ms 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-setting-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
.linter-setting-title.linter-mobile {
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
.linter-setting-title h1 {
|
||||||
|
font-weight: 900;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-setting-header {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-setting-header .linter-setting-tab-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.linter-setting-tab-group {
|
||||||
|
margin-top: 6px;
|
||||||
|
padding-left: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
|
border-bottom: 2px solid var(--background-modifier-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.linter-setting-header .linter-tab-settings {
|
||||||
|
padding: 6px 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
border-left: 2px solid transparent;
|
||||||
|
border-right: 2px solid transparent;
|
||||||
|
}
|
||||||
|
.linter-setting-header .linter-tab-settings:first-child {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
.linter-setting-header .linter-tab-settings.linter-tab-settings-active {
|
||||||
|
border-bottom: 2px solid var(--background-primary);
|
||||||
|
transform: translateY(2px);
|
||||||
|
border-radius: 2px;
|
||||||
|
border-left: 2px solid var(--background-modifier-border);
|
||||||
|
border-top: 2px solid var(--background-modifier-border);
|
||||||
|
border-right: 2px solid var(--background-modifier-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Hide linter element css
|
||||||
|
* Based on https://zellwk.com/blog/hide-content-accessibly/
|
||||||
|
*/
|
||||||
|
.linter-navigation-item:not(.linter-navigation-item-selected) > span:nth-child(2),
|
||||||
|
.linter-visually-hidden {
|
||||||
|
border: 0;
|
||||||
|
clip: rect(0 0 0 0);
|
||||||
|
clip-path: rect(0 0 0 0);
|
||||||
|
height: auto;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
24636
.obsidian/plugins/obsidian-map-view/main.js
vendored
Normal file
24636
.obsidian/plugins/obsidian-map-view/main.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
.obsidian/plugins/obsidian-map-view/manifest.json
vendored
Normal file
8
.obsidian/plugins/obsidian-map-view/manifest.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"id": "obsidian-map-view",
|
||||||
|
"name": "Map View",
|
||||||
|
"version": "2.2.0",
|
||||||
|
"minAppVersion": "0.15.3",
|
||||||
|
"description": "An interactive map view.",
|
||||||
|
"isDesktopOnly": false
|
||||||
|
}
|
||||||
159
.obsidian/plugins/obsidian-map-view/styles.css
vendored
Normal file
159
.obsidian/plugins/obsidian-map-view/styles.css
vendored
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
.map-view-marker-name {
|
||||||
|
color: var(--text-normal);
|
||||||
|
font-size: var(--font-text-size);
|
||||||
|
font-family: var(--font-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-view-main {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-view-location {
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-view-graph-controls {
|
||||||
|
left: 8px;
|
||||||
|
top: 8px;
|
||||||
|
padding: 8px 20px 8px 8px;
|
||||||
|
background-color: var(--background-primary-alt);
|
||||||
|
max-width: 240px;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
max-height: calc(100% - 16px);
|
||||||
|
overflow: auto;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 8px 25px 5px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-control-div {
|
||||||
|
display: block;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-control-content {
|
||||||
|
display: none;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-control-error {
|
||||||
|
border-color: red !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls-toggle {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls-toggle:checked
|
||||||
|
+ .lbl-triangle
|
||||||
|
+ .lbl-toggle
|
||||||
|
+ .graph-control-content {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbl-triangle {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
transition: 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls-toggle:checked + .lbl-triangle {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-dense-button {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-container .dark-mode {
|
||||||
|
filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg)
|
||||||
|
saturate(0.3) brightness(0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.newPresetDialogGrid {
|
||||||
|
display: grid;
|
||||||
|
grid-row-gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newPresetDialogLine {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clusterPreviewIcon {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
position: relative !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clusterPreviewContainer {
|
||||||
|
display: inline-flex;
|
||||||
|
border-radius: 6px;
|
||||||
|
line-height: 1.5;
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.clusterPreviewContainer .leaflet-marker-icon {
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-control-follow-label {
|
||||||
|
vertical-align: top;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-popup {
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--text-normal);
|
||||||
|
font-size: var(--font-text-size);
|
||||||
|
font-family: var(--font-text);
|
||||||
|
line-height: 1.5;
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
box-shadow: 0 2px 8px var(--background-modifier-box-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable the default Leaflet shadow because we use the Obsidian theme above */
|
||||||
|
.marker-popup .leaflet-popup-content-wrapper {
|
||||||
|
box-shadow: none;
|
||||||
|
background: none;
|
||||||
|
color: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.url-rule-dropdown {
|
||||||
|
max-width: 7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.parsing-rule {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.parsing-rule-line-2 {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-search-suggestion {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-text-div {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-marker-icon {
|
||||||
|
transition: filter 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-view-highlight {
|
||||||
|
filter: drop-shadow(0 0 10px blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
div.map-view-highlight.marker-cluster {
|
||||||
|
box-shadow: 0 0 5px blue;
|
||||||
|
}
|
||||||
237
.obsidian/plugins/open-vscode/main.js
vendored
Normal file
237
.obsidian/plugins/open-vscode/main.js
vendored
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
/*
|
||||||
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
|
*/
|
||||||
|
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
var main_exports = {};
|
||||||
|
__export(main_exports, {
|
||||||
|
default: () => OpenVSCode
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(main_exports);
|
||||||
|
var import_obsidian2 = require("obsidian");
|
||||||
|
|
||||||
|
// src/settings.ts
|
||||||
|
var import_obsidian = require("obsidian");
|
||||||
|
var DEFAULT_SETTINGS = {
|
||||||
|
ribbonIcon: true,
|
||||||
|
ribbonCommandUsesCode: true,
|
||||||
|
executeTemplate: 'code "{{vaultpath}}" "{{vaultpath}}/{{filepath}}"',
|
||||||
|
openFile: true,
|
||||||
|
workspacePath: "{{vaultpath}}",
|
||||||
|
useUrlInsiders: false
|
||||||
|
};
|
||||||
|
var OpenVSCodeSettingsTab = class extends import_obsidian.PluginSettingTab {
|
||||||
|
constructor(app, plugin) {
|
||||||
|
super(app, plugin);
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
display() {
|
||||||
|
const { containerEl } = this;
|
||||||
|
containerEl.empty();
|
||||||
|
containerEl.createEl("h3", { text: "General settings" });
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Display Ribbon Icon").setDesc("Toggle this OFF if you want to hide the Ribbon Icon.").addToggle((toggle) => toggle.setValue(this.plugin.settings.ribbonIcon).onChange((value) => {
|
||||||
|
this.plugin.settings.ribbonIcon = value;
|
||||||
|
this.plugin.saveSettings();
|
||||||
|
this.plugin.refreshIconRibbon();
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Ribbon opens via `code` command").setDesc(`Toggle this OFF if you'd prefer that the Ribbon Icon opens VSCode via URL.`).addToggle((toggle) => toggle.setValue(this.plugin.settings.ribbonCommandUsesCode).onChange((value) => {
|
||||||
|
this.plugin.settings.ribbonCommandUsesCode = value;
|
||||||
|
this.plugin.saveSettings();
|
||||||
|
}));
|
||||||
|
containerEl.createEl("h3", { text: "Open via `code` CLI settings" });
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Template for executing the `code` command").setDesc('You can use the following variables: `{{vaultpath}}` (absolute), `{{filepath}}` (relative). Note that on MacOS, a full path to the VSCode executable is required (generally "/usr/local/bin/code"). Example: `/usr/local/bin/code "{{vaultpath}}" "{{vaultpath}}/{{filepath}}"`').addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.executeTemplate).setValue(this.plugin.settings.executeTemplate || DEFAULT_SETTINGS.executeTemplate).onChange((value) => {
|
||||||
|
value = value.trim();
|
||||||
|
if (value === "")
|
||||||
|
value = DEFAULT_SETTINGS.executeTemplate;
|
||||||
|
this.plugin.settings.executeTemplate = value;
|
||||||
|
this.plugin.saveData(this.plugin.settings);
|
||||||
|
}));
|
||||||
|
containerEl.createEl("h3", { text: "Open via `vscode://` URL settings" });
|
||||||
|
const openViaUrlCaveat = containerEl.createEl("p");
|
||||||
|
const openViaUrlCaveatEm = openViaUrlCaveat.createEl("em", {
|
||||||
|
text: `
|
||||||
|
\u26A0\uFE0F This setting is not recommended for Windows users due to
|
||||||
|
UX issues caused by security enhancements in VSCode on Windows.
|
||||||
|
More information:
|
||||||
|
`
|
||||||
|
});
|
||||||
|
openViaUrlCaveatEm.appendChild(createEl("a", {
|
||||||
|
text: "Open in VSCode Readme",
|
||||||
|
href: "https://github.com/NomarCub/obsidian-open-vscode/blob/master/README.md#caveats-regarding-the-url-command-for-windows-users"
|
||||||
|
}));
|
||||||
|
openViaUrlCaveatEm.appendText(".");
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Open current file").setDesc("Open the current file rather than the root of the vault.").addToggle((toggle) => toggle.setValue(this.plugin.settings.openFile || DEFAULT_SETTINGS.openFile).onChange((value) => {
|
||||||
|
this.plugin.settings.openFile = value;
|
||||||
|
this.plugin.saveData(this.plugin.settings);
|
||||||
|
}));
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Path to VSCode Workspace").setDesc('Defaults to the {{vaultpath}} template variable. You can set this to an absolute path to a ".code-workspace" file if you prefer to use a Multi Root workspace file: ').setClass("setting-item--vscode-workspacePath").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.workspacePath).setValue(this.plugin.settings.workspacePath || DEFAULT_SETTINGS.workspacePath).onChange((value) => {
|
||||||
|
value = value.trim();
|
||||||
|
if (value === "")
|
||||||
|
value = DEFAULT_SETTINGS.workspacePath;
|
||||||
|
this.plugin.settings.workspacePath = value;
|
||||||
|
this.plugin.saveData(this.plugin.settings);
|
||||||
|
}));
|
||||||
|
const workspacePathDescEl = containerEl.querySelector(".setting-item--vscode-workspacePath .setting-item-description");
|
||||||
|
workspacePathDescEl.appendChild(createEl("a", {
|
||||||
|
href: "https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces",
|
||||||
|
text: "https://code.visualstudio.com/docs/editor/workspaces#_multiroot-workspaces"
|
||||||
|
}));
|
||||||
|
workspacePathDescEl.appendText(".");
|
||||||
|
new import_obsidian.Setting(containerEl).setName("Open VSCode using a `vscode-insiders://` URL").addToggle((toggle) => {
|
||||||
|
toggle.setValue(this.plugin.settings.useUrlInsiders).onChange((value) => {
|
||||||
|
this.plugin.settings.useUrlInsiders = value;
|
||||||
|
this.plugin.saveSettings();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/main.ts
|
||||||
|
var svg = `
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M 96.457031 10.777344 L 75.875 0.875 C 73.492188 -0.273438 70.640625 0.210938 68.769531 2.082031 L 29.355469 38.042969 L 12.1875 25.007812 C 10.589844 23.796875 8.355469 23.894531 6.871094 25.246094 L 1.363281 30.253906 C 0.496094 31.042969 0 32.160156 0 33.335938 C -0.00390625 34.507812 0.492188 35.625 1.359375 36.417969 L 16.246094 50 L 1.359375 63.582031 C 0.492188 64.375 -0.00390625 65.492188 0 66.664062 C 0 67.839844 0.496094 68.957031 1.363281 69.746094 L 6.875 74.75 C 8.359375 76.101562 10.59375 76.199219 12.191406 74.988281 L 29.359375 61.953125 L 68.773438 97.914062 C 70.644531 99.785156 73.492188 100.269531 75.875 99.121094 L 96.464844 89.214844 C 98.628906 88.171875 100 85.984375 100 83.582031 L 100 16.414062 C 100 14.011719 98.625 11.820312 96.457031 10.777344 Z M 75.015625 72.699219 L 45.109375 50 L 75.015625 27.300781 Z M 75.015625 72.699219"
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
(0, import_obsidian2.addIcon)("vscode-logo", svg);
|
||||||
|
var DEV = false;
|
||||||
|
var OpenVSCode = class extends import_obsidian2.Plugin {
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
this.refreshIconRibbon = () => {
|
||||||
|
var _a;
|
||||||
|
(_a = this.ribbonIcon) == null ? void 0 : _a.remove();
|
||||||
|
if (this.settings.ribbonIcon) {
|
||||||
|
this.ribbonIcon = this.addRibbonIcon("vscode-logo", "VSCode", () => {
|
||||||
|
const ribbonCommand = this.settings.ribbonCommandUsesCode ? "openVSCode" : "openVSCodeUrl";
|
||||||
|
this[ribbonCommand]();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
async onload() {
|
||||||
|
console.log("Loading " + this.manifest.name + " plugin");
|
||||||
|
this.addSettingTab(new OpenVSCodeSettingsTab(this.app, this));
|
||||||
|
await this.loadSettings();
|
||||||
|
this.refreshIconRibbon();
|
||||||
|
this.addCommand({
|
||||||
|
id: "open-vscode",
|
||||||
|
name: "Open as Visual Studio Code workspace",
|
||||||
|
callback: this.openVSCode.bind(this)
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "open-vscode-via-url",
|
||||||
|
name: "Open as Visual Studio Code workspace using a vscode:// URL",
|
||||||
|
callback: this.openVSCodeUrl.bind(this)
|
||||||
|
});
|
||||||
|
DEV = this.app.plugins.enabledPlugins.has("hot-reload") && this.app.plugins.plugins["hot-reload"].enabledPlugins.has(this.manifest.id);
|
||||||
|
if (DEV) {
|
||||||
|
this.addCommand({
|
||||||
|
id: "open-vscode-reload",
|
||||||
|
name: "Reload the plugin in dev",
|
||||||
|
callback: this.reload.bind(this)
|
||||||
|
});
|
||||||
|
this.addCommand({
|
||||||
|
id: "open-vscode-reset-settings",
|
||||||
|
name: "Reset plugins settings to default in dev",
|
||||||
|
callback: this.resetSettings.bind(this)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async openVSCode() {
|
||||||
|
var _a;
|
||||||
|
if (!(this.app.vault.adapter instanceof import_obsidian2.FileSystemAdapter)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { executeTemplate } = this.settings;
|
||||||
|
const path = this.app.vault.adapter.getBasePath();
|
||||||
|
const file = this.app.workspace.getActiveFile();
|
||||||
|
const filePath = (_a = file == null ? void 0 : file.path) != null ? _a : "";
|
||||||
|
const { exec } = require("child_process");
|
||||||
|
let command = executeTemplate.trim() === "" ? DEFAULT_SETTINGS.executeTemplate : executeTemplate;
|
||||||
|
command = replaceAll(command, "{{vaultpath}}", path);
|
||||||
|
command = replaceAll(command, "{{filepath}}", filePath);
|
||||||
|
if (DEV)
|
||||||
|
console.log("[openVSCode]", { command });
|
||||||
|
exec(command, (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error(`[openVSCode] exec error: ${error}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async openVSCodeUrl() {
|
||||||
|
var _a;
|
||||||
|
if (!(this.app.vault.adapter instanceof import_obsidian2.FileSystemAdapter)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { openFile, useUrlInsiders } = this.settings;
|
||||||
|
const path = this.app.vault.adapter.getBasePath();
|
||||||
|
const file = this.app.workspace.getActiveFile();
|
||||||
|
const filePath = (_a = file == null ? void 0 : file.path) != null ? _a : "";
|
||||||
|
if (DEV)
|
||||||
|
console.log("[open-vscode]", {
|
||||||
|
settings: this.settings,
|
||||||
|
path,
|
||||||
|
filePath
|
||||||
|
});
|
||||||
|
const protocol = useUrlInsiders ? "vscode-insiders://" : "vscode://";
|
||||||
|
let url = `${protocol}file/${path}`;
|
||||||
|
if (openFile) {
|
||||||
|
url += `/${filePath}`;
|
||||||
|
const workspacePath = replaceAll(this.settings.workspacePath, "{{vaultpath}}", path);
|
||||||
|
window.open(`vscode://file/${workspacePath}`);
|
||||||
|
setTimeout(() => {
|
||||||
|
if (DEV)
|
||||||
|
console.log("[openVSCode]", { url });
|
||||||
|
window.open(url);
|
||||||
|
}, 200);
|
||||||
|
} else {
|
||||||
|
if (DEV)
|
||||||
|
console.log("[openVSCode]", { url });
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async loadSettings() {
|
||||||
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||||
|
}
|
||||||
|
async saveSettings() {
|
||||||
|
await this.saveData(this.settings);
|
||||||
|
}
|
||||||
|
async reload() {
|
||||||
|
const id = this.manifest.id;
|
||||||
|
const plugins = this.app.plugins;
|
||||||
|
await plugins.disablePlugin(id);
|
||||||
|
await plugins.enablePlugin(id);
|
||||||
|
console.log("[open-vscode] reloaded", this);
|
||||||
|
}
|
||||||
|
async resetSettings() {
|
||||||
|
console.log("[open-vscode]", { old: this.settings, DEFAULT_SETTINGS });
|
||||||
|
this.settings = DEFAULT_SETTINGS;
|
||||||
|
await this.saveData(this.settings);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function escapeRegExp(string) {
|
||||||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
}
|
||||||
|
function replaceAll(str, find, replace) {
|
||||||
|
return str.replace(new RegExp(escapeRegExp(find), "g"), replace);
|
||||||
|
}
|
||||||
10
.obsidian/plugins/open-vscode/manifest.json
vendored
Normal file
10
.obsidian/plugins/open-vscode/manifest.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "open-vscode",
|
||||||
|
"name": "Open vault in VSCode",
|
||||||
|
"version": "1.2.1",
|
||||||
|
"minAppVersion": "0.16.3",
|
||||||
|
"description": "Ribbon button and command to open vault as a Visual Studio Code workspace",
|
||||||
|
"author": "NomarCub",
|
||||||
|
"authorUrl": "https://github.com/NomarCub",
|
||||||
|
"isDesktopOnly": true
|
||||||
|
}
|
||||||
@@ -147,7 +147,7 @@ Highlighted from [source](https://www.livescience.com/11011-marathons-26-2-miles
|
|||||||
Second pass:
|
Second pass:
|
||||||
|
|
||||||
> ...
|
> ...
|
||||||
> In a nod to Greek history, the first marathon commemorated the [run](https://www.livescience.com/5359-perfect-running-pace-revealed.html) of the soldier Pheidippides from a battlefield near the town of Marathon, Greece, to Athens in 490 B.C. According to legend, ==Pheidippides ran the approximately 25 miles to announce the defeat of the [Persians](https://www.livescience.com/who-were-the-persians) ==to some anxious Athenians. Not quite in mid-season shape, he delivered the message =="Niki!" (Victory!) then keeled over and died==.
|
> In a nod to Greek history, the first marathon commemorated the [run](https://www.livescience.com/5359-perfect-running-pace-revealed.html) of the soldier Pheidippides from a battlefield near the town of Marathon, Greece, to Athens in 490 B.C. According to legend, **Pheidippides ran the approximately 25 miles to announce the defeat of the [Persians](https://www.livescience.com/who-were-the-persians) **to some anxious Athenians. Not quite in mid-season shape, he delivered the message **"Niki!" (Victory!) then keeled over and died**.
|
||||||
> ...
|
> ...
|
||||||
|
|
||||||
Third pass:
|
Third pass:
|
||||||
@@ -259,6 +259,7 @@ These plugins aren't needed, as some are QoL and others have a steep price tag a
|
|||||||
- [Shimmering Obsidian](https://github.com/chrisgrieser/shimmering-obsidian) (Alfred plugin)
|
- [Shimmering Obsidian](https://github.com/chrisgrieser/shimmering-obsidian) (Alfred plugin)
|
||||||
- Full Calendar
|
- Full Calendar
|
||||||
- GPT-3 Summarizer
|
- GPT-3 Summarizer
|
||||||
|
- Obsidian Linter
|
||||||
|
|
||||||
# A Day in the Life - Real World Use
|
# A Day in the Life - Real World Use
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user