Skip to content

Commit ec0bbfb

Browse files
🤖 automatedchrisgrieser
authored andcommitted
iMac Home (2)
1 parent d7c0f29 commit ec0bbfb

2 files changed

Lines changed: 5 additions & 22 deletions

File tree

obsidian/vimrc/obsidian-vimrc.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ noremap <CR> :altBuffer<CR>
154154
nnoremap - /
155155
156156
" <Esc> clears highlights & notices
157-
exmap clearNotices jsfile Meta/vimrc-jsfile.js { clearNotices() }
157+
exmap clearNotices jscommand { for (const el of activeDocument.body.getElementsByClassName("notice")) el.hide() }
158158
nnoremap <Esc> :clearNotices<CR>:nohl<CR>
159159
160160
" Another Quick Switcher ripgrep-search (somewhat close to Telescope's livegrep)
@@ -309,8 +309,8 @@ exmap openAppearanceSettings jsfile Meta/vimrc-jsfile.js { openAppearanceSetting
309309
nnoremap ,pa :openAppearanceSettings<CR>
310310
311311
" open community plugin settings
312-
exmap openCommunityPluginsSettings jsfile Meta/vimrc-jsfile.js { openCommunityPluginsSettings() }
313-
nnoremap ,pl :openCommunityPluginsSettings<CR>
312+
exmap openCommunityPlugins jscommand { view.app.setting.open(); view.app.setting.openTabById("community-plugins") }
313+
nnoremap ,pl :openCommunityPlugins<CR>
314314
315315
" [i] install [p]lugins
316316
exmap installPlugins jscommand { view.app.workspace.protocolHandlers.get("show-plugin")({ id: ' ' }); }
@@ -499,7 +499,7 @@ exmap spellcheck obcommand editor:toggle-spellcheck
499499
nnoremap ,os :spellcheck<CR>
500500
501501
" [o]ption: [n]umbers
502-
exmap toggleLineNumbers jsfile Meta/vimrc-jsfile.js { toggleLineNumbers() }
502+
exmap toggleLineNumbers jscommand { view.app.vault.setConfig("showLineNumber", !view.app.vault.getConfig("showLineNumber")) }
503503
nnoremap ,on :toggleLineNumbers<CR>
504504
505505
" [o]ption: [c]onceal

obsidian/vimrc/vimrc-jsfile.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
// DOCS https://github.com/esm7/obsidian-vimrc-support/blob/master/JsSnippets.md
2-
//──────────────────────────────────────────────────────────────────────────────
3-
4-
function toggleLineNumbers() {
5-
const vault = view.app.vault;
6-
vault.setConfig("showLineNumber", !vault.getConfig("showLineNumber"));
7-
}
8-
9-
function clearNotices() {
10-
const allNotices = activeDocument.body.getElementsByClassName("notice");
11-
for (const el of allNotices) el.hide();
12-
}
132

143
function deleteLastChar() {
154
const cursor = editor.getCursor();
@@ -64,11 +53,6 @@ function openAppearanceSettings() {
6453
container.scrollTop = container.scrollHeight;
6554
}
6655

67-
function openCommunityPluginsSettings() {
68-
69-
view.app.setting.openTabById("community-plugins");
70-
}
71-
7256
function openDynamicHighlightsSettings() {
7357
const setting = view.app.setting;
7458
setting.open();
@@ -341,7 +325,7 @@ async function fixWordUnderCursor() {
341325
}
342326
}
343327

344-
/** Save/Load a workspace using the Workspaces Core Plugin.
328+
/** Save/load a workspace using the Workspaces Core Plugin.
345329
* Enables the plugin before, and disables it afterward.
346330
* @param {"load"|"save"} action
347331
* @param {string} workspaceName
@@ -420,7 +404,6 @@ function inspectUnresolvedLinks() {
420404

421405
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: okay here
422406
function toggleComment() {
423-
// CONFIG
424407
/** @type {Record<string, string|string[]>} */
425408
const commentChars = {
426409
md: ["<!--", "-->"],

0 commit comments

Comments
 (0)