Compare commits

..

10 commits

Author SHA1 Message Date
exoticknight
f704374dba Release v1.0.6 2025-03-31 11:12:58 +00:00
exoticknight
70a20c7155 chore: update plugin description for clarity and consistency 2025-03-31 19:12:03 +08:00
exoticknight
f7c6a2980c Release v1.0.5 2025-03-22 16:38:46 +00:00
exoticknight
4dd394ac96 fix: update copyright year and improve command identifiers for clarity 2025-03-23 00:37:42 +08:00
exoticknight
fa6273e6a9 Release v1.0.4 2025-03-16 09:48:40 +00:00
exoticknight
524ec4d678 refactor: remove Platform enum and update keybinding logic 2025-03-16 17:41:41 +08:00
exoticknight
94da6baf9b refactor: rename MyPlugin to QuickNavPlugin for clarity 2025-01-28 12:33:40 +08:00
exoticknight
705ebaa44c Release v1.0.2 2025-01-27 17:03:03 +00:00
exoticknight
85d4356d3b fix: remove redundant steps from release workflow 2025-01-28 01:01:57 +08:00
exoticknight
ed8cc64fb3 feat: add LICENSE file with Apache 2.0 license 2025-01-28 00:40:17 +08:00
12 changed files with 190 additions and 236 deletions

View file

@ -40,9 +40,6 @@ jobs:
# Build and zip release
npm install
npm run build
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
- name: Commit version changes
uses: EndBug/add-and-commit@v9

13
LICENSE Normal file
View file

@ -0,0 +1,13 @@
Copyright 2025 exoticknight
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

55
README.ja.md Normal file
View file

@ -0,0 +1,55 @@
# Quick Nav
[English](./README.md) | [中文](./README.zh-cn.md) | 日本語
ショートカットキーの隠れた力を解放し、編集体験を向上させます。
## 使い方
Quick Nav は強力なナビゲーション操作を提供しますが、デフォルトのショートカットキーは設定されていません。これにより、お好みに合わせて自由に編集体験をカスタマイズすることができます。
以下は**推奨されるショートカットキーの設定**です。Obsidianのホットキー設定で設定できます
### 推奨カーソル移動ショートカット
- **カーソルを上に移動**: `Alt + I` (Windows/Linux), `Ctrl + I` (MacOS)
- **カーソルを下に移動**: `Alt + K` (Windows/Linux), `Ctrl + K` (MacOS)
- **カーソルを左に移動**: `Alt + J` (Windows/Linux), `Ctrl + J` (MacOS)
- **カーソルを右に移動**: `Alt + L` (Windows/Linux), `Ctrl + L` (MacOS)
- **ページを上にスクロール**: `Alt + U` (Windows/Linux), `Ctrl + U` (MacOS)
- **ページを下にスクロール**: `Alt + O` (Windows/Linux), `Ctrl + O` (MacOS)
- **行頭に移動**: `Alt + H` (Windows/Linux), `Ctrl + H` (MacOS)
- **行末に移動**: `Alt + ;` (Windows/Linux), `Ctrl + ;` (MacOS)
### 推奨テキスト選択ショートカット
- **上に選択**: `Alt + Shift + I` (Windows/Linux), `Ctrl + Shift + I` (MacOS)
- **下に選択**: `Alt + Shift + K` (Windows/Linux), `Ctrl + Shift + K` (MacOS)
- **左に選択**: `Alt + Shift + J` (Windows/Linux), `Ctrl + Shift + J` (MacOS)
- **右に選択**: `Alt + Shift + L` (Windows/Linux), `Ctrl + Shift + L` (MacOS)
- **行頭まで選択**: `Alt + Shift + H` (Windows/Linux), `Ctrl + Shift + H` (MacOS)
- **行末まで選択**: `Alt + Shift + ;` (Windows/Linux), `Ctrl + Shift + ;` (MacOS)
### ショートカットキーの設定方法
1. Obsidianの設定を開く
2. 「ホットキー」オプションに移動
3. 「Quick Nav」を検索
4. 各操作にお好みのショートカットキーを割り当てる
## インストール方法
### 方法 1: Obsidian設定からインストール
1. Obsidianを開き、「設定」に移動します。
2. 「サードパーティプラグイン」タブを選択します。
3. 「閲覧」をクリックし、「Quick Nav」を検索します。
4. 「インストール」をクリックし、その後「有効化」をクリックします。
### 方法 2: 手動インストール
1. [GitHubリポジトリ](https://github.com/exoticknight/quick-nav/releases)から最新リリースをダウンロードします。
2. ファイルを解凍します。
3. 解凍したフォルダをObsidianの保管庫のプラグインディレクトリにコピーします`/path/to/your/vault/.obsidian/plugins/`
4. Obsidianを開き、「設定」に移動します。
5. 「サードパーティプラグイン」タブで「Quick Nav」を有効にします。

View file

@ -1,12 +1,16 @@
# Quick Nav
English | [中文](./README.zh-cn.md)
English | [中文](./README.zh-cn.md) | [日本語](./README.ja.md)
Swift cursor navigation plugin to enhance editing.
Enhance your editing experience by unleashing the hidden power of shortcuts.
## Usage
### Cursor Move
Quick Nav exposes powerful navigation operations without binding default shortcuts. This gives you the freedom to customize your editing experience according to your preferences.
Below are our **recommended shortcut bindings** that you can set up in Obsidian's Hotkeys settings:
### Recommended Cursor Movement Shortcuts
- **Move Cursor Up**: `Alt + I` (Windows/Linux), `Ctrl + I` (MacOS)
- **Move Cursor Down**: `Alt + K` (Windows/Linux), `Ctrl + K` (MacOS)
@ -17,7 +21,7 @@ Swift cursor navigation plugin to enhance editing.
- **Move Cursor Left End**: `Alt + H` (Windows/Linux), `Ctrl + H` (MacOS)
- **Move Cursor Right End**: `Alt + ;` (Windows/Linux), `Ctrl + ;` (MacOS)
### Cursor Select
### Recommended Cursor Selection Shortcuts
- **Select Cursor Up**: `Alt + Shift + I` (Windows/Linux), `Ctrl + Shift + I` (MacOS)
- **Select Cursor Down**: `Alt + Shift + K` (Windows/Linux), `Ctrl + Shift + K` (MacOS)
@ -26,6 +30,13 @@ Swift cursor navigation plugin to enhance editing.
- **Select Cursor Left End**: `Alt + Shift + H` (Windows/Linux), `Ctrl + Shift + H` (MacOS)
- **Select Cursor Right End**: `Alt + Shift + ;` (Windows/Linux), `Ctrl + Shift + ;` (MacOS)
### Setting Up Your Shortcuts
1. Open Obsidian Settings
2. Go to "Hotkeys"
3. Search for "Quick Nav"
4. Assign your preferred shortcuts to each operation
## Installation
### Method 1: Install via Obsidian Settings

View file

@ -1,12 +1,16 @@
# Quick Nav
[English](./README.md) | 中文
[English](./README.md) | 中文 | [日本語](./README.ja.md)
快速光标导航插件以增强编辑功能
通过释放快捷键的隐藏力量,增强您的编辑体验
## 使用方法
### 光标移动
Quick Nav 提供强大的导航操作,但不绑定默认快捷键。这让您可以根据自己的偏好自由定制编辑体验。
以下是我们**推荐的快捷键绑定**,您可以在 Obsidian 的热键设置中进行设置:
### 推荐的光标移动快捷键
- **向上移动光标**: `Alt + I` (Windows/Linux), `Ctrl + I` (MacOS)
- **向下移动光标**: `Alt + K` (Windows/Linux), `Ctrl + K` (MacOS)
@ -14,31 +18,38 @@
- **向右移动光标**: `Alt + L` (Windows/Linux), `Ctrl + L` (MacOS)
- **向上翻页**: `Alt + U` (Windows/Linux), `Ctrl + U` (MacOS)
- **向下翻页**: `Alt + O` (Windows/Linux), `Ctrl + O` (MacOS)
- **移动到行首**: `Alt + H` (Windows/Linux), `Ctrl + H` (MacOS)
- **移动到行尾**: `Alt + ;` (Windows/Linux), `Ctrl + ;` (MacOS)
- **移行首**: `Alt + H` (Windows/Linux), `Ctrl + H` (MacOS)
- **移行尾**: `Alt + ;` (Windows/Linux), `Ctrl + ;` (MacOS)
### 光标选择
### 推荐的光标选择快捷键
- **向上选择光标**: `Alt + Shift + I` (Windows/Linux), `Ctrl + Shift + I` (MacOS)
- **向下选择光标**: `Alt + Shift + K` (Windows/Linux), `Ctrl + Shift + K` (MacOS)
- **向左选择光标**: `Alt + Shift + J` (Windows/Linux), `Ctrl + Shift + J` (MacOS)
- **向右选择光标**: `Alt + Shift + L` (Windows/Linux), `Ctrl + Shift + L` (MacOS)
- **选择到行首**: `Alt + Shift + H` (Windows/Linux), `Ctrl + Shift + H` (MacOS)
- **选择到行尾**: `Alt + Shift + ;` (Windows/Linux), `Ctrl + Shift + ;` (MacOS)
- **向上选择**: `Alt + Shift + I` (Windows/Linux), `Ctrl + Shift + I` (MacOS)
- **向下选择**: `Alt + Shift + K` (Windows/Linux), `Ctrl + Shift + K` (MacOS)
- **向左选择**: `Alt + Shift + J` (Windows/Linux), `Ctrl + Shift + J` (MacOS)
- **向右选择**: `Alt + Shift + L` (Windows/Linux), `Ctrl + Shift + L` (MacOS)
- **选择至行首**: `Alt + Shift + H` (Windows/Linux), `Ctrl + Shift + H` (MacOS)
- **选择至行尾**: `Alt + Shift + ;` (Windows/Linux), `Ctrl + Shift + ;` (MacOS)
### 设置您的快捷键
1. 打开 Obsidian 设置
2. 前往"热键"选项
3. 搜索"Quick Nav"
4. 为每个操作分配您喜欢的快捷键
## 安装方法
### 方法一: 通过 Obsidian 设置安装
### 方法 1: 通过 Obsidian 设置安装
1. 打开 Obsidian 并进入 `设置`
2. 导航到 `第三方插件` 标签。
3. 点击 `浏览` 并搜索 `Quick Nav`
4. 点击 `安装` 然后 `启用`
1. 打开 Obsidian 并进入`设置`。
2. 导航至`第三方插件`选项卡
3. 点击`浏览`并搜索`Quick Nav`。
4. 点击`安装`然后`启用`。
### 方法: 手动安装
### 方法 2: 手动安装
1. 从 [GitHub 仓库](https://github.com/exoticknight/quick-nav/releases) 下载最新版本。
2. 解压 zip 文件内容
3. 将解压后的文件夹复制到你的 Obsidian vault 的插件目录:`/path/to/your/vault/.obsidian/plugins/`。
4. 打开 Obsidian 并进入 `设置`
5. 导航`第三方插件` 标签并启用 `Quick Nav`
1. 从 [GitHub 仓库](https://github.com/exoticknight/quick-nav/releases) 下载最新发布版本。
2. 解压缩文件
3. 将解压后的文件夹复制到您的 Obsidian 保管库的插件目录:`/path/to/your/vault/.obsidian/plugins/`。
4. 打开 Obsidian 并进入`设置`。
5. 导航至`第三方插件`选项卡并启用`Quick Nav`

View file

@ -1,11 +1,10 @@
{
"id": "quick-nav",
"name": "Quick Nav",
"version": "1.0.1",
"version": "1.0.6",
"minAppVersion": "0.15.0",
"description": "Swift cursor navigation plugin to enhance editing",
"description": "Enhance your editing experience by unleashing the hidden power of shortcuts",
"author": "ExoticKnight",
"authorUrl": "https://github.com/exoticknight",
"fundingUrl": "https://github.com/exoticknight",
"isDesktopOnly": true
}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "quick-nav",
"version": "1.0.1",
"version": "1.0.6",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "quick-nav",
"version": "1.0.1",
"version": "1.0.6",
"license": "MIT",
"devDependencies": {
"@codemirror/commands": "^6.8.0",

View file

@ -1,7 +1,7 @@
{
"name": "quick-nav",
"version": "1.0.1",
"description": "Swift cursor navigation plugin to enhance editing",
"version": "1.0.6",
"description": "Enhance your editing experience by unleashing the hidden power of shortcuts",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
@ -10,7 +10,7 @@
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],
"author": "",
"author": "exoticknight",
"license": "MIT",
"devDependencies": {
"@codemirror/commands": "^6.8.0",

View file

@ -1,4 +1,3 @@
import type { Modifier } from "obsidian";
import type { Command } from "@codemirror/view";
import {
cursorCharLeft,
@ -10,105 +9,50 @@ import {
cursorLineBoundaryLeft,
cursorLineBoundaryRight,
} from "@codemirror/commands";
import { Platform } from "src/constraints";
export const CursorMove: {
id: string;
name: string;
modifiers: {
[Platform.Windows]: Modifier[];
[Platform.MacOS]: Modifier[];
[Platform.Linux]: Modifier[];
};
key: string;
commandFn: Command;
}[] = [
{
id: "quick-nav-move-cursor-up",
name: "Move Cursor Up",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-up",
name: "Move cursor up",
commandFn: cursorLineUp,
},
key: "I",
commandFn: cursorLineUp,
},
{
id: "quick-nav-move-cursor-down",
name: "Move Cursor Down",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-down",
name: "Move cursor down",
commandFn: cursorLineDown,
},
key: "K",
commandFn: cursorLineDown,
},
{
id: "quick-nav-move-cursor-left",
name: "Move Cursor Left",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-left",
name: "Move cursor left",
commandFn: cursorCharLeft,
},
key: "J",
commandFn: cursorCharLeft,
},
{
id: "quick-nav-move-cursor-right",
name: "Move Cursor Right",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-right",
name: "Move cursor right",
commandFn: cursorCharRight,
},
key: "L",
commandFn: cursorCharRight,
},
{
id: "quick-nav-move-cursor-page-up",
name: "Move Cursor Page Up",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-page-up",
name: "Move cursor page up",
commandFn: cursorPageUp,
},
key: "U",
commandFn: cursorPageUp,
},
{
id: "quick-nav-move-cursor-page-down",
name: "Move Cursor Page Down",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-page-down",
name: "Move cursor page down",
commandFn: cursorPageDown,
},
key: "O",
commandFn: cursorPageDown,
},
{
id: "quick-nav-move-cursor-left-end",
name: "Move Cursor Left End",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-left-end",
name: "Move cursor left end",
commandFn: cursorLineBoundaryLeft,
},
key: "H",
commandFn: cursorLineBoundaryLeft,
},
{
id: "quick-nav-move-cursor-right-end",
name: "Move Cursor Right End",
modifiers: {
[Platform.Windows]: ["Alt"],
[Platform.MacOS]: ["Ctrl"],
[Platform.Linux]: ["Alt"],
{
id: "move-cursor-right-end",
name: "Move cursor right end",
commandFn: cursorLineBoundaryRight,
},
key: ";",
commandFn: cursorLineBoundaryRight,
},
];
];

View file

@ -1,4 +1,3 @@
import type { Modifier } from "obsidian";
import type { Command } from "@codemirror/view";
import {
selectCharLeft,
@ -8,83 +7,40 @@ import {
selectLineBoundaryLeft,
selectLineBoundaryRight,
} from "@codemirror/commands";
import { Platform } from "src/constraints";
export const CursorSelect: {
id: string;
name: string;
modifiers: {
[Platform.Windows]: Modifier[];
[Platform.MacOS]: Modifier[];
[Platform.Linux]: Modifier[];
};
key: string;
commandFn: Command;
}[] = [
{
id: "quick-nav-select-cursor-up",
name: "Select Cursor Up",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-up",
name: "Select cursor up",
commandFn: selectLineUp,
},
key: "I",
commandFn: selectLineUp,
},
{
id: "quick-nav-select-cursor-down",
name: "Select Cursor Down",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-down",
name: "Select cursor down",
commandFn: selectLineDown,
},
key: "K",
commandFn: selectLineDown,
},
{
id: "quick-nav-select-cursor-left",
name: "Select Cursor Left",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-left",
name: "Select cursor left",
commandFn: selectCharLeft,
},
key: "J",
commandFn: selectCharLeft,
},
{
id: "quick-nav-select-cursor-right",
name: "Select Cursor Right",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-right",
name: "Select cursor right",
commandFn: selectCharRight,
},
key: "L",
commandFn: selectCharRight,
},
{
id: "quick-nav-select-cursor-left-end",
name: "Select Cursor Left End",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-left-end",
name: "Select cursor left end",
commandFn: selectLineBoundaryLeft,
},
key: "H",
commandFn: selectLineBoundaryLeft,
},
{
id: "quick-nav-select-cursor-right-end",
name: "Select Cursor Right End",
modifiers: {
[Platform.Windows]: ["Alt", "Shift"],
[Platform.MacOS]: ["Ctrl", "Shift"],
[Platform.Linux]: ["Alt", "Shift"],
{
id: "select-cursor-right-end",
name: "Select cursor right end",
commandFn: selectLineBoundaryRight,
},
key: ";",
commandFn: selectLineBoundaryRight,
},
];
];

View file

@ -1,5 +0,0 @@
export enum Platform {
Windows = "win",
MacOS = "mac",
Linux = "linux",
}

View file

@ -1,30 +1,17 @@
import {
MarkdownView,
Modifier,
Editor,
Plugin,
Platform as OBPlatform,
} from "obsidian";
import { Command, EditorView } from "@codemirror/view";
import { CursorMove, CursorSelect } from "./codeMirrorCommand";
import { Platform } from "./constraints";
export default class MyPlugin extends Plugin {
export default class QuickNavPlugin extends Plugin {
async onload() {
let platform: Platform = Platform.Windows;
if (OBPlatform.isMacOS) {
platform = Platform.MacOS;
}
if (OBPlatform.isLinux) {
platform = Platform.Linux;
}
CursorMove.forEach((cursorMove) => {
this.registerKeybindToCMCommand(
cursorMove.id,
cursorMove.name,
cursorMove.modifiers[platform],
cursorMove.key,
cursorMove.commandFn
);
});
@ -33,8 +20,6 @@ export default class MyPlugin extends Plugin {
this.registerKeybindToCMCommand(
cursorSelect.id,
cursorSelect.name,
cursorSelect.modifiers[platform],
cursorSelect.key,
cursorSelect.commandFn
);
});
@ -43,32 +28,20 @@ export default class MyPlugin extends Plugin {
registerKeybindToCMCommand(
id: string,
name: string,
modifiers: Modifier[],
key: string,
commandFn: Command
) {
this.addCommand({
id,
name,
callback: () => this.getEditorViewToExecCommand(commandFn),
hotkeys: [
{
modifiers,
key,
},
],
editorCallback: (editor) => this.getEditorViewToExecCommand(editor, commandFn)
});
}
getEditorViewToExecCommand(command: Command): boolean {
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
if (view) {
// @ts-expect-error, not typed
const editorView = view.editor.cm as EditorView;
return command(editorView);
}
return false;
getEditorViewToExecCommand(editor: Editor, command: Command): boolean {
// @ts-expect-error, not typed
const editorView = editor.cm as EditorView;
return command(editorView);
}
onunload() {}
onunload() { }
}