mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 06:11:55 +08:00
Use system dependent key bindings (#2849)
This commit is contained in:
parent
9cb2cbe88c
commit
dbc878f6e8
@ -13,11 +13,11 @@ Here is an example:
|
|||||||
|
|
||||||
## Available modifiers
|
## Available modifiers
|
||||||
|
|
||||||
- `CmdOrCtrl`
|
|
||||||
- `Cmd` on macOS
|
- `Cmd` on macOS
|
||||||
|
- `Option` on macOS
|
||||||
- `Ctrl`
|
- `Ctrl`
|
||||||
- `Alt`/`AltGr` or `Option` on macOS
|
|
||||||
- `Shift`
|
- `Shift`
|
||||||
|
- `Alt` and `AltGr` on Linux and Windows
|
||||||
- `Super` on Linux and Windows
|
- `Super` on Linux and Windows
|
||||||
|
|
||||||
## Available keys
|
## Available keys
|
||||||
@ -28,133 +28,8 @@ Here is an example:
|
|||||||
- `PageUp` and `PageDown`
|
- `PageUp` and `PageDown`
|
||||||
- Empty string `""` to unset a accelerator
|
- Empty string `""` to unset a accelerator
|
||||||
|
|
||||||
## Available id's
|
## Available key bindings
|
||||||
|
|
||||||
**MarkText menu (macOS only):**
|
- [Key bindings for macOS](KEYBINDINGS_OSX.md)
|
||||||
|
- [Key bindings for Linux](KEYBINDINGS_LINUX.md)
|
||||||
| Id | Default | Description |
|
- [Key bindings for Windows](KEYBINDINGS_WINDOWS.md)
|
||||||
| ------------------ | ---------------------------------------------- | --------------------------------------- |
|
|
||||||
| `mt.hide` | <kbd>Command</kbd>+<kbd>H</kbd> | Hide MarkText |
|
|
||||||
| `mt.hide-others` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>H</kbd> | Hide all other windows except MarkText |
|
|
||||||
| `file.preferences` | <kbd>Command</kbd>+<kbd>,</kbd> | Open settings window |
|
|
||||||
| `file.quit` | <kbd>Command</kbd>+<kbd>Q</kbd> | Quit MarkText |
|
|
||||||
|
|
||||||
**File menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
|:------------------- | -------------------------------------------------- | ----------------------------------------- |
|
|
||||||
| `file.new-file` | <kbd>CmdOrCtrl</kbd>+<kbd>N</kbd> | New file |
|
|
||||||
| `file.new-tab` | <kbd>CmdOrCtrl</kbd>+<kbd>T</kbd> | New tab |
|
|
||||||
| `file.open-file` | <kbd>CmdOrCtrl</kbd>+<kbd>O</kbd> | Open markdown file |
|
|
||||||
| `file.open-folder` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
|
|
||||||
| `file.save` | <kbd>CmdOrCtrl</kbd>+<kbd>S</kbd> | Save |
|
|
||||||
| `file.save-as` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
|
|
||||||
| `file.print` | - | Print current tab |
|
|
||||||
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window (Linux/Windows only) |
|
|
||||||
| `file.close-tab` | <kbd>CmdOrCtrl</kbd>+<kbd>W</kbd> | Close tab |
|
|
||||||
| `file.close-window` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
|
|
||||||
| `file.quit` | <kbd>CmdOrCtrl</kbd>+<kbd>Q</kbd> | Quit MarkText (Linux/Windows only) |
|
|
||||||
|
|
||||||
**Edit menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
|:------------------------ | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
||||||
| `edit.undo` | <kbd>CmdOrCtrl</kbd>+<kbd>Z</kbd> | Undo last operation |
|
|
||||||
| `edit.redo` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | Redo last operation |
|
|
||||||
| `edit.cut` | <kbd>CmdOrCtrl</kbd>+<kbd>X</kbd> | Cut selected text |
|
|
||||||
| `edit.copy` | <kbd>CmdOrCtrl</kbd>+<kbd>C</kbd> | Copy selected text |
|
|
||||||
| `edit.paste` | <kbd>CmdOrCtrl</kbd>+<kbd>V</kbd> | Paste text |
|
|
||||||
| `edit.copy-as-markdown` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd> | Copy selected text as markdown |
|
|
||||||
| `edit.copy-as-plaintext` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> | Copy selected text as plaintext |
|
|
||||||
| `edit.select-all` | <kbd>CmdOrCtrl</kbd>+<kbd>A</kbd> | Select all text of the document |
|
|
||||||
| `edit.duplicate` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd> | Duplicate the current paragraph |
|
|
||||||
| `edit.create-paragraph` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd> | Create a new paragraph after the current one |
|
|
||||||
| `edit.delete-paragraph` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> | Delete current paragraph |
|
|
||||||
| `edit.find` | <kbd>CmdOrCtrl</kbd>+<kbd>F</kbd> | Find information in the document |
|
|
||||||
| `edit.find-next` | <kbd>F3</kbd> | Continue the search and find the next match (or <kbd>Cmd</kbd>+<kbd>G</kbd> on macOS) |
|
|
||||||
| `edit.find-previous` | <kbd>Shift</kbd>+<kbd>F3</kbd> | Continue the search and find the previous match (or <kbd>Shift</kbd>+<kbd>Cmd</kbd>+<kbd>G</kbd> on macOS) |
|
|
||||||
| `edit.replace` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>F</kbd> | Replace the information with a replacement |
|
|
||||||
| `edit.find-in-folder` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> | Find files contain the keyword in opend folder |
|
|
||||||
| `edit.aidou` | <kbd>CmdOrCtrl</kbd>+<kbd>/</kbd> | Show Aidou dialog |
|
|
||||||
| `edit.screenshot` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>A</kbd> | Get the screenshot (macOS only) |
|
|
||||||
|
|
||||||
**Paragraph menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
| --------------------------- | -------------------------------------------------- | ------------------------------------------------- |
|
|
||||||
| `paragraph.heading-1` | <kbd>CmdOrCtrl</kbd>+<kbd>1</kbd> | Set line as heading 1 |
|
|
||||||
| `paragraph.heading-2` | <kbd>CmdOrCtrl</kbd>+<kbd>2</kbd> | Set line as heading 2 |
|
|
||||||
| `paragraph.heading-3` | <kbd>CmdOrCtrl</kbd>+<kbd>3</kbd> | Set line as heading 3 |
|
|
||||||
| `paragraph.heading-4` | <kbd>CmdOrCtrl</kbd>+<kbd>4</kbd> | Set line as heading 4 |
|
|
||||||
| `paragraph.heading-5` | <kbd>CmdOrCtrl</kbd>+<kbd>5</kbd> | Set line as heading 5 |
|
|
||||||
| `paragraph.heading-6` | <kbd>CmdOrCtrl</kbd>+<kbd>6</kbd> | Set line as heading 6 |
|
|
||||||
| `paragraph.upgrade-heading` | <kbd>CmdOrCtrl</kbd>+<kbd>=</kbd> | Upgrade a heading |
|
|
||||||
| `paragraph.degrade-heading` | <kbd>CmdOrCtrl</kbd>+<kbd>-</kbd> | Degrade a heading |
|
|
||||||
| `paragraph.table` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> | Insert a table |
|
|
||||||
| `paragraph.code-fence` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd> | Insert a code block |
|
|
||||||
| `paragraph.quote-block` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>Q</kbd> | Insert a quote block |
|
|
||||||
| `paragraph.math-formula` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd> | Insert a math block |
|
|
||||||
| `paragraph.html-block` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>J/H</kbd> | Insert a HTML block (`J` on macOS, `H` otherwise) |
|
|
||||||
| `paragraph.order-list` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>O</kbd> | Insert a ordered list |
|
|
||||||
| `paragraph.bullet-list` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>U</kbd> | Insert a unordered list |
|
|
||||||
| `paragraph.task-list` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>X</kbd> | Insert a task list |
|
|
||||||
| `paragraph.loose-list-item` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd> | Convert a list item to a loose list item |
|
|
||||||
| `paragraph.paragraph` | <kbd>CmdOrCtrl</kbd>+<kbd>0</kbd> | Convert a heading to a paragraph |
|
|
||||||
| `paragraph.horizontal-line` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>-</kbd> | Add a horizontal line |
|
|
||||||
| `paragraph.front-matter` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>Y</kbd> | Insert a YAML frontmatter block |
|
|
||||||
|
|
||||||
**Format menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
| --------------------- | -------------------------------------------------- | ------------------------------------------- |
|
|
||||||
| `format.strong` | <kbd>CmdOrCtrl</kbd>+<kbd>B</kbd> | Set the font of the selected text to bold |
|
|
||||||
| `format.emphasis` | <kbd>CmdOrCtrl</kbd>+<kbd>I</kbd> | Set the font of the selected text to italic |
|
|
||||||
| `format.underline` | <kbd>CmdOrCtrl</kbd>+<kbd>U</kbd> | Change the selected text to underline |
|
|
||||||
| `format.highlight` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> | Highlight the selected text by <mark> tag |
|
|
||||||
| `format.inline-code` | <kbd>CmdOrCtrl</kbd>+<kbd>`</kbd> | Change the selected text to inline code |
|
|
||||||
| `format.inline-math` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd> | Change the selected text to inline math |
|
|
||||||
| `format.strike` | <kbd>CmdOrCtrl</kbd>+<kbd>D</kbd> | Strike through the selected text |
|
|
||||||
| `format.hyperlink` | <kbd>CmdOrCtrl</kbd>+<kbd>L</kbd> | Insert a hyperlink |
|
|
||||||
| `format.image` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Insert a image |
|
|
||||||
| `format.clear-format` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> | Clear the formatting of the selected text |
|
|
||||||
|
|
||||||
**Window menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
| --------------------------- | --------------------------------- | ------------------------------------------------------------------------------------ |
|
|
||||||
| `window.minimize` | <kbd>CmdOrCtrl</kbd>+<kbd>M</kbd> | Minimize the window |
|
|
||||||
| `window.toggle-full-screen` | <kbd>F11</kbd> | Toggle fullscreen mode (or <kbd>Ctrl</kbd>+<kbd>Command</kbd>+<kbd>F</kbd> on macOS) |
|
|
||||||
|
|
||||||
**View menu:**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
| ----------------------- | -------------------------------------------------- | ---------------------------------------- |
|
|
||||||
| `view.command-palette` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Toggle command palette |
|
|
||||||
| `view.source-code-mode` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd> | Switch to source code mode |
|
|
||||||
| `view.typewriter-mode` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> | Enable typewriter mode |
|
|
||||||
| `view.focus-mode` | <kbd>CmdOrCtrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> | Enable focus mode |
|
|
||||||
| `view.toggle-sidebar` | <kbd>CmdOrCtrl</kbd>+<kbd>J</kbd> | Toggle sidebar |
|
|
||||||
| `view.toggle-tabbar` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>B</kbd> | Toggle tabbar |
|
|
||||||
| `view.toggle-toc` . | <kbd>CmdOrCtrl</kbd>+<kbd>K</kbd> | Toggle table of contents |
|
|
||||||
| `view.toggle-dev-tools` | <kbd>CmdOrCtrl</kbd>+<kbd>Alt</kbd>+<kbd>I</kbd> | Toggle developer tools (debug mode only) |
|
|
||||||
| `view.dev-reload` | <kbd>CmdOrCtrl</kbd>+<kbd>R</kbd> | Reload window (debug mode only) |
|
|
||||||
|
|
||||||
**Misc**
|
|
||||||
|
|
||||||
| Id | Default | Description |
|
|
||||||
| ------------------------ | ---------------------------------------------------- | ---------------------------- |
|
|
||||||
| `tabs.cycle-forward` | <kbd>Ctrl</kbd>+<kbd>Tab</kbd> | Cycle through tabs |
|
|
||||||
| `tabs.cycle-backward` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> | Cycle backwards through tabs |
|
|
||||||
| `tabs.switch-to-left` | <kbd>CmdOrCtrl</kbd>+<kbd>PageUp</kbd> | Switch tab to the left |
|
|
||||||
| `tabs.switch-to-right` | <kbd>CmdOrCtrl</kbd>+<kbd>PageDown</kbd> | Switch tab to the right |
|
|
||||||
| `tabs.switch-to-first` | <kbd>Alt</kbd>+<kbd>1</kbd> | Switch tab to the 1st |
|
|
||||||
| `tabs.switch-to-second` | <kbd>Alt</kbd>+<kbd>2</kbd> | Switch tab to the 2nd |
|
|
||||||
| `tabs.switch-to-third` | <kbd>Alt</kbd>+<kbd>3</kbd> | Switch tab to the 3rd |
|
|
||||||
| `tabs.switch-to-fourth` | <kbd>Alt</kbd>+<kbd>4</kbd> | Switch tab to the 4th |
|
|
||||||
| `tabs.switch-to-fifth` | <kbd>Alt</kbd>+<kbd>5</kbd> | Switch tab to the 5th |
|
|
||||||
| `tabs.switch-to-sixth` | <kbd>Alt</kbd>+<kbd>6</kbd> | Switch tab to the 6th |
|
|
||||||
| `tabs.switch-to-seventh` | <kbd>Alt</kbd>+<kbd>7</kbd> | Switch tab to the 7th |
|
|
||||||
| `tabs.switch-to-eighth` | <kbd>Alt</kbd>+<kbd>8</kbd> | Switch tab to the 8th |
|
|
||||||
| `tabs.switch-to-ninth` | <kbd>Alt</kbd>+<kbd>9</kbd> | Switch tab to the 9th |
|
|
||||||
| `tabs.switch-to-tenth` | <kbd>Alt</kbd>+<kbd>0</kbd> | Switch tab to the 10th |
|
|
||||||
| `file.quick-open` | <kbd>CmdOrCtrl</kbd>+<kbd>P</kbd> | Open quick open dialog |
|
|
||||||
|
139
docs/KEYBINDINGS_LINUX.md
Normal file
139
docs/KEYBINDINGS_LINUX.md
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
# Key Bindings for Linux
|
||||||
|
|
||||||
|
MarkText key bindings for Linux. Please see [general key bindings](KEYBINDINGS.md) for information how to use custom key bindings.
|
||||||
|
|
||||||
|
## Available menu key bindings
|
||||||
|
|
||||||
|
#### File menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------- | --------------------------------------------- | ------------------------------------- |
|
||||||
|
| `file.new-file` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New file |
|
||||||
|
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
|
||||||
|
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
|
||||||
|
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
|
||||||
|
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
|
||||||
|
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
|
||||||
|
| `file.move-file` | - | Move current file to another location |
|
||||||
|
| `file.rename-file` | - | Rename current file |
|
||||||
|
| `file.print` | - | Print current tab |
|
||||||
|
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
|
||||||
|
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
|
||||||
|
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
|
||||||
|
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |
|
||||||
|
|
||||||
|
#### Edit menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------------- | --------------------------------------------- | ----------------------------------------------- |
|
||||||
|
| `edit.undo` | <kbd>Ctrl</kbd>+<kbd>Z</kbd> | Undo last operation |
|
||||||
|
| `edit.redo` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | Redo last operation |
|
||||||
|
| `edit.cut` | <kbd>Ctrl</kbd>+<kbd>X</kbd> | Cut selected text |
|
||||||
|
| `edit.copy` | <kbd>Ctrl</kbd>+<kbd>C</kbd> | Copy selected text |
|
||||||
|
| `edit.paste` | <kbd>Ctrl</kbd>+<kbd>V</kbd> | Paste text |
|
||||||
|
| `edit.copy-as-markdown` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd> | Copy selected text as markdown |
|
||||||
|
| `edit.copy-as-html` | - | Copy selected text as html |
|
||||||
|
| `edit.paste-as-plaintext` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> | Copy selected text as plaintext |
|
||||||
|
| `edit.select-all` | <kbd>Ctrl</kbd>+<kbd>A</kbd> | Select all text of the document |
|
||||||
|
| `edit.duplicate` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd> | Duplicate the current paragraph |
|
||||||
|
| `edit.create-paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd> | Create a new paragraph after the current one |
|
||||||
|
| `edit.delete-paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> | Delete current paragraph |
|
||||||
|
| `edit.find` | <kbd>Ctrl</kbd>+<kbd>F</kbd> | Find information in the document |
|
||||||
|
| `edit.find-next` | <kbd>F3</kbd> | Continue the search and find the next match |
|
||||||
|
| `edit.find-previous` | <kbd>Shift</kbd>+<kbd>F3</kbd> | Continue the search and find the previous match |
|
||||||
|
| `edit.replace` | <kbd>Ctrl</kbd>+<kbd>R</kbd> | Replace the information with a replacement |
|
||||||
|
| `edit.find-in-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> | Find files contain the keyword in opend folder |
|
||||||
|
| `edit.aidou` | <kbd>Ctrl</kbd>+<kbd>/</kbd> | Show Aidou dialog |
|
||||||
|
|
||||||
|
#### Paragraph menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------------- | --------------------------------------------- | ---------------------------------------- |
|
||||||
|
| `paragraph.heading-1` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>1</kbd> | Set line as heading 1 |
|
||||||
|
| `paragraph.heading-2` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>2</kbd> | Set line as heading 2 |
|
||||||
|
| `paragraph.heading-3` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>3</kbd> | Set line as heading 3 |
|
||||||
|
| `paragraph.heading-4` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>4</kbd> | Set line as heading 4 |
|
||||||
|
| `paragraph.heading-5` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>5</kbd> | Set line as heading 5 |
|
||||||
|
| `paragraph.heading-6` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>6</kbd> | Set line as heading 6 |
|
||||||
|
| `paragraph.upgrade-heading` | <kbd>Ctrl</kbd>+<kbd>=</kbd> | Upgrade a heading |
|
||||||
|
| `paragraph.degrade-heading` | <kbd>Ctrl</kbd>+<kbd>-</kbd> | Degrade a heading |
|
||||||
|
| `paragraph.table` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> | Insert a table |
|
||||||
|
| `paragraph.code-fence` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>K</kbd> | Insert a code block |
|
||||||
|
| `paragraph.quote-block` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Q</kbd> | Insert a quote block |
|
||||||
|
| `paragraph.math-formula` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd> | Insert a math block |
|
||||||
|
| `paragraph.html-block` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>H</kbd> | Insert a HTML block |
|
||||||
|
| `paragraph.order-list` | <kbd>Ctrl</kbd>+<kbd>G</kbd> | Insert a ordered list |
|
||||||
|
| `paragraph.bullet-list` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> | Insert a unordered list |
|
||||||
|
| `paragraph.task-list` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | Insert a task list |
|
||||||
|
| `paragraph.loose-list-item` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>L</kbd> | Convert a list item to a loose list item |
|
||||||
|
| `paragraph.paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>0</kbd> | Convert a heading to a paragraph |
|
||||||
|
| `paragraph.horizontal-line` | <kbd>Ctrl</kbd>+<kbd>H</kbd> | Add a horizontal line |
|
||||||
|
| `paragraph.front-matter` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Y</kbd> | Insert a YAML frontmatter block |
|
||||||
|
|
||||||
|
#### Format menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------- | --------------------------------------------- | ----------------------------------------------- |
|
||||||
|
| `format.strong` | <kbd>Ctrl</kbd>+<kbd>B</kbd> | Set the font of the selected text to bold |
|
||||||
|
| `format.emphasis` | <kbd>Ctrl</kbd>+<kbd>I</kbd> | Set the font of the selected text to italic |
|
||||||
|
| `format.underline` | <kbd>Ctrl</kbd>+<kbd>U</kbd> | Change the selected text to underline |
|
||||||
|
| `format.superscript` | - | Change the selected text to underline |
|
||||||
|
| `format.subscript` | - | Change the selected text to underline |
|
||||||
|
| `format.highlight` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> | Highlight the selected text by <mark>tag</mark> |
|
||||||
|
| `format.inline-code` | <kbd>Ctrl</kbd>+<kbd>`</kbd> | Change the selected text to inline code |
|
||||||
|
| `format.inline-math` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd> | Change the selected text to inline math |
|
||||||
|
| `format.strike` | <kbd>Ctrl</kbd>+<kbd>D</kbd> | Strike through the selected text |
|
||||||
|
| `format.hyperlink` | <kbd>Ctrl</kbd>+<kbd>L</kbd> | Insert a hyperlink |
|
||||||
|
| `format.image` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Insert a image |
|
||||||
|
| `format.clear-format` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> | Clear the formatting of the selected text |
|
||||||
|
|
||||||
|
#### Window menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------------- | ---------------------------- | ------------------------- |
|
||||||
|
| `window.minimize` | <kbd>Ctrl</kbd>+<kbd>M</kbd> | Minimize the window |
|
||||||
|
| `window.toggle-always-on-top` | - | Toogle always on top mode |
|
||||||
|
| `window.zoom-in` | - | Zoom in |
|
||||||
|
| `window.zoom-out` | - | Zoom out |
|
||||||
|
| `window.toggle-full-screen` | <kbd>F11</kbd> | Toggle fullscreen mode |
|
||||||
|
|
||||||
|
#### View menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------- | --------------------------------------------- | ---------------------------------------- |
|
||||||
|
| `view.command-palette` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Toggle command palette |
|
||||||
|
| `view.source-code-mode` | <kbd>Ctrl</kbd>+<kbd>E</kbd> | Switch to source code mode |
|
||||||
|
| `view.typewriter-mode` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd> | Enable typewriter mode |
|
||||||
|
| `view.focus-mode` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> | Enable focus mode |
|
||||||
|
| `view.toggle-sidebar` | <kbd>Ctrl</kbd>+<kbd>J</kbd> | Toggle sidebar |
|
||||||
|
| `view.toggle-tabbar` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd> | Toggle tabbar |
|
||||||
|
| `view.toggle-toc` . | <kbd>Ctrl</kbd>+<kbd>K</kbd> | Toggle table of contents |
|
||||||
|
| `view.toggle-dev-tools` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>I</kbd> | Toggle developer tools (debug mode only) |
|
||||||
|
| `view.dev-reload` | <kbd>Ctrl</kbd>+<kbd>F5</kbd> | Reload window (debug mode only) |
|
||||||
|
|
||||||
|
## Available key bindings
|
||||||
|
|
||||||
|
#### Tabs
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ------------------------ | ----------------------------------------------- | ---------------------------- |
|
||||||
|
| `tabs.cycle-forward` | <kbd>Ctrl</kbd>+<kbd>Tab</kbd> | Cycle through tabs |
|
||||||
|
| `tabs.cycle-backward` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> | Cycle backwards through tabs |
|
||||||
|
| `tabs.switch-to-left` | <kbd>Ctrl</kbd>+<kbd>PageUp</kbd> | Switch tab to the left |
|
||||||
|
| `tabs.switch-to-right` | <kbd>Ctrl</kbd>+<kbd>PageDown</kbd> | Switch tab to the right |
|
||||||
|
| `tabs.switch-to-first` | <kbd>Ctrl</kbd>+<kbd>1</kbd> | Switch tab to the 1st |
|
||||||
|
| `tabs.switch-to-second` | <kbd>Ctrl</kbd>+<kbd>2</kbd> | Switch tab to the 2nd |
|
||||||
|
| `tabs.switch-to-third` | <kbd>Ctrl</kbd>+<kbd>3</kbd> | Switch tab to the 3rd |
|
||||||
|
| `tabs.switch-to-fourth` | <kbd>Ctrl</kbd>+<kbd>4</kbd> | Switch tab to the 4th |
|
||||||
|
| `tabs.switch-to-fifth` | <kbd>Ctrl</kbd>+<kbd>5</kbd> | Switch tab to the 5th |
|
||||||
|
| `tabs.switch-to-sixth` | <kbd>Ctrl</kbd>+<kbd>6</kbd> | Switch tab to the 6th |
|
||||||
|
| `tabs.switch-to-seventh` | <kbd>Ctrl</kbd>+<kbd>7</kbd> | Switch tab to the 7th |
|
||||||
|
| `tabs.switch-to-eighth` | <kbd>Ctrl</kbd>+<kbd>8</kbd> | Switch tab to the 8th |
|
||||||
|
| `tabs.switch-to-ninth` | <kbd>Ctrl</kbd>+<kbd>9</kbd> | Switch tab to the 9th |
|
||||||
|
| `tabs.switch-to-tenth` | <kbd>Ctrl</kbd>+<kbd>0</kbd> | Switch tab to the 10th |
|
||||||
|
|
||||||
|
#### Misc
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------- | ---------------------------- | ---------------------- |
|
||||||
|
| `file.quick-open` | <kbd>Ctrl</kbd>+<kbd>P</kbd> | Open quick open dialog |
|
147
docs/KEYBINDINGS_OSX.md
Normal file
147
docs/KEYBINDINGS_OSX.md
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
# Key Bindings for macOS
|
||||||
|
|
||||||
|
MarkText key bindings for macOS. Please see [general key bindings](KEYBINDINGS.md) for information how to use custom key bindings.
|
||||||
|
|
||||||
|
## Available menu key bindings
|
||||||
|
|
||||||
|
#### MarkText menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ------------------ | ---------------------------------------------- | -------------------------------------- |
|
||||||
|
| `mt.hide` | <kbd>Command</kbd>+<kbd>H</kbd> | Hide MarkText |
|
||||||
|
| `mt.hide-others` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>H</kbd> | Hide all other windows except MarkText |
|
||||||
|
| `file.preferences` | <kbd>Command</kbd>+<kbd>,</kbd> | Open settings window |
|
||||||
|
| `file.quit` | <kbd>Command</kbd>+<kbd>Q</kbd> | Quit MarkText |
|
||||||
|
|
||||||
|
#### File menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------- | ------------------------------------------------ | ------------------------------------- |
|
||||||
|
| `file.new-file` | <kbd>Command</kbd>+<kbd>N</kbd> | New file |
|
||||||
|
| `file.new-tab` | <kbd>Command</kbd>+<kbd>T</kbd> | New tab |
|
||||||
|
| `file.open-file` | <kbd>Command</kbd>+<kbd>O</kbd> | Open markdown file |
|
||||||
|
| `file.open-folder` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
|
||||||
|
| `file.save` | <kbd>Command</kbd>+<kbd>S</kbd> | Save |
|
||||||
|
| `file.save-as` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
|
||||||
|
| `file.move-file` | - | Move current file to another location |
|
||||||
|
| `file.rename-file` | - | Rename current file |
|
||||||
|
| `file.print` | - | Print current tab |
|
||||||
|
| `file.close-tab` | <kbd>Command</kbd>+<kbd>W</kbd> | Close tab |
|
||||||
|
| `file.close-window` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
|
||||||
|
|
||||||
|
#### Edit menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------------ | ------------------------------------------------ | ----------------------------------------------- |
|
||||||
|
| `edit.undo` | <kbd>Command</kbd>+<kbd>Z</kbd> | Undo last operation |
|
||||||
|
| `edit.redo` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | Redo last operation |
|
||||||
|
| `edit.cut` | <kbd>Command</kbd>+<kbd>X</kbd> | Cut selected text |
|
||||||
|
| `edit.copy` | <kbd>Command</kbd>+<kbd>C</kbd> | Copy selected text |
|
||||||
|
| `edit.paste` | <kbd>Command</kbd>+<kbd>V</kbd> | Paste text |
|
||||||
|
| `edit.copy-as-markdown` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd> | Copy selected text as markdown |
|
||||||
|
| `edit.copy-as-html` | - | Copy selected text as html |
|
||||||
|
| `edit.paste-as-plaintext` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> | Copy selected text as plaintext |
|
||||||
|
| `edit.select-all` | <kbd>Command</kbd>+<kbd>A</kbd> | Select all text of the document |
|
||||||
|
| `edit.duplicate` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd> | Duplicate the current paragraph |
|
||||||
|
| `edit.create-paragraph` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd> | Create a new paragraph after the current one |
|
||||||
|
| `edit.delete-paragraph` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> | Delete current paragraph |
|
||||||
|
| `edit.find` | <kbd>Command</kbd>+<kbd>F</kbd> | Find information in the document |
|
||||||
|
| `edit.find-next` | <kbd>Cmd</kbd>+<kbd>G</kbd> | Continue the search and find the next match |
|
||||||
|
| `edit.find-previous` | <kbd>Shift</kbd>+<kbd>Cmd</kbd>+<kbd>G</kbd> | Continue the search and find the previous match |
|
||||||
|
| `edit.replace` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>F</kbd> | Replace the information with a replacement |
|
||||||
|
| `edit.find-in-folder` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> | Find files contain the keyword in opend folder |
|
||||||
|
| `edit.aidou` | <kbd>Command</kbd>+<kbd>/</kbd> | Show Aidou dialog |
|
||||||
|
| `edit.screenshot` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>A</kbd> | Get the screenshot |
|
||||||
|
|
||||||
|
#### Paragraph menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------------- | ------------------------------------------------ | ---------------------------------------- |
|
||||||
|
| `paragraph.heading-1` | <kbd>Command</kbd>+<kbd>1</kbd> | Set line as heading 1 |
|
||||||
|
| `paragraph.heading-2` | <kbd>Command</kbd>+<kbd>2</kbd> | Set line as heading 2 |
|
||||||
|
| `paragraph.heading-3` | <kbd>Command</kbd>+<kbd>3</kbd> | Set line as heading 3 |
|
||||||
|
| `paragraph.heading-4` | <kbd>Command</kbd>+<kbd>4</kbd> | Set line as heading 4 |
|
||||||
|
| `paragraph.heading-5` | <kbd>Command</kbd>+<kbd>5</kbd> | Set line as heading 5 |
|
||||||
|
| `paragraph.heading-6` | <kbd>Command</kbd>+<kbd>6</kbd> | Set line as heading 6 |
|
||||||
|
| `paragraph.upgrade-heading` | <kbd>Command</kbd>+<kbd>=</kbd> | Upgrade a heading |
|
||||||
|
| `paragraph.degrade-heading` | <kbd>Command</kbd>+<kbd>-</kbd> | Degrade a heading |
|
||||||
|
| `paragraph.table` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> | Insert a table |
|
||||||
|
| `paragraph.code-fence` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd> | Insert a code block |
|
||||||
|
| `paragraph.quote-block` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>Q</kbd> | Insert a quote block |
|
||||||
|
| `paragraph.math-formula` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd> | Insert a math block |
|
||||||
|
| `paragraph.html-block` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>J</kbd> | Insert a HTML block |
|
||||||
|
| `paragraph.order-list` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>O</kbd> | Insert a ordered list |
|
||||||
|
| `paragraph.bullet-list` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>U</kbd> | Insert a unordered list |
|
||||||
|
| `paragraph.task-list` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>X</kbd> | Insert a task list |
|
||||||
|
| `paragraph.loose-list-item` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd> | Convert a list item to a loose list item |
|
||||||
|
| `paragraph.paragraph` | <kbd>Command</kbd>+<kbd>0</kbd> | Convert a heading to a paragraph |
|
||||||
|
| `paragraph.horizontal-line` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>-</kbd> | Add a horizontal line |
|
||||||
|
| `paragraph.front-matter` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>Y</kbd> | Insert a YAML frontmatter block |
|
||||||
|
|
||||||
|
#### Format menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------- | ------------------------------------------------ | ----------------------------------------------- |
|
||||||
|
| `format.strong` | <kbd>Command</kbd>+<kbd>B</kbd> | Set the font of the selected text to bold |
|
||||||
|
| `format.emphasis` | <kbd>Command</kbd>+<kbd>I</kbd> | Set the font of the selected text to italic |
|
||||||
|
| `format.underline` | <kbd>Command</kbd>+<kbd>U</kbd> | Change the selected text to underline |
|
||||||
|
| `format.superscript` | - | Change the selected text to underline |
|
||||||
|
| `format.subscript` | - | Change the selected text to underline |
|
||||||
|
| `format.highlight` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> | Highlight the selected text by <mark>tag</mark> |
|
||||||
|
| `format.inline-code` | <kbd>Command</kbd>+<kbd>`</kbd> | Change the selected text to inline code |
|
||||||
|
| `format.inline-math` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd> | Change the selected text to inline math |
|
||||||
|
| `format.strike` | <kbd>Command</kbd>+<kbd>D</kbd> | Strike through the selected text |
|
||||||
|
| `format.hyperlink` | <kbd>Command</kbd>+<kbd>L</kbd> | Insert a hyperlink |
|
||||||
|
| `format.image` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Insert a image |
|
||||||
|
| `format.clear-format` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> | Clear the formatting of the selected text |
|
||||||
|
|
||||||
|
#### Window menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------------- | ----------------------------------------------- | ------------------------- |
|
||||||
|
| `window.minimize` | <kbd>Command</kbd>+<kbd>M</kbd> | Minimize the window |
|
||||||
|
| `window.toggle-always-on-top` | - | Toogle always on top mode |
|
||||||
|
| `window.zoom-in` | - | Zoom in |
|
||||||
|
| `window.zoom-out` | - | Zoom out |
|
||||||
|
| `window.toggle-full-screen` | <kbd>Ctrl</kbd>+<kbd>Command</kbd>+<kbd>F</kbd> | Toggle fullscreen mode |
|
||||||
|
|
||||||
|
#### View menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------- | ------------------------------------------------ | ---------------------------------------- |
|
||||||
|
| `view.command-palette` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Toggle command palette |
|
||||||
|
| `view.source-code-mode` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd> | Switch to source code mode |
|
||||||
|
| `view.typewriter-mode` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> | Enable typewriter mode |
|
||||||
|
| `view.focus-mode` | <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> | Enable focus mode |
|
||||||
|
| `view.toggle-sidebar` | <kbd>Command</kbd>+<kbd>J</kbd> | Toggle sidebar |
|
||||||
|
| `view.toggle-tabbar` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>B</kbd> | Toggle tabbar |
|
||||||
|
| `view.toggle-toc` . | <kbd>Command</kbd>+<kbd>K</kbd> | Toggle table of contents |
|
||||||
|
| `view.toggle-dev-tools` | <kbd>Command</kbd>+<kbd>Alt</kbd>+<kbd>I</kbd> | Toggle developer tools (debug mode only) |
|
||||||
|
| `view.dev-reload` | <kbd>Command</kbd>+<kbd>R</kbd> | Reload window (debug mode only) |
|
||||||
|
|
||||||
|
## Available key bindings
|
||||||
|
|
||||||
|
#### Tabs
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ------------------------ | ----------------------------------------------- | ---------------------------- |
|
||||||
|
| `tabs.cycle-forward` | <kbd>Ctrl</kbd>+<kbd>Tab</kbd> | Cycle through tabs |
|
||||||
|
| `tabs.cycle-backward` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> | Cycle backwards through tabs |
|
||||||
|
| `tabs.switch-to-left` | <kbd>Command</kbd>+<kbd>PageUp</kbd> | Switch tab to the left |
|
||||||
|
| `tabs.switch-to-right` | <kbd>Command</kbd>+<kbd>PageDown</kbd> | Switch tab to the right |
|
||||||
|
| `tabs.switch-to-first` | <kbd>Ctrl</kbd>+<kbd>1</kbd> | Switch tab to the 1st |
|
||||||
|
| `tabs.switch-to-second` | <kbd>Ctrl</kbd>+<kbd>2</kbd> | Switch tab to the 2nd |
|
||||||
|
| `tabs.switch-to-third` | <kbd>Ctrl</kbd>+<kbd>3</kbd> | Switch tab to the 3rd |
|
||||||
|
| `tabs.switch-to-fourth` | <kbd>Ctrl</kbd>+<kbd>4</kbd> | Switch tab to the 4th |
|
||||||
|
| `tabs.switch-to-fifth` | <kbd>Ctrl</kbd>+<kbd>5</kbd> | Switch tab to the 5th |
|
||||||
|
| `tabs.switch-to-sixth` | <kbd>Ctrl</kbd>+<kbd>6</kbd> | Switch tab to the 6th |
|
||||||
|
| `tabs.switch-to-seventh` | <kbd>Ctrl</kbd>+<kbd>7</kbd> | Switch tab to the 7th |
|
||||||
|
| `tabs.switch-to-eighth` | <kbd>Ctrl</kbd>+<kbd>8</kbd> | Switch tab to the 8th |
|
||||||
|
| `tabs.switch-to-ninth` | <kbd>Ctrl</kbd>+<kbd>9</kbd> | Switch tab to the 9th |
|
||||||
|
| `tabs.switch-to-tenth` | <kbd>Ctrl</kbd>+<kbd>0</kbd> | Switch tab to the 10th |
|
||||||
|
|
||||||
|
#### Misc
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------- | ------------------------------- | ---------------------- |
|
||||||
|
| `file.quick-open` | <kbd>Command</kbd>+<kbd>P</kbd> | Open quick open dialog |
|
139
docs/KEYBINDINGS_WINDOWS.md
Normal file
139
docs/KEYBINDINGS_WINDOWS.md
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
ew.source-code-m# Key Bindings for Windows
|
||||||
|
|
||||||
|
MarkText key bindings for Windows. Please see [general key bindings](KEYBINDINGS.md) for information how to use custom key bindings.
|
||||||
|
|
||||||
|
## Available menu key bindings
|
||||||
|
|
||||||
|
#### File menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------- | --------------------------------------------- | ------------------------------------- |
|
||||||
|
| `file.new-file` | <kbd>Ctrl</kbd>+<kbd>N</kbd> | New file |
|
||||||
|
| `file.new-tab` | <kbd>Ctrl</kbd>+<kbd>T</kbd> | New tab |
|
||||||
|
| `file.open-file` | <kbd>Ctrl</kbd>+<kbd>O</kbd> | Open markdown file |
|
||||||
|
| `file.open-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>O</kbd> | Open folder |
|
||||||
|
| `file.save` | <kbd>Ctrl</kbd>+<kbd>S</kbd> | Save |
|
||||||
|
| `file.save-as` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd> | Save as... |
|
||||||
|
| `file.move-file` | - | Move current file to another location |
|
||||||
|
| `file.rename-file` | - | Rename current file |
|
||||||
|
| `file.print` | - | Print current tab |
|
||||||
|
| `file.preferences` | <kbd>Ctrl</kbd>+<kbd>,</kbd> | Open settings window |
|
||||||
|
| `file.close-tab` | <kbd>Ctrl</kbd>+<kbd>W</kbd> | Close tab |
|
||||||
|
| `file.close-window` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>W</kbd> | Close window |
|
||||||
|
| `file.quit` | <kbd>Ctrl</kbd>+<kbd>Q</kbd> | Quit MarkText |
|
||||||
|
|
||||||
|
#### Edit menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
|:------------------------ | --------------------------------------------- | ----------------------------------------------- |
|
||||||
|
| `edit.undo` | <kbd>Ctrl</kbd>+<kbd>Z</kbd> | Undo last operation |
|
||||||
|
| `edit.redo` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd> | Redo last operation |
|
||||||
|
| `edit.cut` | <kbd>Ctrl</kbd>+<kbd>X</kbd> | Cut selected text |
|
||||||
|
| `edit.copy` | <kbd>Ctrl</kbd>+<kbd>C</kbd> | Copy selected text |
|
||||||
|
| `edit.paste` | <kbd>Ctrl</kbd>+<kbd>V</kbd> | Paste text |
|
||||||
|
| `edit.copy-as-markdown` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>C</kbd> | Copy selected text as markdown |
|
||||||
|
| `edit.copy-as-html` | - | Copy selected text as html |
|
||||||
|
| `edit.paste-as-plaintext` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> | Copy selected text as plaintext |
|
||||||
|
| `edit.select-all` | <kbd>Ctrl</kbd>+<kbd>A</kbd> | Select all text of the document |
|
||||||
|
| `edit.duplicate` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>P</kbd> | Duplicate the current paragraph |
|
||||||
|
| `edit.create-paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>N</kbd> | Create a new paragraph after the current one |
|
||||||
|
| `edit.delete-paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> | Delete current paragraph |
|
||||||
|
| `edit.find` | <kbd>Ctrl</kbd>+<kbd>F</kbd> | Find information in the document |
|
||||||
|
| `edit.find-next` | <kbd>F3</kbd> | Continue the search and find the next match |
|
||||||
|
| `edit.find-previous` | <kbd>Shift</kbd>+<kbd>F3</kbd> | Continue the search and find the previous match |
|
||||||
|
| `edit.replace` | <kbd>Ctrl</kbd>+<kbd>R</kbd> | Replace the information with a replacement |
|
||||||
|
| `edit.find-in-folder` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> | Find files contain the keyword in opend folder |
|
||||||
|
| `edit.aidou` | <kbd>Ctrl</kbd>+<kbd>/</kbd> | Show Aidou dialog |
|
||||||
|
|
||||||
|
#### Paragraph menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------------- | --------------------------------------------- | ---------------------------------------- |
|
||||||
|
| `paragraph.heading-1` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>1</kbd> | Set line as heading 1 |
|
||||||
|
| `paragraph.heading-2` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>2</kbd> | Set line as heading 2 |
|
||||||
|
| `paragraph.heading-3` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>3</kbd> | Set line as heading 3 |
|
||||||
|
| `paragraph.heading-4` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>4</kbd> | Set line as heading 4 |
|
||||||
|
| `paragraph.heading-5` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>5</kbd> | Set line as heading 5 |
|
||||||
|
| `paragraph.heading-6` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>6</kbd> | Set line as heading 6 |
|
||||||
|
| `paragraph.upgrade-heading` | <kbd>Ctrl</kbd>+<kbd>=</kbd> | Upgrade a heading |
|
||||||
|
| `paragraph.degrade-heading` | <kbd>Ctrl</kbd>+<kbd>-</kbd> | Degrade a heading |
|
||||||
|
| `paragraph.table` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>T</kbd> | Insert a table |
|
||||||
|
| `paragraph.code-fence` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>C</kbd> | Insert a code block |
|
||||||
|
| `paragraph.quote-block` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Q</kbd> | Insert a quote block |
|
||||||
|
| `paragraph.math-formula` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>M</kbd> | Insert a math block |
|
||||||
|
| `paragraph.html-block` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>H</kbd> | Insert a HTML block |
|
||||||
|
| `paragraph.order-list` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>O</kbd> | Insert a ordered list |
|
||||||
|
| `paragraph.bullet-list` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>U</kbd> | Insert a unordered list |
|
||||||
|
| `paragraph.task-list` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>X</kbd> | Insert a task list |
|
||||||
|
| `paragraph.loose-list-item` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd> | Convert a list item to a loose list item |
|
||||||
|
| `paragraph.paragraph` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>0</kbd> | Convert a heading to a paragraph |
|
||||||
|
| `paragraph.horizontal-line` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>-</kbd> | Add a horizontal line |
|
||||||
|
| `paragraph.front-matter` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Y</kbd> | Insert a YAML frontmatter block |
|
||||||
|
|
||||||
|
#### Format menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| --------------------- | --------------------------------------------- | ----------------------------------------------- |
|
||||||
|
| `format.strong` | <kbd>Ctrl</kbd>+<kbd>B</kbd> | Set the font of the selected text to bold |
|
||||||
|
| `format.emphasis` | <kbd>Ctrl</kbd>+<kbd>I</kbd> | Set the font of the selected text to italic |
|
||||||
|
| `format.underline` | <kbd>Ctrl</kbd>+<kbd>U</kbd> | Change the selected text to underline |
|
||||||
|
| `format.superscript` | - | Change the selected text to underline |
|
||||||
|
| `format.subscript` | - | Change the selected text to underline |
|
||||||
|
| `format.highlight` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>H</kbd> | Highlight the selected text by <mark>tag</mark> |
|
||||||
|
| `format.inline-code` | <kbd>Ctrl</kbd>+<kbd>`</kbd> | Change the selected text to inline code |
|
||||||
|
| `format.inline-math` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd> | Change the selected text to inline math |
|
||||||
|
| `format.strike` | <kbd>Ctrl</kbd>+<kbd>D</kbd> | Strike through the selected text |
|
||||||
|
| `format.hyperlink` | <kbd>Ctrl</kbd>+<kbd>L</kbd> | Insert a hyperlink |
|
||||||
|
| `format.image` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Insert a image |
|
||||||
|
| `format.clear-format` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>R</kbd> | Clear the formatting of the selected text |
|
||||||
|
|
||||||
|
#### Window menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------------- | ---------------------------- | ------------------------- |
|
||||||
|
| `window.minimize` | <kbd>Ctrl</kbd>+<kbd>M</kbd> | Minimize the window |
|
||||||
|
| `window.toggle-always-on-top` | - | Toogle always on top mode |
|
||||||
|
| `window.zoom-in` | - | Zoom in |
|
||||||
|
| `window.zoom-out` | - | Zoom out |
|
||||||
|
| `window.toggle-full-screen` | <kbd>F11</kbd> | Toggle fullscreen mode |
|
||||||
|
|
||||||
|
#### View menu
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------------- | --------------------------------------------- | ---------------------------------------- |
|
||||||
|
| `view.command-palette` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> | Toggle command palette |
|
||||||
|
| `view.source-code-mode` | <kbd>Ctrl</kbd>+<kbd>E</kbd> | Switch to source code mode |
|
||||||
|
| `view.typewriter-mode` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> | Enable typewriter mode |
|
||||||
|
| `view.focus-mode` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> | Enable focus mode |
|
||||||
|
| `view.toggle-sidebar` | <kbd>Ctrl</kbd>+<kbd>J</kbd> | Toggle sidebar |
|
||||||
|
| `view.toggle-tabbar` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>B</kbd> | Toggle tabbar |
|
||||||
|
| `view.toggle-toc` . | <kbd>Ctrl</kbd>+<kbd>K</kbd> | Toggle table of contents |
|
||||||
|
| `view.toggle-dev-tools` | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>I</kbd> | Toggle developer tools (debug mode only) |
|
||||||
|
| `view.dev-reload` | <kbd>Ctrl</kbd>+<kbd>F5</kbd> | Reload window (debug mode only) |
|
||||||
|
|
||||||
|
## Available key bindings
|
||||||
|
|
||||||
|
#### Tabs
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ------------------------ | ----------------------------------------------- | ---------------------------- |
|
||||||
|
| `tabs.cycle-forward` | <kbd>Ctrl</kbd>+<kbd>Tab</kbd> | Cycle through tabs |
|
||||||
|
| `tabs.cycle-backward` | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> | Cycle backwards through tabs |
|
||||||
|
| `tabs.switch-to-left` | <kbd>Ctrl</kbd>+<kbd>PageUp</kbd> | Switch tab to the left |
|
||||||
|
| `tabs.switch-to-right` | <kbd>Ctrl</kbd>+<kbd>PageDown</kbd> | Switch tab to the right |
|
||||||
|
| `tabs.switch-to-first` | <kbd>Ctrl</kbd>+<kbd>1</kbd> | Switch tab to the 1st |
|
||||||
|
| `tabs.switch-to-second` | <kbd>Ctrl</kbd>+<kbd>2</kbd> | Switch tab to the 2nd |
|
||||||
|
| `tabs.switch-to-third` | <kbd>Ctrl</kbd>+<kbd>3</kbd> | Switch tab to the 3rd |
|
||||||
|
| `tabs.switch-to-fourth` | <kbd>Ctrl</kbd>+<kbd>4</kbd> | Switch tab to the 4th |
|
||||||
|
| `tabs.switch-to-fifth` | <kbd>Ctrl</kbd>+<kbd>5</kbd> | Switch tab to the 5th |
|
||||||
|
| `tabs.switch-to-sixth` | <kbd>Ctrl</kbd>+<kbd>6</kbd> | Switch tab to the 6th |
|
||||||
|
| `tabs.switch-to-seventh` | <kbd>Ctrl</kbd>+<kbd>7</kbd> | Switch tab to the 7th |
|
||||||
|
| `tabs.switch-to-eighth` | <kbd>Ctrl</kbd>+<kbd>8</kbd> | Switch tab to the 8th |
|
||||||
|
| `tabs.switch-to-ninth` | <kbd>Ctrl</kbd>+<kbd>9</kbd> | Switch tab to the 9th |
|
||||||
|
| `tabs.switch-to-tenth` | <kbd>Ctrl</kbd>+<kbd>0</kbd> | Switch tab to the 10th |
|
||||||
|
|
||||||
|
#### Misc
|
||||||
|
|
||||||
|
| Id | Default | Description |
|
||||||
|
| ----------------- | ---------------------------- | ---------------------- |
|
||||||
|
| `file.quick-open` | <kbd>Ctrl</kbd>+<kbd>P</kbd> | Open quick open dialog |
|
@ -561,6 +561,11 @@ class App {
|
|||||||
// Convert map to object
|
// Convert map to object
|
||||||
win.webContents.send('mt::keybindings-response', Object.fromEntries(keybindings.keys))
|
win.webContents.send('mt::keybindings-response', Object.fromEntries(keybindings.keys))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcMain.on('mt::open-keybindings-config', () => {
|
||||||
|
const { keybindings } = this._accessor
|
||||||
|
keybindings.openConfigInFileManager()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
114
src/main/keyboard/keybindingsDarwin.js
Normal file
114
src/main/keyboard/keybindingsDarwin.js
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// Key bindings for macOS.
|
||||||
|
|
||||||
|
export default new Map([
|
||||||
|
// MarkText menu
|
||||||
|
['mt.hide', 'Command+H'],
|
||||||
|
['mt.hide-others', 'Command+Alt+H'],
|
||||||
|
['file.preferences', 'Command+,'], // located under MarkText menu in macOS only
|
||||||
|
|
||||||
|
// File menu
|
||||||
|
['file.new-file', 'Command+N'],
|
||||||
|
['file.new-tab', 'Command+T'],
|
||||||
|
['file.open-file', 'Command+O'],
|
||||||
|
['file.open-folder', 'Command+Shift+O'],
|
||||||
|
['file.save', 'Command+S'],
|
||||||
|
['file.save-as', 'Command+Shift+S'],
|
||||||
|
['file.move-file', ''],
|
||||||
|
['file.rename-file', ''],
|
||||||
|
['file.print', ''],
|
||||||
|
['file.close-tab', 'Command+W'],
|
||||||
|
['file.close-window', 'Command+Shift+W'],
|
||||||
|
['file.quit', 'Command+Q'],
|
||||||
|
|
||||||
|
// Edit menu
|
||||||
|
['edit.undo', 'Command+Z'],
|
||||||
|
['edit.redo', 'Command+Shift+Z'],
|
||||||
|
['edit.cut', 'Command+X'],
|
||||||
|
['edit.copy', 'Command+C'],
|
||||||
|
['edit.paste', 'Command+V'],
|
||||||
|
['edit.copy-as-markdown', 'Command+Shift+C'],
|
||||||
|
['edit.copy-as-html', ''],
|
||||||
|
['edit.paste-as-plaintext', 'Command+Shift+V'],
|
||||||
|
['edit.select-all', 'Command+A'],
|
||||||
|
['edit.duplicate', 'Command+Alt+D'],
|
||||||
|
['edit.create-paragraph', 'Shift+Command+N'],
|
||||||
|
['edit.delete-paragraph', 'Shift+Command+D'],
|
||||||
|
['edit.find', 'Command+F'],
|
||||||
|
['edit.find-next', 'Cmd+G'],
|
||||||
|
['edit.find-previous', 'Cmd+Shift+G'],
|
||||||
|
['edit.replace', 'Command+Alt+F'],
|
||||||
|
['edit.find-in-folder', 'Shift+Command+F'],
|
||||||
|
['edit.aidou', 'Command+/'],
|
||||||
|
['edit.screenshot', 'Command+Alt+A'], // macOS only
|
||||||
|
|
||||||
|
// Paragraph menu
|
||||||
|
['paragraph.heading-1', 'Command+1'],
|
||||||
|
['paragraph.heading-2', 'Command+2'],
|
||||||
|
['paragraph.heading-3', 'Command+3'],
|
||||||
|
['paragraph.heading-4', 'Command+4'],
|
||||||
|
['paragraph.heading-5', 'Command+5'],
|
||||||
|
['paragraph.heading-6', 'Command+6'],
|
||||||
|
['paragraph.upgrade-heading', 'Command+='],
|
||||||
|
['paragraph.degrade-heading', 'Command+-'],
|
||||||
|
['paragraph.table', 'Command+Shift+T'],
|
||||||
|
['paragraph.code-fence', 'Command+Alt+C'],
|
||||||
|
['paragraph.quote-block', 'Command+Alt+Q'],
|
||||||
|
['paragraph.math-formula', 'Command+Alt+M'],
|
||||||
|
['paragraph.html-block', 'Command+Alt+J'],
|
||||||
|
['paragraph.order-list', 'Command+Alt+O'],
|
||||||
|
['paragraph.bullet-list', 'Command+Alt+U'],
|
||||||
|
['paragraph.task-list', 'Command+Alt+X'],
|
||||||
|
['paragraph.loose-list-item', 'Command+Alt+L'],
|
||||||
|
['paragraph.paragraph', 'Command+0'],
|
||||||
|
['paragraph.horizontal-line', 'Command+Alt+-'],
|
||||||
|
['paragraph.front-matter', 'Command+Alt+Y'],
|
||||||
|
|
||||||
|
// Format menu
|
||||||
|
['format.strong', 'Command+B'],
|
||||||
|
['format.emphasis', 'Command+I'],
|
||||||
|
['format.underline', 'Command+U'],
|
||||||
|
['format.superscript', ''],
|
||||||
|
['format.subscript', ''],
|
||||||
|
['format.highlight', 'Shift+Command+H'],
|
||||||
|
['format.inline-code', 'Command+`'],
|
||||||
|
['format.inline-math', 'Shift+Command+M'],
|
||||||
|
['format.strike', 'Command+D'],
|
||||||
|
['format.hyperlink', 'Command+L'],
|
||||||
|
['format.image', 'Command+Shift+I'],
|
||||||
|
['format.clear-format', 'Shift+Command+R'],
|
||||||
|
|
||||||
|
// Window menu
|
||||||
|
['window.minimize', 'Command+M'],
|
||||||
|
['window.toggle-always-on-top', ''],
|
||||||
|
['window.zoom-in', ''],
|
||||||
|
['window.zoom-out', ''],
|
||||||
|
['window.toggle-full-screen', 'Ctrl+Command+F'],
|
||||||
|
|
||||||
|
// View menu
|
||||||
|
['view.command-palette', 'Command+Shift+P'],
|
||||||
|
['view.source-code-mode', 'Command+Alt+S'],
|
||||||
|
['view.typewriter-mode', 'Command+Alt+T'],
|
||||||
|
['view.focus-mode', 'Command+Shift+J'],
|
||||||
|
['view.toggle-sidebar', 'Command+J'],
|
||||||
|
['view.toggle-toc', 'Command+K'],
|
||||||
|
['view.toggle-tabbar', 'Command+Alt+B'],
|
||||||
|
['view.toggle-dev-tools', 'Command+Alt+I'],
|
||||||
|
['view.dev-reload', 'Command+R'],
|
||||||
|
|
||||||
|
// ======== Not included in application menu ========================
|
||||||
|
['tabs.cycle-forward', 'Ctrl+Tab'],
|
||||||
|
['tabs.cycle-backward', 'Ctrl+Shift+Tab'],
|
||||||
|
['tabs.switch-to-left', 'Command+PageUp'],
|
||||||
|
['tabs.switch-to-right', 'Command+PageDown'],
|
||||||
|
['tabs.switch-to-first', 'Ctrl+1'],
|
||||||
|
['tabs.switch-to-second', 'Ctrl+2'],
|
||||||
|
['tabs.switch-to-third', 'Ctrl+3'],
|
||||||
|
['tabs.switch-to-fourth', 'Ctrl+4'],
|
||||||
|
['tabs.switch-to-fifth', 'Ctrl+5'],
|
||||||
|
['tabs.switch-to-sixth', 'Ctrl+6'],
|
||||||
|
['tabs.switch-to-seventh', 'Ctrl+7'],
|
||||||
|
['tabs.switch-to-eighth', 'Ctrl+8'],
|
||||||
|
['tabs.switch-to-ninth', 'Ctrl+9'],
|
||||||
|
['tabs.switch-to-tenth', 'Ctrl+0'],
|
||||||
|
['file.quick-open', 'Command+P']
|
||||||
|
])
|
116
src/main/keyboard/keybindingsLinux.js
Normal file
116
src/main/keyboard/keybindingsLinux.js
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
// Key bindings for Linux.
|
||||||
|
|
||||||
|
// NOTE: Avoid `Ctrl+Alt` and `Alt` shortcuts on Linux because Ubuntu based OSs have reserved system shortcuts (see GH#2370).
|
||||||
|
|
||||||
|
export default new Map([
|
||||||
|
// MarkText menu on macOS only
|
||||||
|
['mt.hide', ''],
|
||||||
|
['mt.hide-others', ''],
|
||||||
|
|
||||||
|
// File menu
|
||||||
|
['file.new-file', 'Ctrl+N'],
|
||||||
|
['file.new-tab', 'Ctrl+T'],
|
||||||
|
['file.open-file', 'Ctrl+O'],
|
||||||
|
['file.open-folder', 'Ctrl+Shift+O'],
|
||||||
|
['file.save', 'Ctrl+S'],
|
||||||
|
['file.save-as', 'Ctrl+Shift+S'],
|
||||||
|
['file.move-file', ''],
|
||||||
|
['file.rename-file', ''],
|
||||||
|
['file.print', ''],
|
||||||
|
['file.preferences', 'Ctrl+,'],
|
||||||
|
['file.close-tab', 'Ctrl+W'],
|
||||||
|
['file.close-window', 'Ctrl+Shift+W'],
|
||||||
|
['file.quit', 'Ctrl+Q'],
|
||||||
|
|
||||||
|
// Edit menu
|
||||||
|
['edit.undo', 'Ctrl+Z'],
|
||||||
|
['edit.redo', 'Ctrl+Shift+Z'],
|
||||||
|
['edit.cut', 'Ctrl+X'],
|
||||||
|
['edit.copy', 'Ctrl+C'],
|
||||||
|
['edit.paste', 'Ctrl+V'],
|
||||||
|
['edit.copy-as-markdown', 'Ctrl+Shift+C'],
|
||||||
|
['edit.copy-as-html', ''],
|
||||||
|
['edit.paste-as-plaintext', 'Ctrl+Shift+V'],
|
||||||
|
['edit.select-all', 'Ctrl+A'],
|
||||||
|
['edit.duplicate', 'Ctrl+Shift+E'],
|
||||||
|
['edit.create-paragraph', 'Ctrl+Shift+N'],
|
||||||
|
['edit.delete-paragraph', 'Ctrl+Shift+D'],
|
||||||
|
['edit.find', 'Ctrl+F'],
|
||||||
|
['edit.find-next', 'F3'],
|
||||||
|
['edit.find-previous', 'Shift+F3'],
|
||||||
|
['edit.replace', 'Ctrl+R'],
|
||||||
|
['edit.find-in-folder', 'Ctrl+Shift+F'],
|
||||||
|
['edit.aidou', 'Ctrl+/'],
|
||||||
|
['edit.screenshot', ''], // macOS only
|
||||||
|
|
||||||
|
// Paragraph menu
|
||||||
|
['paragraph.heading-1', 'Ctrl+Shift+1'],
|
||||||
|
['paragraph.heading-2', 'Ctrl+Shift+2'],
|
||||||
|
['paragraph.heading-3', 'Ctrl+Shift+3'],
|
||||||
|
['paragraph.heading-4', 'Ctrl+Shift+4'],
|
||||||
|
['paragraph.heading-5', 'Ctrl+Shift+5'],
|
||||||
|
['paragraph.heading-6', 'Ctrl+Shift+6'],
|
||||||
|
['paragraph.upgrade-heading', 'Ctrl+='],
|
||||||
|
['paragraph.degrade-heading', 'Ctrl+-'],
|
||||||
|
['paragraph.table', 'Ctrl+Shift+T'],
|
||||||
|
['paragraph.code-fence', 'Ctrl+Shift+K'],
|
||||||
|
['paragraph.quote-block', 'Ctrl+Shift+Q'],
|
||||||
|
['paragraph.math-formula', 'Ctrl+Alt+M'],
|
||||||
|
['paragraph.html-block', 'Ctrl+Alt+H'],
|
||||||
|
['paragraph.order-list', 'Ctrl+G'],
|
||||||
|
['paragraph.bullet-list', 'Ctrl+Shift+U'],
|
||||||
|
['paragraph.task-list', 'Ctrl+Shift+X'],
|
||||||
|
['paragraph.loose-list-item', 'Ctrl+Shift+L'],
|
||||||
|
['paragraph.paragraph', 'Ctrl+Shift+0'],
|
||||||
|
['paragraph.horizontal-line', 'Ctrl+H'],
|
||||||
|
['paragraph.front-matter', 'Ctrl+Shift+Y'],
|
||||||
|
|
||||||
|
// Format menu
|
||||||
|
['format.strong', 'Ctrl+B'],
|
||||||
|
['format.emphasis', 'Ctrl+I'],
|
||||||
|
['format.underline', 'Ctrl+U'],
|
||||||
|
['format.superscript', ''],
|
||||||
|
['format.subscript', ''],
|
||||||
|
['format.highlight', 'Ctrl+Shift+H'],
|
||||||
|
['format.inline-code', 'Ctrl+`'],
|
||||||
|
['format.inline-math', 'Ctrl+Shift+M'],
|
||||||
|
['format.strike', 'Ctrl+D'],
|
||||||
|
['format.hyperlink', 'Ctrl+L'],
|
||||||
|
['format.image', 'Ctrl+Shift+I'],
|
||||||
|
['format.clear-format', 'Ctrl+Shift+R'],
|
||||||
|
|
||||||
|
// Window menu
|
||||||
|
['window.minimize', 'Ctrl+M'],
|
||||||
|
['window.toggle-always-on-top', ''],
|
||||||
|
['window.zoom-in', ''],
|
||||||
|
['window.zoom-out', ''],
|
||||||
|
['window.toggle-full-screen', 'F11'],
|
||||||
|
|
||||||
|
// View menu
|
||||||
|
['view.command-palette', 'Ctrl+Shift+P'],
|
||||||
|
['view.source-code-mode', 'Ctrl+E'],
|
||||||
|
['view.typewriter-mode', 'Ctrl+Shift+G'],
|
||||||
|
['view.focus-mode', 'Ctrl+Shift+J'],
|
||||||
|
['view.toggle-sidebar', 'Ctrl+J'],
|
||||||
|
['view.toggle-toc', 'Ctrl+K'],
|
||||||
|
['view.toggle-tabbar', 'Ctrl+Shift+B'],
|
||||||
|
['view.toggle-dev-tools', 'Ctrl+Alt+I'],
|
||||||
|
['view.dev-reload', 'Ctrl+F5'],
|
||||||
|
|
||||||
|
// ======== Not included in application menu ========================
|
||||||
|
['tabs.cycle-forward', 'Ctrl+Tab'],
|
||||||
|
['tabs.cycle-backward', 'Ctrl+Shift+Tab'],
|
||||||
|
['tabs.switch-to-left', 'Ctrl+PageUp'],
|
||||||
|
['tabs.switch-to-right', 'Ctrl+PageDown'],
|
||||||
|
['tabs.switch-to-first', 'Ctrl+1'],
|
||||||
|
['tabs.switch-to-second', 'Ctrl+2'],
|
||||||
|
['tabs.switch-to-third', 'Ctrl+3'],
|
||||||
|
['tabs.switch-to-fourth', 'Ctrl+4'],
|
||||||
|
['tabs.switch-to-fifth', 'Ctrl+5'],
|
||||||
|
['tabs.switch-to-sixth', 'Ctrl+6'],
|
||||||
|
['tabs.switch-to-seventh', 'Ctrl+7'],
|
||||||
|
['tabs.switch-to-eighth', 'Ctrl+8'],
|
||||||
|
['tabs.switch-to-ninth', 'Ctrl+9'],
|
||||||
|
['tabs.switch-to-tenth', 'Ctrl+0'],
|
||||||
|
['file.quick-open', 'Ctrl+P']
|
||||||
|
])
|
114
src/main/keyboard/keybindingsWindows.js
Normal file
114
src/main/keyboard/keybindingsWindows.js
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// Key bindings for Windows.
|
||||||
|
|
||||||
|
export default new Map([
|
||||||
|
// MarkText menu on macOS only
|
||||||
|
['mt.hide', ''],
|
||||||
|
['mt.hide-others', ''],
|
||||||
|
|
||||||
|
// File menu
|
||||||
|
['file.new-file', 'Ctrl+N'],
|
||||||
|
['file.new-tab', 'Ctrl+T'],
|
||||||
|
['file.open-file', 'Ctrl+O'],
|
||||||
|
['file.open-folder', 'Ctrl+Shift+O'],
|
||||||
|
['file.save', 'Ctrl+S'],
|
||||||
|
['file.save-as', 'Ctrl+Shift+S'],
|
||||||
|
['file.move-file', ''],
|
||||||
|
['file.rename-file', ''],
|
||||||
|
['file.print', ''],
|
||||||
|
['file.preferences', 'Ctrl+,'],
|
||||||
|
['file.close-tab', 'Ctrl+W'],
|
||||||
|
['file.close-window', 'Ctrl+Shift+W'],
|
||||||
|
['file.quit', 'Ctrl+Q'],
|
||||||
|
|
||||||
|
// Edit menu
|
||||||
|
['edit.undo', 'Ctrl+Z'],
|
||||||
|
['edit.redo', 'Ctrl+Shift+Z'],
|
||||||
|
['edit.cut', 'Ctrl+X'],
|
||||||
|
['edit.copy', 'Ctrl+C'],
|
||||||
|
['edit.paste', 'Ctrl+V'],
|
||||||
|
['edit.copy-as-markdown', 'Ctrl+Shift+C'],
|
||||||
|
['edit.copy-as-html', ''],
|
||||||
|
['edit.paste-as-plaintext', 'Ctrl+Shift+V'],
|
||||||
|
['edit.select-all', 'Ctrl+A'],
|
||||||
|
['edit.duplicate', 'Ctrl+Alt+D'],
|
||||||
|
['edit.create-paragraph', 'Ctrl+Shift+N'],
|
||||||
|
['edit.delete-paragraph', 'Ctrl+Shift+D'],
|
||||||
|
['edit.find', 'Ctrl+F'],
|
||||||
|
['edit.find-next', 'F3'],
|
||||||
|
['edit.find-previous', 'Shift+F3'],
|
||||||
|
['edit.replace', 'Ctrl+R'],
|
||||||
|
['edit.find-in-folder', 'Ctrl+Shift+F'],
|
||||||
|
['edit.aidou', 'Ctrl+/'],
|
||||||
|
['edit.screenshot', ''], // macOS only
|
||||||
|
|
||||||
|
// Paragraph menu
|
||||||
|
['paragraph.heading-1', 'Ctrl+Shift+1'],
|
||||||
|
['paragraph.heading-2', 'Ctrl+Shift+2'],
|
||||||
|
['paragraph.heading-3', 'Ctrl+Shift+3'],
|
||||||
|
['paragraph.heading-4', 'Ctrl+Shift+4'],
|
||||||
|
['paragraph.heading-5', 'Ctrl+Shift+5'],
|
||||||
|
['paragraph.heading-6', 'Ctrl+Shift+6'],
|
||||||
|
['paragraph.upgrade-heading', 'Ctrl+='],
|
||||||
|
['paragraph.degrade-heading', 'Ctrl+-'],
|
||||||
|
['paragraph.table', 'Ctrl+Shift+T'],
|
||||||
|
['paragraph.code-fence', 'Ctrl+Alt+C'],
|
||||||
|
['paragraph.quote-block', 'Ctrl+Alt+Q'],
|
||||||
|
['paragraph.math-formula', 'Ctrl+Alt+M'],
|
||||||
|
['paragraph.html-block', 'Ctrl+Alt+H'],
|
||||||
|
['paragraph.order-list', 'Ctrl+Alt+O'],
|
||||||
|
['paragraph.bullet-list', 'Ctrl+Alt+U'],
|
||||||
|
['paragraph.task-list', 'Ctrl+Alt+X'],
|
||||||
|
['paragraph.loose-list-item', 'Ctrl+Alt+L'],
|
||||||
|
['paragraph.paragraph', 'Ctrl+Shift+0'],
|
||||||
|
['paragraph.horizontal-line', 'Ctrl+Alt+-'],
|
||||||
|
['paragraph.front-matter', 'Ctrl+Alt+Y'],
|
||||||
|
|
||||||
|
// Format menu
|
||||||
|
['format.strong', 'Ctrl+B'],
|
||||||
|
['format.emphasis', 'Ctrl+I'],
|
||||||
|
['format.underline', 'Ctrl+U'],
|
||||||
|
['format.superscript', ''],
|
||||||
|
['format.subscript', ''],
|
||||||
|
['format.highlight', 'Ctrl+Shift+H'],
|
||||||
|
['format.inline-code', 'Ctrl+`'],
|
||||||
|
['format.inline-math', 'Ctrl+Shift+M'],
|
||||||
|
['format.strike', 'Ctrl+D'],
|
||||||
|
['format.hyperlink', 'Ctrl+L'],
|
||||||
|
['format.image', 'Ctrl+Shift+I'],
|
||||||
|
['format.clear-format', 'Ctrl+Shift+R'],
|
||||||
|
|
||||||
|
// Window menu
|
||||||
|
['window.minimize', 'Ctrl+M'],
|
||||||
|
['window.toggle-always-on-top', ''],
|
||||||
|
['window.zoom-in', ''],
|
||||||
|
['window.zoom-out', ''],
|
||||||
|
['window.toggle-full-screen', 'F11'],
|
||||||
|
|
||||||
|
// View menu
|
||||||
|
['view.command-palette', 'Ctrl+Shift+P'],
|
||||||
|
['view.source-code-mode', 'Ctrl+E'],
|
||||||
|
['view.typewriter-mode', 'Ctrl+Alt+T'],
|
||||||
|
['view.focus-mode', 'Ctrl+Shift+J'],
|
||||||
|
['view.toggle-sidebar', 'Ctrl+J'],
|
||||||
|
['view.toggle-toc', 'Ctrl+K'],
|
||||||
|
['view.toggle-tabbar', 'Ctrl+Shift+B'],
|
||||||
|
['view.toggle-dev-tools', 'Ctrl+Alt+I'],
|
||||||
|
['view.dev-reload', 'Ctrl+F5'],
|
||||||
|
|
||||||
|
// ======== Not included in application menu ========================
|
||||||
|
['tabs.cycle-forward', 'Ctrl+Tab'],
|
||||||
|
['tabs.cycle-backward', 'Ctrl+Shift+Tab'],
|
||||||
|
['tabs.switch-to-left', 'Ctrl+PageUp'],
|
||||||
|
['tabs.switch-to-right', 'Ctrl+PageDown'],
|
||||||
|
['tabs.switch-to-first', 'Ctrl+1'],
|
||||||
|
['tabs.switch-to-second', 'Ctrl+2'],
|
||||||
|
['tabs.switch-to-third', 'Ctrl+3'],
|
||||||
|
['tabs.switch-to-fourth', 'Ctrl+4'],
|
||||||
|
['tabs.switch-to-fifth', 'Ctrl+5'],
|
||||||
|
['tabs.switch-to-sixth', 'Ctrl+6'],
|
||||||
|
['tabs.switch-to-seventh', 'Ctrl+7'],
|
||||||
|
['tabs.switch-to-eighth', 'Ctrl+8'],
|
||||||
|
['tabs.switch-to-ninth', 'Ctrl+9'],
|
||||||
|
['tabs.switch-to-tenth', 'Ctrl+0'],
|
||||||
|
['file.quick-open', 'Ctrl+P']
|
||||||
|
])
|
@ -1,14 +1,16 @@
|
|||||||
import { Menu } from 'electron'
|
import { shell, Menu } from 'electron'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import log from 'electron-log'
|
import log from 'electron-log'
|
||||||
import isAccelerator from 'electron-is-accelerator'
|
import isAccelerator from 'electron-is-accelerator'
|
||||||
import electronLocalshortcut from '@hfelix/electron-localshortcut'
|
import electronLocalshortcut from '@hfelix/electron-localshortcut'
|
||||||
import { isFile2 } from 'common/filesystem'
|
import { isFile2 } from 'common/filesystem'
|
||||||
import { isOsx } from '../config'
|
import { isLinux, isOsx } from '../config'
|
||||||
import { getKeyboardLanguage, getVirtualLetters } from '../keyboard'
|
import { getKeyboardLanguage, getVirtualLetters } from '../keyboard'
|
||||||
|
import keybindingsDarwin from './keybindingsDarwin'
|
||||||
|
import keybindingsLinux from './keybindingsLinux'
|
||||||
|
import keybindingsWindows from './keybindingsWindows'
|
||||||
|
|
||||||
const tabSwitchBaseStroke = (isOsx) ? 'Ctrl' : 'Alt'
|
|
||||||
// Problematic key bindings:
|
// Problematic key bindings:
|
||||||
// Aidou: Ctrl+/ -> dead key
|
// Aidou: Ctrl+/ -> dead key
|
||||||
// Inline Code: Ctrl+` -> dead key
|
// Inline Code: Ctrl+` -> dead key
|
||||||
@ -21,109 +23,7 @@ class Keybindings {
|
|||||||
constructor (userDataPath) {
|
constructor (userDataPath) {
|
||||||
this.configPath = path.join(userDataPath, 'keybindings.json')
|
this.configPath = path.join(userDataPath, 'keybindings.json')
|
||||||
|
|
||||||
this.keys = new Map([
|
this.keys = this._getOsKeyMap()
|
||||||
// MarkText - macOS only
|
|
||||||
['mt.hide', 'Command+H'],
|
|
||||||
['mt.hide-others', 'Command+Alt+H'],
|
|
||||||
|
|
||||||
// File menu
|
|
||||||
['file.new-file', 'CmdOrCtrl+N'],
|
|
||||||
['file.new-tab', 'CmdOrCtrl+T'],
|
|
||||||
['file.open-file', 'CmdOrCtrl+O'],
|
|
||||||
['file.open-folder', 'CmdOrCtrl+Shift+O'],
|
|
||||||
['file.save', 'CmdOrCtrl+S'],
|
|
||||||
['file.save-as', 'CmdOrCtrl+Shift+S'],
|
|
||||||
['file.preferences', 'CmdOrCtrl+,'], // marktext menu in macOS
|
|
||||||
['file.close-tab', 'CmdOrCtrl+W'],
|
|
||||||
['file.close-window', 'CmdOrCtrl+Shift+W'],
|
|
||||||
['file.quit', 'CmdOrCtrl+Q'],
|
|
||||||
|
|
||||||
// Edit menu
|
|
||||||
['edit.undo', 'CmdOrCtrl+Z'],
|
|
||||||
['edit.redo', 'CmdOrCtrl+Shift+Z'],
|
|
||||||
['edit.cut', 'CmdOrCtrl+X'],
|
|
||||||
['edit.copy', 'CmdOrCtrl+C'],
|
|
||||||
['edit.paste', 'CmdOrCtrl+V'],
|
|
||||||
['edit.copy-as-markdown', 'CmdOrCtrl+Shift+C'],
|
|
||||||
['edit.copy-as-plaintext', 'CmdOrCtrl+Shift+V'],
|
|
||||||
['edit.select-all', 'CmdOrCtrl+A'],
|
|
||||||
['edit.duplicate', 'CmdOrCtrl+Alt+D'],
|
|
||||||
['edit.create-paragraph', 'Shift+CmdOrCtrl+N'],
|
|
||||||
['edit.delete-paragraph', 'Shift+CmdOrCtrl+D'],
|
|
||||||
['edit.find', 'CmdOrCtrl+F'],
|
|
||||||
['edit.find-next', isOsx ? 'Cmd+G' : 'F3'],
|
|
||||||
['edit.find-previous', isOsx ? 'Cmd+Shift+G' : 'Shift+F3'],
|
|
||||||
['edit.replace', 'CmdOrCtrl+Alt+F'],
|
|
||||||
['edit.find-in-folder', 'Shift+CmdOrCtrl+F'],
|
|
||||||
['edit.aidou', 'CmdOrCtrl+/'],
|
|
||||||
['edit.screenshot', 'CmdOrCtrl+Alt+A'], // macOS only
|
|
||||||
|
|
||||||
// Paragraph menu
|
|
||||||
['paragraph.heading-1', 'CmdOrCtrl+1'],
|
|
||||||
['paragraph.heading-2', 'CmdOrCtrl+2'],
|
|
||||||
['paragraph.heading-3', 'CmdOrCtrl+3'],
|
|
||||||
['paragraph.heading-4', 'CmdOrCtrl+4'],
|
|
||||||
['paragraph.heading-5', 'CmdOrCtrl+5'],
|
|
||||||
['paragraph.heading-6', 'CmdOrCtrl+6'],
|
|
||||||
['paragraph.upgrade-heading', 'CmdOrCtrl+='],
|
|
||||||
['paragraph.degrade-heading', 'CmdOrCtrl+-'],
|
|
||||||
['paragraph.table', 'CmdOrCtrl+Shift+T'],
|
|
||||||
['paragraph.code-fence', 'CmdOrCtrl+Alt+C'],
|
|
||||||
['paragraph.quote-block', 'CmdOrCtrl+Alt+Q'],
|
|
||||||
['paragraph.math-formula', 'CmdOrCtrl+Alt+M'],
|
|
||||||
['paragraph.html-block', isOsx ? 'CmdOrCtrl+Alt+J' : 'CmdOrCtrl+Alt+H'],
|
|
||||||
['paragraph.order-list', 'CmdOrCtrl+Alt+O'],
|
|
||||||
['paragraph.bullet-list', 'CmdOrCtrl+Alt+U'],
|
|
||||||
['paragraph.task-list', 'CmdOrCtrl+Alt+X'],
|
|
||||||
['paragraph.loose-list-item', 'CmdOrCtrl+Alt+L'],
|
|
||||||
['paragraph.paragraph', 'CmdOrCtrl+0'],
|
|
||||||
['paragraph.horizontal-line', 'CmdOrCtrl+Alt+-'],
|
|
||||||
['paragraph.front-matter', 'CmdOrCtrl+Alt+Y'],
|
|
||||||
|
|
||||||
// Format menu
|
|
||||||
['format.strong', 'CmdOrCtrl+B'],
|
|
||||||
['format.emphasis', 'CmdOrCtrl+I'],
|
|
||||||
['format.underline', 'CmdOrCtrl+U'],
|
|
||||||
['format.highlight', 'Shift+CmdOrCtrl+H'],
|
|
||||||
['format.inline-code', 'CmdOrCtrl+`'],
|
|
||||||
['format.inline-math', 'Shift+CmdOrCtrl+M'],
|
|
||||||
['format.strike', 'CmdOrCtrl+D'],
|
|
||||||
['format.hyperlink', 'CmdOrCtrl+L'],
|
|
||||||
['format.image', 'CmdOrCtrl+Shift+I'],
|
|
||||||
['format.clear-format', 'Shift+CmdOrCtrl+R'],
|
|
||||||
|
|
||||||
// Window menu
|
|
||||||
['window.minimize', 'CmdOrCtrl+M'],
|
|
||||||
['window.toggle-full-screen', isOsx ? 'Ctrl+Command+F' : 'F11'],
|
|
||||||
|
|
||||||
// View menu
|
|
||||||
['view.command-palette', 'CmdOrCtrl+Shift+P'],
|
|
||||||
['view.source-code-mode', 'CmdOrCtrl+Alt+S'],
|
|
||||||
['view.typewriter-mode', 'CmdOrCtrl+Alt+T'],
|
|
||||||
['view.focus-mode', 'CmdOrCtrl+Shift+J'],
|
|
||||||
['view.toggle-sidebar', 'CmdOrCtrl+J'],
|
|
||||||
['view.toggle-toc', 'CmdOrCtrl+K'],
|
|
||||||
['view.toggle-tabbar', 'CmdOrCtrl+Alt+B'],
|
|
||||||
['view.toggle-dev-tools', 'CmdOrCtrl+Alt+I'],
|
|
||||||
['view.dev-reload', 'CmdOrCtrl+R'],
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
['tabs.cycle-forward', 'Ctrl+Tab'],
|
|
||||||
['tabs.cycle-backward', 'Ctrl+Shift+Tab'],
|
|
||||||
['tabs.switch-to-left', 'CmdOrCtrl+PageUp'],
|
|
||||||
['tabs.switch-to-right', 'CmdOrCtrl+PageDown'],
|
|
||||||
['tabs.switch-to-first', `${tabSwitchBaseStroke}+1`],
|
|
||||||
['tabs.switch-to-second', `${tabSwitchBaseStroke}+2`],
|
|
||||||
['tabs.switch-to-third', `${tabSwitchBaseStroke}+3`],
|
|
||||||
['tabs.switch-to-fourth', `${tabSwitchBaseStroke}+4`],
|
|
||||||
['tabs.switch-to-fifth', `${tabSwitchBaseStroke}+5`],
|
|
||||||
['tabs.switch-to-sixth', `${tabSwitchBaseStroke}+6`],
|
|
||||||
['tabs.switch-to-seventh', `${tabSwitchBaseStroke}+7`],
|
|
||||||
['tabs.switch-to-eighth', `${tabSwitchBaseStroke}+8`],
|
|
||||||
['tabs.switch-to-ninth', `${tabSwitchBaseStroke}+9`],
|
|
||||||
['tabs.switch-to-tenth', `${tabSwitchBaseStroke}+0`],
|
|
||||||
['file.quick-open', 'CmdOrCtrl+P']
|
|
||||||
])
|
|
||||||
|
|
||||||
// Fix non-US keyboards
|
// Fix non-US keyboards
|
||||||
this.mnemonics = new Map()
|
this.mnemonics = new Map()
|
||||||
@ -168,8 +68,26 @@ class Keybindings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openConfigInFileManager () {
|
||||||
|
const { configPath } = this
|
||||||
|
if (!isFile2(configPath)) {
|
||||||
|
fs.writeFileSync(configPath, '{\n\n\n}\n', 'utf-8')
|
||||||
|
}
|
||||||
|
shell.openPath(configPath)
|
||||||
|
.catch(err => console.error(err))
|
||||||
|
}
|
||||||
|
|
||||||
// --- private --------------------------------
|
// --- private --------------------------------
|
||||||
|
|
||||||
|
_getOsKeyMap () {
|
||||||
|
if (isOsx) {
|
||||||
|
return keybindingsDarwin
|
||||||
|
} else if (isLinux) {
|
||||||
|
return keybindingsLinux
|
||||||
|
}
|
||||||
|
return keybindingsWindows
|
||||||
|
}
|
||||||
|
|
||||||
_fixLayout () {
|
_fixLayout () {
|
||||||
// Fix wrong virtual key mapping on non-QWERTY layouts
|
// Fix wrong virtual key mapping on non-QWERTY layouts
|
||||||
electronLocalshortcut.updateVirtualKeys(getVirtualLetters())
|
electronLocalshortcut.updateVirtualKeys(getVirtualLetters())
|
||||||
@ -219,18 +137,23 @@ class Keybindings {
|
|||||||
|
|
||||||
// Fix dead backquote key on layouts like German
|
// Fix dead backquote key on layouts like German
|
||||||
_fixInlineCode () {
|
_fixInlineCode () {
|
||||||
this.keys.set('format.inline-code', 'CmdOrCtrl+Shift+B')
|
if (isOsx) {
|
||||||
|
this.keys.set('format.inline-code', 'Cmd+Shift+B')
|
||||||
|
} else {
|
||||||
|
this.keys.set('format.inline-code', 'Ctrl+Alt+B')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadLocalKeybindings () {
|
_loadLocalKeybindings () {
|
||||||
if (global.MARKTEXT_SAFE_MODE || !isFile2(this.configPath)) {
|
if (global.MARKTEXT_SAFE_MODE || !isFile2(this.configPath)) {
|
||||||
|
console.log('Ignoring key bindings because safe mode is enabled.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let json
|
let json
|
||||||
try {
|
try {
|
||||||
json = JSON.parse(fs.readFileSync(this.configPath, 'utf8'))
|
json = JSON.parse(fs.readFileSync(this.configPath, 'utf8'))
|
||||||
} catch (e) {
|
} catch (_) {
|
||||||
json = null
|
json = null
|
||||||
}
|
}
|
||||||
if (!json || typeof json !== 'object') {
|
if (!json || typeof json !== 'object') {
|
||||||
|
@ -5,17 +5,3 @@ export const toggleAlwaysOnTop = win => {
|
|||||||
ipcMain.emit('window-toggle-always-on-top', win)
|
ipcMain.emit('window-toggle-always-on-top', win)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const zoomIn = win => {
|
|
||||||
const { webContents } = win
|
|
||||||
const zoom = webContents.getZoomFactor()
|
|
||||||
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
|
||||||
webContents.send('mt::window-zoom', Math.min(2.0, zoom + 0.125))
|
|
||||||
}
|
|
||||||
|
|
||||||
export const zoomOut = win => {
|
|
||||||
const { webContents } = win
|
|
||||||
const zoom = webContents.getZoomFactor()
|
|
||||||
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
|
||||||
webContents.send('mt::window-zoom', Math.max(0.5, zoom - 0.125))
|
|
||||||
}
|
|
||||||
|
@ -41,12 +41,13 @@ export default function (keybindings, userPreference) {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Copy as HTML',
|
label: 'Copy as HTML',
|
||||||
|
accelerator: keybindings.getAccelerator('edit.copy-as-html'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.edit(browserWindow, 'copyAsHtml')
|
actions.edit(browserWindow, 'copyAsHtml')
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Paste as Plain Text',
|
label: 'Paste as Plain Text',
|
||||||
accelerator: keybindings.getAccelerator('edit.copy-as-plaintext'),
|
accelerator: keybindings.getAccelerator('edit.paste-as-plaintext'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.edit(browserWindow, 'pasteAsPlainText')
|
actions.edit(browserWindow, 'pasteAsPlainText')
|
||||||
}
|
}
|
||||||
|
@ -103,11 +103,13 @@ export default function (keybindings, userPreference, recentlyUsedFiles) {
|
|||||||
type: 'separator'
|
type: 'separator'
|
||||||
}, {
|
}, {
|
||||||
label: 'Move To...',
|
label: 'Move To...',
|
||||||
|
accelerator: keybindings.getAccelerator('file.move-file'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.moveTo(browserWindow)
|
actions.moveTo(browserWindow)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Rename...',
|
label: 'Rename...',
|
||||||
|
accelerator: keybindings.getAccelerator('file.rename-file'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.rename(browserWindow)
|
actions.rename(browserWindow)
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ export default function (keybindings) {
|
|||||||
id: 'superscriptMenuItem',
|
id: 'superscriptMenuItem',
|
||||||
label: 'Superscript',
|
label: 'Superscript',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
|
accelerator: keybindings.getAccelerator('format.superscript'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.format(browserWindow, 'sup')
|
actions.format(browserWindow, 'sup')
|
||||||
}
|
}
|
||||||
@ -41,6 +42,7 @@ export default function (keybindings) {
|
|||||||
id: 'subscriptMenuItem',
|
id: 'subscriptMenuItem',
|
||||||
label: 'Subscript',
|
label: 'Subscript',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
|
accelerator: keybindings.getAccelerator('format.subscript'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
actions.format(browserWindow, 'sub')
|
actions.format(browserWindow, 'sub')
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { toggleAlwaysOnTop, zoomIn, zoomOut } from '../actions/window'
|
import { toggleAlwaysOnTop } from '../actions/window'
|
||||||
|
import { zoomIn, zoomOut } from '../../windows/utils'
|
||||||
import { isOsx } from '../../config'
|
import { isOsx } from '../../config'
|
||||||
|
|
||||||
export default function (keybindings) {
|
export default function (keybindings) {
|
||||||
@ -13,6 +14,7 @@ export default function (keybindings) {
|
|||||||
id: 'alwaysOnTopMenuItem',
|
id: 'alwaysOnTopMenuItem',
|
||||||
label: 'Always on Top',
|
label: 'Always on Top',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
|
accelerator: keybindings.getAccelerator('window.toggle-always-on-top'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
toggleAlwaysOnTop(browserWindow)
|
toggleAlwaysOnTop(browserWindow)
|
||||||
}
|
}
|
||||||
@ -20,11 +22,13 @@ export default function (keybindings) {
|
|||||||
type: 'separator'
|
type: 'separator'
|
||||||
}, {
|
}, {
|
||||||
label: 'Zoom In',
|
label: 'Zoom In',
|
||||||
|
accelerator: keybindings.getAccelerator('window.zoom-in'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
zoomIn(browserWindow)
|
zoomIn(browserWindow)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Zoom Out',
|
label: 'Zoom Out',
|
||||||
|
accelerator: keybindings.getAccelerator('window.zoom-out'),
|
||||||
click (menuItem, browserWindow) {
|
click (menuItem, browserWindow) {
|
||||||
zoomOut(browserWindow)
|
zoomOut(browserWindow)
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import log from 'electron-log'
|
|||||||
import windowStateKeeper from 'electron-window-state'
|
import windowStateKeeper from 'electron-window-state'
|
||||||
import { isChildOfDirectory, isSamePathSync } from 'common/filesystem/paths'
|
import { isChildOfDirectory, isSamePathSync } from 'common/filesystem/paths'
|
||||||
import BaseWindow, { WindowLifecycle, WindowType } from './base'
|
import BaseWindow, { WindowLifecycle, WindowType } from './base'
|
||||||
import { ensureWindowPosition } from './utils'
|
import { ensureWindowPosition, zoomIn, zoomOut } from './utils'
|
||||||
import { TITLE_BAR_HEIGHT, editorWinOptions, isLinux, isOsx } from '../config'
|
import { TITLE_BAR_HEIGHT, editorWinOptions, isLinux, isOsx } from '../config'
|
||||||
import { loadMarkdownFile } from '../filesystem/markdown'
|
import { loadMarkdownFile } from '../filesystem/markdown'
|
||||||
|
|
||||||
@ -96,6 +96,15 @@ class EditorWindow extends BaseWindow {
|
|||||||
|
|
||||||
this._doOpenFilesToOpen()
|
this._doOpenFilesToOpen()
|
||||||
this._markdownToOpen.length = 0
|
this._markdownToOpen.length = 0
|
||||||
|
|
||||||
|
// Listen on default system mouse zoom event (e.g. Ctrl+MouseWheel on Linux/Windows).
|
||||||
|
win.webContents.on('zoom-changed', (event, zoomDirection) => {
|
||||||
|
if (zoomDirection === 'in') {
|
||||||
|
zoomIn(win)
|
||||||
|
} else if (zoomDirection === 'out') {
|
||||||
|
zoomOut(win)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
win.webContents.once('did-fail-load', (event, errorCode, errorDescription) => {
|
win.webContents.once('did-fail-load', (event, errorCode, errorDescription) => {
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
import { screen } from 'electron'
|
import { screen } from 'electron'
|
||||||
import { isLinux } from '../config'
|
import { isLinux } from '../config'
|
||||||
|
|
||||||
|
export const zoomIn = win => {
|
||||||
|
const { webContents } = win
|
||||||
|
const zoom = webContents.getZoomFactor()
|
||||||
|
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
||||||
|
webContents.send('mt::window-zoom', Math.min(2.0, zoom + 0.125))
|
||||||
|
}
|
||||||
|
|
||||||
|
export const zoomOut = win => {
|
||||||
|
const { webContents } = win
|
||||||
|
const zoom = webContents.getZoomFactor()
|
||||||
|
// WORKAROUND: We need to set zoom on the browser window due to Electron#16018.
|
||||||
|
webContents.send('mt::window-zoom', Math.max(0.5, zoom - 0.125))
|
||||||
|
}
|
||||||
|
|
||||||
export const centerWindowOptions = options => {
|
export const centerWindowOptions = options => {
|
||||||
// "workArea" doesn't work on Linux
|
// "workArea" doesn't work on Linux
|
||||||
const { bounds, workArea } = screen.getDisplayNearestPoint(screen.getCursorScreenPoint())
|
const { bounds, workArea } = screen.getDisplayNearestPoint(screen.getCursorScreenPoint())
|
||||||
|
@ -513,7 +513,7 @@ const commands = [
|
|||||||
getCurrentWindow().minimize()
|
getCurrentWindow().minimize()
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id: 'window.always-on-top',
|
id: 'window.toggle-always-on-top',
|
||||||
description: 'Window: Always on Top',
|
description: 'Window: Always on Top',
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
ipcRenderer.send('mt::window-toggle-always-on-top')
|
ipcRenderer.send('mt::window-toggle-always-on-top')
|
||||||
@ -530,6 +530,7 @@ const commands = [
|
|||||||
{
|
{
|
||||||
id: 'file.zoom',
|
id: 'file.zoom',
|
||||||
description: 'Window: Zoom...',
|
description: 'Window: Zoom...',
|
||||||
|
shortcut: [(isOsx ? 'Cmd' : 'Ctrl'), 'Scroll'],
|
||||||
subcommands: [{
|
subcommands: [{
|
||||||
id: 'file.zoom-0',
|
id: 'file.zoom-0',
|
||||||
description: '0.625',
|
description: '0.625',
|
||||||
@ -695,13 +696,13 @@ const commands = [
|
|||||||
id: 'docs.user-guide',
|
id: 'docs.user-guide',
|
||||||
description: 'MarkText: End User Guide',
|
description: 'MarkText: End User Guide',
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
shell.openExternal('https://github.com/marktext/marktext/blob/develop/docs/README.md')
|
shell.openExternal('https://github.com/marktext/marktext/blob/master/docs/README.md')
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
id: 'docs.markdown-syntax',
|
id: 'docs.markdown-syntax',
|
||||||
description: 'MarkText: Markdown Syntax Guide',
|
description: 'MarkText: Markdown Syntax Guide',
|
||||||
execute: async () => {
|
execute: async () => {
|
||||||
shell.openExternal('https://github.com/marktext/marktext/blob/develop/docs/MARKDOWN_SYNTAX.md')
|
shell.openExternal('https://github.com/marktext/marktext/blob/master/docs/MARKDOWN_SYNTAX.md')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
56
src/renderer/prefComponents/keybindings/index.vue
Normal file
56
src/renderer/prefComponents/keybindings/index.vue
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<div class="pref-keybindings">
|
||||||
|
<h4>Key Bindings</h4>
|
||||||
|
<div class="keybinding-info">
|
||||||
|
<span>
|
||||||
|
MarkText shortcuts can be customized by editing a configuration file named <code>keybindings.json</code>.
|
||||||
|
More information how to use custom key bindings can be found <span class="link" @click="openKeybindingsDocumentation">online</span>.
|
||||||
|
All changes require a restart.
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<separator></separator>
|
||||||
|
<el-button size="medium" @click="openKeybindingsFile">Open keybindings.json</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ipcRenderer, shell } from 'electron'
|
||||||
|
import Compound from '../common/compound'
|
||||||
|
import Separator from '../common/separator'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Compound,
|
||||||
|
Separator
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openKeybindingsDocumentation () {
|
||||||
|
shell.openExternal('https://github.com/marktext/marktext/blob/master/docs/KEYBINDINGS.md')
|
||||||
|
},
|
||||||
|
openKeybindingsFile () {
|
||||||
|
ipcRenderer.send('mt::open-keybindings-config')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pref-keybindings {
|
||||||
|
& .keybinding-info {
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 20px 0;
|
||||||
|
color: var(--editorColor);
|
||||||
|
}
|
||||||
|
& .link {
|
||||||
|
color: var(--themeColor);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
& button.el-button {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -43,6 +43,11 @@ export const category = [{
|
|||||||
label: 'imageUploader',
|
label: 'imageUploader',
|
||||||
icon: ImageUploaderIcon,
|
icon: ImageUploaderIcon,
|
||||||
path: '/preference/imageUploader'
|
path: '/preference/imageUploader'
|
||||||
|
}, {
|
||||||
|
name: 'Key Bindings',
|
||||||
|
label: 'keybindings',
|
||||||
|
icon: ImageUploaderIcon, // TODO: Replace icon
|
||||||
|
path: '/preference/keybindings'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
export const searchContent = Object.keys(preferences).map(k => {
|
export const searchContent = Object.keys(preferences).map(k => {
|
||||||
|
@ -7,6 +7,7 @@ import SpellChecker from '@/prefComponents/spellchecker'
|
|||||||
import Theme from '@/prefComponents/theme'
|
import Theme from '@/prefComponents/theme'
|
||||||
import Image from '@/prefComponents/image'
|
import Image from '@/prefComponents/image'
|
||||||
import ImageUploader from '@/prefComponents/imageUploader'
|
import ImageUploader from '@/prefComponents/imageUploader'
|
||||||
|
import Keybindings from '@/prefComponents/keybindings'
|
||||||
|
|
||||||
const routes = type => ([{
|
const routes = type => ([{
|
||||||
path: '/', redirect: type === 'editor' ? '/editor' : '/preference'
|
path: '/', redirect: type === 'editor' ? '/editor' : '/preference'
|
||||||
@ -31,6 +32,8 @@ const routes = type => ([{
|
|||||||
path: 'image', component: Image, name: 'image'
|
path: 'image', component: Image, name: 'image'
|
||||||
}, {
|
}, {
|
||||||
path: 'imageUploader', component: ImageUploader, name: 'imageUploader'
|
path: 'imageUploader', component: ImageUploader, name: 'imageUploader'
|
||||||
|
}, {
|
||||||
|
path: 'keybindings', component: Keybindings, name: 'keybindings'
|
||||||
}]
|
}]
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { ipcRenderer } from 'electron'
|
|||||||
import log from 'electron-log'
|
import log from 'electron-log'
|
||||||
import bus from '../bus'
|
import bus from '../bus'
|
||||||
import staticCommands, { RootCommand } from '../commands'
|
import staticCommands, { RootCommand } from '../commands'
|
||||||
import { isOsx } from '@/util'
|
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
rootCommand: new RootCommand(staticCommands)
|
rootCommand: new RootCommand(staticCommands)
|
||||||
@ -61,11 +60,11 @@ const executeCommand = (state, commandId) => {
|
|||||||
command.execute()
|
command.execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultCtrlKey = isOsx ? 'Cmd' : 'Ctrl'
|
|
||||||
const normalizeAccelerator = acc => {
|
const normalizeAccelerator = acc => {
|
||||||
try {
|
try {
|
||||||
return acc
|
return acc
|
||||||
.replace(/cmdorctrl|cmd|ctrl/i, defaultCtrlKey)
|
.replace(/cmdorctrl|cmd/i, 'Cmd')
|
||||||
|
.replace(/ctrl/i, 'Ctrl')
|
||||||
.split('+')
|
.split('+')
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return [acc]
|
return [acc]
|
||||||
|
Loading…
Reference in New Issue
Block a user