Skip to content

Commit

Permalink
release: 0.40.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaUshio committed Jun 4, 2024
1 parent 540d60b commit 991bfd2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 15 additions & 4 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
'- `<Tab>`: Toggle outline (table of contents)',
'- `<S-Tab>`: Toggle thumbnails (`S`=`Shift`)',
Expand Down Expand Up @@ -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 <C-h> :js alert("Hello, world!")',
'" - Hit Ctrl-h in Visual mode to run a .js file',
'vmap <C-h> :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 <C-o> :obcommand app:go-back',
'map <C-i> :obcommand app:go-forward',
'```',
Expand All @@ -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')
Expand Down Expand Up @@ -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.',
'',
Expand Down
2 changes: 1 addition & 1 deletion src/vim/ex-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/vim/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 991bfd2

Please sign in to comment.