tabby-nv-shift-enter 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +75 -0
- package/README.md +75 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +179 -0
- package/dist/settings-tab-provider.d.ts +9 -0
- package/dist/settings-tab-provider.js +28 -0
- package/dist/settings-tab.component.d.ts +28 -0
- package/dist/settings-tab.component.js +165 -0
- package/package.json +42 -0
package/README.ja.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# tabby-nv-shift-enter
|
|
2
|
+
|
|
3
|
+
[Tabby](https://tabby.sh) ターミナルエミュレータ向けのプラグインです。ホットキー(デフォルト: `Shift+Enter`)押下時の動作をカスタマイズできます。
|
|
4
|
+
|
|
5
|
+
**[English version here](README.md)**
|
|
6
|
+
|
|
7
|
+
## 機能
|
|
8
|
+
|
|
9
|
+
- **バックスラッシュ + 改行モード** — ` \` に続けて改行を送信します。bash / zsh などのシェルで行継続が可能になります
|
|
10
|
+
- **改行のみモード** — 改行文字のみを送信します
|
|
11
|
+
- **カスタムテキスト** — 送信するテキストを自由に設定できます。エスケープシーケンス(`\n`、`\t`、`\\`)に対応
|
|
12
|
+
- **ライブプレビュー** — 設定パネルで送信内容を即時確認できます
|
|
13
|
+
- **多言語 UI** — 設定パネルは英語・日本語に対応(Tabby の言語設定に連動)
|
|
14
|
+
|
|
15
|
+
## インストール
|
|
16
|
+
|
|
17
|
+
Tabby のプラグインマネージャーからインストール:
|
|
18
|
+
|
|
19
|
+
1. Tabby を開き、**設定** → **プラグイン** へ移動
|
|
20
|
+
2. `tabby-nv-shift-enter` を検索
|
|
21
|
+
3. **インストール** をクリック
|
|
22
|
+
|
|
23
|
+
手動でインストールする場合:
|
|
24
|
+
|
|
25
|
+
> **注意:** 手動インストールには npm へのパッケージ公開が必要です。"Not found" と表示される場合は、プラグインマネージャーをご利用ください。
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# macOS/Linux
|
|
29
|
+
cd ~/.config/tabby
|
|
30
|
+
npm install tabby-nv-shift-enter
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```cmd
|
|
34
|
+
:: Windows (コマンドプロンプト)
|
|
35
|
+
cd %APPDATA%\tabby
|
|
36
|
+
npm install tabby-nv-shift-enter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
# Windows (PowerShell)
|
|
41
|
+
cd "$env:APPDATA\tabby"
|
|
42
|
+
npm install tabby-nv-shift-enter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 使い方
|
|
46
|
+
|
|
47
|
+
1. **設定** → **NV Shift Enter** を開いて動作を設定する
|
|
48
|
+
2. **改行前にバックスラッシュを含める** をオン / オフで切り替える
|
|
49
|
+
3. オンの場合、送信するテキストをカスタマイズする(デフォルト: ` \` + 改行)
|
|
50
|
+
4. **設定** → **ホットキー** を開き、**「Send configured custom text」** に任意のキーを割り当てる(デフォルト: `Shift+Enter`)
|
|
51
|
+
5. ターミナルタブでホットキーを押すと、設定したテキストが送信される
|
|
52
|
+
|
|
53
|
+
## 設定項目
|
|
54
|
+
|
|
55
|
+
| 項目 | デフォルト | 説明 |
|
|
56
|
+
|------|-----------|------|
|
|
57
|
+
| バックスラッシュを含める | `true` | カスタムテキストを送信する(無効時は改行のみ) |
|
|
58
|
+
| カスタムテキスト | ` \\\n` | ホットキー押下時に送信するテキスト。`\n`・`\t`・`\\` が使用可能 |
|
|
59
|
+
|
|
60
|
+
### シェル別カスタムテキスト例
|
|
61
|
+
|
|
62
|
+
| シェル | カスタムテキスト | 備考 |
|
|
63
|
+
|--------|----------------|------|
|
|
64
|
+
| bash / zsh | ` \\\n` | デフォルト — バックスラッシュ + 改行 |
|
|
65
|
+
| PowerShell | `` ` \n `` | 行継続にバッククォートを使用 |
|
|
66
|
+
| CMD | ` ^\n` | 行継続にキャレットを使用 |
|
|
67
|
+
| WSL / Windows 上の Git Bash | ` \\\n` | bash/zsh と同じ |
|
|
68
|
+
|
|
69
|
+
## 動作要件
|
|
70
|
+
|
|
71
|
+
- Tabby v1.0.197-nightly.1 以降
|
|
72
|
+
|
|
73
|
+
## ライセンス
|
|
74
|
+
|
|
75
|
+
ISC
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# tabby-nv-shift-enter
|
|
2
|
+
|
|
3
|
+
A [Tabby](https://tabby.sh) plugin that customizes the behavior when a hotkey (default: `Shift+Enter`) is pressed in the terminal.
|
|
4
|
+
|
|
5
|
+
**[日本語版はこちら](README.ja.md)**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Backslash + newline mode** — sends ` \` followed by a newline, enabling line continuation in shells (bash, zsh, etc.)
|
|
10
|
+
- **Newline-only mode** — sends only a newline character
|
|
11
|
+
- **Custom text** — fully configurable text to send, with escape sequence support (`\n`, `\t`, `\\`)
|
|
12
|
+
- **Live preview** — visual preview of the configured text in the settings panel
|
|
13
|
+
- **Multilingual UI** — settings panel supports English and Japanese (follows Tabby's language setting)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install via Tabby's plugin manager:
|
|
18
|
+
|
|
19
|
+
1. Open Tabby → **Settings** → **Plugins**
|
|
20
|
+
2. Search for `tabby-nv-shift-enter`
|
|
21
|
+
3. Click **Install**
|
|
22
|
+
|
|
23
|
+
Or install manually:
|
|
24
|
+
|
|
25
|
+
> **Note:** Manual installation requires the package to be available on npm. If the command returns "Not found", use the plugin manager instead.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# macOS/Linux
|
|
29
|
+
cd ~/.config/tabby
|
|
30
|
+
npm install tabby-nv-shift-enter
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```cmd
|
|
34
|
+
:: Windows (Command Prompt)
|
|
35
|
+
cd %APPDATA%\tabby
|
|
36
|
+
npm install tabby-nv-shift-enter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
# Windows (PowerShell)
|
|
41
|
+
cd "$env:APPDATA\tabby"
|
|
42
|
+
npm install tabby-nv-shift-enter
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
1. Open **Settings** → **NV Shift Enter** to configure behavior
|
|
48
|
+
2. Toggle **Include backslash before newline** on or off
|
|
49
|
+
3. If enabled, customize the text to send (default: ` \` + newline)
|
|
50
|
+
4. Open **Settings** → **Hotkeys**, find **"Send configured custom text"**, and assign your preferred key (default: `Shift+Enter`)
|
|
51
|
+
5. Press the hotkey in any terminal tab to send the configured text
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
| Option | Default | Description |
|
|
56
|
+
|--------|---------|-------------|
|
|
57
|
+
| Include backslash | `true` | Send custom text (with backslash) instead of a plain newline |
|
|
58
|
+
| Custom text | ` \\\n` | Text sent when the hotkey is pressed. Supports `\n`, `\t`, `\\` |
|
|
59
|
+
|
|
60
|
+
### Custom text examples by shell
|
|
61
|
+
|
|
62
|
+
| Shell | Custom text | Notes |
|
|
63
|
+
|-------|------------|-------|
|
|
64
|
+
| bash / zsh | ` \\\n` | Default — backslash + newline |
|
|
65
|
+
| PowerShell | `` ` \n `` | Backtick for line continuation |
|
|
66
|
+
| CMD | ` ^\n` | Caret for line continuation |
|
|
67
|
+
| WSL / Git Bash on Windows | ` \\\n` | Same as bash/zsh |
|
|
68
|
+
|
|
69
|
+
## Requirements
|
|
70
|
+
|
|
71
|
+
- Tabby v1.0.197-nightly.1 or later
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
ISC
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HotkeyDescription, HotkeyProvider, HotkeysService, AppService, ConfigProvider, ConfigService } from 'tabby-core';
|
|
2
|
+
export declare class BackslashNewlineConfigProvider extends ConfigProvider {
|
|
3
|
+
defaults: {
|
|
4
|
+
hotkeys: {
|
|
5
|
+
'shift-enter-newline': string[];
|
|
6
|
+
};
|
|
7
|
+
backslashNewline: {
|
|
8
|
+
customText: string;
|
|
9
|
+
includeBackslash: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare class BackslashNewlineHotkeyProvider extends HotkeyProvider {
|
|
14
|
+
provide(): Promise<HotkeyDescription[]>;
|
|
15
|
+
}
|
|
16
|
+
export declare class BackslashNewlineHandler {
|
|
17
|
+
private hotkeys;
|
|
18
|
+
private app;
|
|
19
|
+
private config;
|
|
20
|
+
constructor(hotkeys: HotkeysService, app: AppService, config: ConfigService);
|
|
21
|
+
private init;
|
|
22
|
+
private handleBackslashNewline;
|
|
23
|
+
private getActiveTerminal;
|
|
24
|
+
private isTerminalTab;
|
|
25
|
+
private sendBackslashNewline;
|
|
26
|
+
private processEscapeSequences;
|
|
27
|
+
}
|
|
28
|
+
export default class BackslashNewlineModule {
|
|
29
|
+
private handler;
|
|
30
|
+
constructor(handler: BackslashNewlineHandler);
|
|
31
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BackslashNewlineHandler = exports.BackslashNewlineHotkeyProvider = exports.BackslashNewlineConfigProvider = void 0;
|
|
13
|
+
// src/index.ts - Tabby Shift+Enter plugin
|
|
14
|
+
const core_1 = require("@angular/core");
|
|
15
|
+
const common_1 = require("@angular/common");
|
|
16
|
+
const forms_1 = require("@angular/forms");
|
|
17
|
+
const tabby_core_1 = require("tabby-core");
|
|
18
|
+
const tabby_settings_1 = require("tabby-settings");
|
|
19
|
+
const settings_tab_component_1 = require("./settings-tab.component");
|
|
20
|
+
const settings_tab_provider_1 = require("./settings-tab-provider");
|
|
21
|
+
let BackslashNewlineConfigProvider = class BackslashNewlineConfigProvider extends tabby_core_1.ConfigProvider {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.defaults = {
|
|
25
|
+
hotkeys: {
|
|
26
|
+
'shift-enter-newline': ['Shift-Enter'],
|
|
27
|
+
},
|
|
28
|
+
backslashNewline: {
|
|
29
|
+
customText: ' \\\n',
|
|
30
|
+
includeBackslash: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
BackslashNewlineConfigProvider = __decorate([
|
|
36
|
+
(0, core_1.Injectable)()
|
|
37
|
+
], BackslashNewlineConfigProvider);
|
|
38
|
+
exports.BackslashNewlineConfigProvider = BackslashNewlineConfigProvider;
|
|
39
|
+
let BackslashNewlineHotkeyProvider = class BackslashNewlineHotkeyProvider extends tabby_core_1.HotkeyProvider {
|
|
40
|
+
async provide() {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
id: 'shift-enter-newline',
|
|
44
|
+
name: 'Send configured custom text',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
BackslashNewlineHotkeyProvider = __decorate([
|
|
50
|
+
(0, core_1.Injectable)()
|
|
51
|
+
], BackslashNewlineHotkeyProvider);
|
|
52
|
+
exports.BackslashNewlineHotkeyProvider = BackslashNewlineHotkeyProvider;
|
|
53
|
+
let BackslashNewlineHandler = class BackslashNewlineHandler {
|
|
54
|
+
constructor(hotkeys, app, config) {
|
|
55
|
+
this.hotkeys = hotkeys;
|
|
56
|
+
this.app = app;
|
|
57
|
+
this.config = config;
|
|
58
|
+
setTimeout(() => this.init(), 100);
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
61
|
+
this.hotkeys.matchedHotkey.subscribe(hotkey => {
|
|
62
|
+
if (hotkey === 'shift-enter-newline') {
|
|
63
|
+
this.handleBackslashNewline();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
handleBackslashNewline() {
|
|
68
|
+
const activeTab = this.app.activeTab;
|
|
69
|
+
const terminal = this.getActiveTerminal(activeTab);
|
|
70
|
+
if (terminal) {
|
|
71
|
+
this.sendBackslashNewline(terminal);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
getActiveTerminal(tab) {
|
|
75
|
+
if (!tab) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const container = tab;
|
|
79
|
+
if (typeof container.getFocusedTab === 'function') {
|
|
80
|
+
try {
|
|
81
|
+
const focusedTab = container.getFocusedTab();
|
|
82
|
+
if (focusedTab && this.isTerminalTab(focusedTab)) {
|
|
83
|
+
return focusedTab;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('getFocusedTab() failed:', error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (this.isTerminalTab(tab)) {
|
|
91
|
+
return tab;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
isTerminalTab(tab) {
|
|
96
|
+
if (!tab)
|
|
97
|
+
return false;
|
|
98
|
+
const terminalTab = tab;
|
|
99
|
+
return !!(terminalTab.session || terminalTab.frontend || terminalTab.sendInput);
|
|
100
|
+
}
|
|
101
|
+
sendBackslashNewline(tab) {
|
|
102
|
+
if (!tab) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const terminalTab = tab;
|
|
106
|
+
const includeBackslash = this.config.store?.backslashNewline?.includeBackslash ?? true;
|
|
107
|
+
let textToSend;
|
|
108
|
+
if (includeBackslash) {
|
|
109
|
+
const customText = this.config.store?.backslashNewline?.customText || ' \\\n';
|
|
110
|
+
textToSend = this.processEscapeSequences(customText);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
textToSend = '\n';
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
if (terminalTab.session) {
|
|
117
|
+
terminalTab.session.write(Buffer.from(textToSend, 'utf8'));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (terminalTab.frontend && terminalTab.frontend.write) {
|
|
121
|
+
terminalTab.frontend.write(textToSend);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (typeof terminalTab.sendInput === 'function') {
|
|
125
|
+
terminalTab.sendInput(textToSend);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
console.error('No available send method found');
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
console.error('Error sending backslash newline:', error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
processEscapeSequences(text) {
|
|
135
|
+
return text
|
|
136
|
+
.replace(/\\n/g, '\n')
|
|
137
|
+
.replace(/\\t/g, '\t')
|
|
138
|
+
.replace(/\\r/g, '\r')
|
|
139
|
+
.replace(/\\\\/g, '\\');
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
BackslashNewlineHandler = __decorate([
|
|
143
|
+
(0, core_1.Injectable)(),
|
|
144
|
+
__metadata("design:paramtypes", [tabby_core_1.HotkeysService,
|
|
145
|
+
tabby_core_1.AppService,
|
|
146
|
+
tabby_core_1.ConfigService])
|
|
147
|
+
], BackslashNewlineHandler);
|
|
148
|
+
exports.BackslashNewlineHandler = BackslashNewlineHandler;
|
|
149
|
+
let BackslashNewlineModule = class BackslashNewlineModule {
|
|
150
|
+
constructor(handler) {
|
|
151
|
+
this.handler = handler;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
BackslashNewlineModule = __decorate([
|
|
155
|
+
(0, core_1.NgModule)({
|
|
156
|
+
imports: [common_1.CommonModule, forms_1.FormsModule],
|
|
157
|
+
declarations: [settings_tab_component_1.BackslashNewlineSettingsTabComponent],
|
|
158
|
+
providers: [
|
|
159
|
+
{
|
|
160
|
+
provide: tabby_core_1.ConfigProvider,
|
|
161
|
+
useClass: BackslashNewlineConfigProvider,
|
|
162
|
+
multi: true,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
provide: tabby_core_1.HotkeyProvider,
|
|
166
|
+
useClass: BackslashNewlineHotkeyProvider,
|
|
167
|
+
multi: true,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
provide: tabby_settings_1.SettingsTabProvider,
|
|
171
|
+
useClass: settings_tab_provider_1.BackslashNewlineSettingsTabProvider,
|
|
172
|
+
multi: true,
|
|
173
|
+
},
|
|
174
|
+
BackslashNewlineHandler,
|
|
175
|
+
],
|
|
176
|
+
}),
|
|
177
|
+
__metadata("design:paramtypes", [BackslashNewlineHandler])
|
|
178
|
+
], BackslashNewlineModule);
|
|
179
|
+
exports.default = BackslashNewlineModule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SettingsTabProvider } from 'tabby-settings';
|
|
2
|
+
import { BackslashNewlineSettingsTabComponent } from './settings-tab.component';
|
|
3
|
+
export declare class BackslashNewlineSettingsTabProvider extends SettingsTabProvider {
|
|
4
|
+
id: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
title: string;
|
|
7
|
+
weight: number;
|
|
8
|
+
getComponentType(): typeof BackslashNewlineSettingsTabComponent;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BackslashNewlineSettingsTabProvider = void 0;
|
|
10
|
+
const core_1 = require("@angular/core");
|
|
11
|
+
const tabby_settings_1 = require("tabby-settings");
|
|
12
|
+
const settings_tab_component_1 = require("./settings-tab.component");
|
|
13
|
+
let BackslashNewlineSettingsTabProvider = class BackslashNewlineSettingsTabProvider extends tabby_settings_1.SettingsTabProvider {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.id = 'nv-shift-enter';
|
|
17
|
+
this.icon = 'fas fa-keyboard';
|
|
18
|
+
this.title = 'NV Shift Enter';
|
|
19
|
+
this.weight = 10;
|
|
20
|
+
}
|
|
21
|
+
getComponentType() {
|
|
22
|
+
return settings_tab_component_1.BackslashNewlineSettingsTabComponent;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
BackslashNewlineSettingsTabProvider = __decorate([
|
|
26
|
+
(0, core_1.Injectable)()
|
|
27
|
+
], BackslashNewlineSettingsTabProvider);
|
|
28
|
+
exports.BackslashNewlineSettingsTabProvider = BackslashNewlineSettingsTabProvider;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConfigService, LocaleService } from 'tabby-core';
|
|
2
|
+
export declare class BackslashNewlineSettingsTabComponent {
|
|
3
|
+
private config;
|
|
4
|
+
private locale;
|
|
5
|
+
customText: string;
|
|
6
|
+
includeBackslash: boolean;
|
|
7
|
+
saveStatus: boolean;
|
|
8
|
+
t: {
|
|
9
|
+
title: string;
|
|
10
|
+
toggleLabel: string;
|
|
11
|
+
toggleHint: string;
|
|
12
|
+
customTextLabel: string;
|
|
13
|
+
customTextPlaceholder: string;
|
|
14
|
+
customTextHint: string;
|
|
15
|
+
savedMessage: string;
|
|
16
|
+
resetButton: string;
|
|
17
|
+
previewLabel: string;
|
|
18
|
+
howToTitle: string;
|
|
19
|
+
howToSteps: string[];
|
|
20
|
+
};
|
|
21
|
+
private readonly defaultText;
|
|
22
|
+
constructor(config: ConfigService, locale: LocaleService);
|
|
23
|
+
onTextChange(): void;
|
|
24
|
+
onToggleChange(): void;
|
|
25
|
+
resetToDefault(): void;
|
|
26
|
+
getPreviewText(): string;
|
|
27
|
+
private showSaveStatus;
|
|
28
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BackslashNewlineSettingsTabComponent = void 0;
|
|
13
|
+
const core_1 = require("@angular/core");
|
|
14
|
+
const tabby_core_1 = require("tabby-core");
|
|
15
|
+
const TRANSLATIONS = {
|
|
16
|
+
en: {
|
|
17
|
+
title: 'NV Shift Enter Settings',
|
|
18
|
+
toggleLabel: 'Include backslash before newline',
|
|
19
|
+
toggleHint: 'When enabled, sends the custom text below. When disabled, sends only a newline character.',
|
|
20
|
+
customTextLabel: 'Custom Text to Send:',
|
|
21
|
+
customTextPlaceholder: 'Enter custom text (e.g., \\\\\\n)',
|
|
22
|
+
customTextHint: 'Enter the text to send when hotkey is pressed. Use \\\\n for newline, \\\\t for tab, \\\\\\\\ for backslash.',
|
|
23
|
+
savedMessage: '✓ Settings saved automatically',
|
|
24
|
+
resetButton: 'Reset',
|
|
25
|
+
previewLabel: 'Preview:',
|
|
26
|
+
howToTitle: 'How to use:',
|
|
27
|
+
howToSteps: [
|
|
28
|
+
'Toggle backslash inclusion above',
|
|
29
|
+
'Configure your custom text if backslash is enabled',
|
|
30
|
+
'Go to Settings → Hotkeys',
|
|
31
|
+
'Find "Send configured custom text"',
|
|
32
|
+
'Set your preferred hotkey (default: Shift+Enter)',
|
|
33
|
+
'Press the hotkey in any terminal to send the configured text',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
ja: {
|
|
37
|
+
title: 'NV Shift Enter 設定',
|
|
38
|
+
toggleLabel: '改行前にバックスラッシュを含める',
|
|
39
|
+
toggleHint: '有効時は下のカスタムテキストを送信します。無効時は改行文字のみを送信します。',
|
|
40
|
+
customTextLabel: '送信するカスタムテキスト:',
|
|
41
|
+
customTextPlaceholder: 'カスタムテキストを入力 (例: \\\\\\n)',
|
|
42
|
+
customTextHint: 'ホットキー押下時に送信するテキストを入力してください。\\\\n で改行、\\\\t でタブ、\\\\\\\\ でバックスラッシュを表します。',
|
|
43
|
+
savedMessage: '✓ 設定を自動保存しました',
|
|
44
|
+
resetButton: 'リセット',
|
|
45
|
+
previewLabel: 'プレビュー:',
|
|
46
|
+
howToTitle: '使い方:',
|
|
47
|
+
howToSteps: [
|
|
48
|
+
'上のトグルでバックスラッシュの有無を切り替える',
|
|
49
|
+
'バックスラッシュが有効な場合はカスタムテキストを設定する',
|
|
50
|
+
'設定 → ホットキー に移動する',
|
|
51
|
+
'「Send configured custom text」を探す',
|
|
52
|
+
'任意のホットキーを設定する(デフォルト: Shift+Enter)',
|
|
53
|
+
'ターミナルでホットキーを押して設定に応じたテキストを送信する',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
let BackslashNewlineSettingsTabComponent = class BackslashNewlineSettingsTabComponent {
|
|
58
|
+
constructor(config, locale) {
|
|
59
|
+
this.config = config;
|
|
60
|
+
this.locale = locale;
|
|
61
|
+
this.customText = ' \\\n';
|
|
62
|
+
this.includeBackslash = true;
|
|
63
|
+
this.saveStatus = false;
|
|
64
|
+
this.t = TRANSLATIONS['en'];
|
|
65
|
+
this.defaultText = ' \\\n';
|
|
66
|
+
const lang = this.locale.getLocale().startsWith('ja') ? 'ja' : 'en';
|
|
67
|
+
this.t = TRANSLATIONS[lang];
|
|
68
|
+
this.customText = this.config.store?.backslashNewline?.customText || this.defaultText;
|
|
69
|
+
this.includeBackslash = this.config.store?.backslashNewline?.includeBackslash ?? true;
|
|
70
|
+
}
|
|
71
|
+
onTextChange() {
|
|
72
|
+
if (!this.config.store.backslashNewline) {
|
|
73
|
+
this.config.store.backslashNewline = {};
|
|
74
|
+
}
|
|
75
|
+
this.config.store.backslashNewline.customText = this.customText;
|
|
76
|
+
this.config.save();
|
|
77
|
+
this.showSaveStatus();
|
|
78
|
+
}
|
|
79
|
+
onToggleChange() {
|
|
80
|
+
if (!this.config.store.backslashNewline) {
|
|
81
|
+
this.config.store.backslashNewline = {};
|
|
82
|
+
}
|
|
83
|
+
this.config.store.backslashNewline.includeBackslash = this.includeBackslash;
|
|
84
|
+
this.config.save();
|
|
85
|
+
this.showSaveStatus();
|
|
86
|
+
}
|
|
87
|
+
resetToDefault() {
|
|
88
|
+
this.customText = this.defaultText;
|
|
89
|
+
this.onTextChange();
|
|
90
|
+
}
|
|
91
|
+
getPreviewText() {
|
|
92
|
+
if (!this.includeBackslash) {
|
|
93
|
+
return '⏎';
|
|
94
|
+
}
|
|
95
|
+
return this.customText
|
|
96
|
+
.replace(/\\\\/g, '\\')
|
|
97
|
+
.replace(/\\n/g, '⏎')
|
|
98
|
+
.replace(/\\t/g, '→')
|
|
99
|
+
.replace(/ /g, '·');
|
|
100
|
+
}
|
|
101
|
+
showSaveStatus() {
|
|
102
|
+
this.saveStatus = true;
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
this.saveStatus = false;
|
|
105
|
+
}, 2000);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
BackslashNewlineSettingsTabComponent = __decorate([
|
|
109
|
+
(0, core_1.Component)({
|
|
110
|
+
template: `
|
|
111
|
+
<h3>{{t.title}}</h3>
|
|
112
|
+
<div class="form-group">
|
|
113
|
+
<div class="form-check">
|
|
114
|
+
<input
|
|
115
|
+
type="checkbox"
|
|
116
|
+
class="form-check-input"
|
|
117
|
+
id="includeBackslash"
|
|
118
|
+
[(ngModel)]="includeBackslash"
|
|
119
|
+
(change)="onToggleChange()"
|
|
120
|
+
/>
|
|
121
|
+
<label class="form-check-label" for="includeBackslash">
|
|
122
|
+
{{t.toggleLabel}}
|
|
123
|
+
</label>
|
|
124
|
+
</div>
|
|
125
|
+
<small class="form-text text-muted">{{t.toggleHint}}</small>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="form-group">
|
|
128
|
+
<label>{{t.customTextLabel}}</label>
|
|
129
|
+
<div class="input-group">
|
|
130
|
+
<input
|
|
131
|
+
type="text"
|
|
132
|
+
class="form-control"
|
|
133
|
+
[(ngModel)]="customText"
|
|
134
|
+
(input)="onTextChange()"
|
|
135
|
+
[disabled]="!includeBackslash"
|
|
136
|
+
[placeholder]="t.customTextPlaceholder"
|
|
137
|
+
/>
|
|
138
|
+
<div class="input-group-append">
|
|
139
|
+
<button class="btn btn-outline-secondary" type="button" (click)="resetToDefault()" [disabled]="!includeBackslash">
|
|
140
|
+
{{t.resetButton}}
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
<small class="form-text text-muted">
|
|
145
|
+
{{t.customTextHint}}
|
|
146
|
+
<span class="text-success" *ngIf="saveStatus">{{t.savedMessage}}</span>
|
|
147
|
+
</small>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="form-group">
|
|
150
|
+
<label>{{t.previewLabel}}</label>
|
|
151
|
+
<code class="form-control-plaintext bg-light p-2 rounded">{{getPreviewText()}}</code>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="form-group">
|
|
154
|
+
<div class="alert alert-info">
|
|
155
|
+
<strong><i class="fas fa-info-circle"></i> {{t.howToTitle}}</strong>
|
|
156
|
+
<ol class="mb-0 mt-2">
|
|
157
|
+
<li *ngFor="let step of t.howToSteps">{{step}}</li>
|
|
158
|
+
</ol>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
`,
|
|
162
|
+
}),
|
|
163
|
+
__metadata("design:paramtypes", [tabby_core_1.ConfigService, tabby_core_1.LocaleService])
|
|
164
|
+
], BackslashNewlineSettingsTabComponent);
|
|
165
|
+
exports.BackslashNewlineSettingsTabComponent = BackslashNewlineSettingsTabComponent;
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tabby-nv-shift-enter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Tabby plugin that customizes Shift+Enter behavior with optional backslash newline",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"watch": "tsc --watch",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"files": ["dist", "README.md", "README.ja.md"],
|
|
12
|
+
"keywords": ["tabby", "tabby-plugin", "terminal", "hotkey"],
|
|
13
|
+
"author": "nv-leo",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@angular/core": "^15.0.0",
|
|
18
|
+
"@angular/common": "^15.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^24.3.1",
|
|
22
|
+
"typescript": "^4.9.5"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tabby-core": "^1.0.197-nightly.1",
|
|
26
|
+
"tabby-terminal": "^1.0.197-nightly.1",
|
|
27
|
+
"tabby-settings": "^1.0.197-nightly.1"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/nv-leo/tabby-nv-shift-enter.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/nv-leo/tabby-nv-shift-enter/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/nv-leo/tabby-nv-shift-enter#readme",
|
|
37
|
+
"tabbyPlugin": {
|
|
38
|
+
"name": "tabby-nv-shift-enter",
|
|
39
|
+
"displayName": "NV Shift Enter",
|
|
40
|
+
"description": "Customizes Shift+Enter behavior: sends newline only, or backslash newline for line continuation"
|
|
41
|
+
}
|
|
42
|
+
}
|