From 991bfd28be7357830265bdfbdfd19ad218bba278 Mon Sep 17 00:00:00 2001 From: RyotaUshio Date: Tue, 4 Jun 2024 12:13:16 +0900 Subject: [PATCH] release: 0.40.4 --- manifest-beta.json | 2 +- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/settings.ts | 19 +++++++++++++++---- src/vim/ex-commands.ts | 2 +- src/vim/visual.ts | 6 ++++++ 7 files changed, 27 insertions(+), 10 deletions(-) diff --git a/manifest-beta.json b/manifest-beta.json index a8f96fba..1fbe3f65 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "pdf-plus", "name": "PDF++", - "version": "0.40.3", + "version": "0.40.4", "minAppVersion": "1.4.16", "description": "The most Obsidian-native PDF annotation tool ever.", "author": "Ryota Ushio", diff --git a/manifest.json b/manifest.json index a8f96fba..1fbe3f65 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "pdf-plus", "name": "PDF++", - "version": "0.40.3", + "version": "0.40.4", "minAppVersion": "1.4.16", "description": "The most Obsidian-native PDF annotation tool ever.", "author": "Ryota Ushio", diff --git a/package-lock.json b/package-lock.json index 0bc0284b..570d0436 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-pdf-plus", - "version": "0.40.3", + "version": "0.40.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsidian-pdf-plus", - "version": "0.40.3", + "version": "0.40.4", "license": "MIT", "devDependencies": { "@cantoo/pdf-lib": "^1.21.0", diff --git a/package.json b/package.json index f3a9e472..e13fb2a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-pdf-plus", - "version": "0.40.3", + "version": "0.40.4", "description": "The most Obsidian-native PDF annotation tool ever.", "scripts": { "dev": "node esbuild.config.mjs", diff --git a/src/settings.ts b/src/settings.ts index 284952c2..a74577f1 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -2916,6 +2916,7 @@ export class PDFPlusSettingTab extends PluginSettingTab { '- `y`: Yank (copy) selected text', `- \`c\`: Run the "${this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand('copy-link-to-selection').name)}" command`, '- `C`: Show context menu at text selection', + '- `o`: Swap the start and end of the selection', '- `:`: Enter command-line mode (experimental)', '- ``: Toggle outline (table of contents)', '- ``: Toggle thumbnails (`S`=`Shift`)', @@ -2946,13 +2947,15 @@ export class PDFPlusSettingTab extends PluginSettingTab { 'map k K', '', '" JavaScript commands', + '" - Hit Ctrl-h in Normal mode to show a message', 'nmap :js alert("Hello, world!")', + '" - Hit Ctrl-h in Visual mode to run a .js file', 'vmap :jsfile filename.js', '', '" Obsidian commands', - '" - Open the current PDF in the OS-default app', + '" - Open the current PDF in the OS-default app by hitting d, e, and then f', 'map def :obcommand open-with-default-app:open', - '" - Go back and forth the history', + '" - Go back and forth the history with Ctrl-o and Ctrl-i', 'map :obcommand app:go-back', 'map :obcommand app:go-forward', '```', @@ -2970,7 +2973,15 @@ export class PDFPlusSettingTab extends PluginSettingTab { this.addHeading('Visual mode', 'vim-visual'), this.addToggleSetting('vimVisualMotion') .setName('Enter visual mode on text selection') - .setDesc('When some text is selected, you can modify the range of selection using the j, k, h, l, w, e, b, 0, ^, $, H, and L keys, similarly to Vim\'s visual mode. H/L are aliases for ^/$, respectively. If disabled, you can use j/k/h/l/0/^/$/H/L keys to scroll the page regardless of text selection. This is highly experimental, and some unexpected behavior might be present especially in line-related motions. Reload the viewer or the app after changing this option.'), + .then((setting) => { + this.renderMarkdown([ + 'When some text is selected, you can modify the range of selection using the `j,` `k`, `h`, `l`, `w`, `e`, `b`, `0`, `^`, `$`, `H`, and `L` keys, similarly to Vim\'s visual mode (`H`/`L` are mapped to `^`/`$` by default). If disabled, you can use `j`/`k`/`h`/`l`/`0`/`^`/`$`/`H`/`L` keys to scroll the page regardless of text selection. Reload the viewer or the app after changing this option.', + '', + 'Tips:', + '- You can use `o` to swap the start and end of the selection.', + '- As you know, `/` and `?` keys initiate search. Pressing `gn`/`gN` after the search will select the search result. You can also use search to extend the current selection to the search result.', + ], setting.descEl); + }), this.addHeading('Outline mode', 'vim-outline'), this.addToggleSetting('enableVimOutlineMode') .setName('Enter outline mode when opening PDF outline view') @@ -3013,7 +3024,7 @@ export class PDFPlusSettingTab extends PluginSettingTab { .then((setting) => { this.renderMarkdown([ 'Hitting `f` will enter the hint mode, where you can perform certain actions on links, annotations, and backlink highlighting in the PDF page without using the mouse.', - 'For example, first press `f` to enter the hint mode, and if the link you want to open gets marked with "HK", then hit `h` and then `k` (without `Shift`) to open it.', + 'For example, first press `f` to enter the hint mode, and if the link you want to open gets marked with "HK", then hit `h` and then `k` (without `Shift`) to open it.', '', 'This is inspired by [Tridactyl](https://github.com/tridactyl/tridactyl)\'s hint mode.', '', diff --git a/src/vim/ex-commands.ts b/src/vim/ex-commands.ts index 549a6a23..d1fb3e63 100644 --- a/src/vim/ex-commands.ts +++ b/src/vim/ex-commands.ts @@ -128,7 +128,7 @@ export const exCommands = (vim: VimBindings): ExCommand[] => { `, func: (...targets) => { if (targets.length === 0) targets = vim.settings.vimHintArgs.trim().split(/\s+/); - if (targets.includes('all')) targets = ['link', 'annotation', 'backlink']; + if (targets.includes('all')) targets = ['link', 'annot', 'backlink']; vim.hintMode.setTarget(...targets.map((target) => { switch (target) { case 'link': return VimHintTarget.Link diff --git a/src/vim/visual.ts b/src/vim/visual.ts index 7fcca4e5..5f526772 100644 --- a/src/vim/visual.ts +++ b/src/vim/visual.ts @@ -101,6 +101,12 @@ export class VimVisualMode extends VimBindingsMode { '^': visualMotion(() => this.extendSelctionToLineBoundary(false)), '$': visualMotion(() => this.extendSelctionToLineBoundary(true)), } : {}, + 'o': visualMotion(() => { + const selection = this.doc.getSelection(); + if (selection) { + swapSelectionAnchorAndFocus(selection); + } + }), 'y': () => { const selection = this.doc.getSelection(); if (selection) {