Obsidian plugin to add keyboard shortcuts commonly found in code editors such as Visual Studio Code or Sublime Text

Overview

Code Editor Shortcuts

This Obsidian plugin adds keyboard shortcuts (hotkeys) commonly found in code editors such as Visual Studio Code or Sublime Text.

Command Shortcut *
Insert line below Ctrl + Enter **
Insert line above Ctrl + Shift + Enter
Delete line Ctrl + Shift + K
Duplicate line Ctrl + Shift + D
Join line below to current line Ctrl + J
Select line (repeat to keep expanding selection) Ctrl + L
Go to start of line Not set
Go to end of line Not set
Transform selection to uppercase Not set
Transform selection to lowercase Not set
Transform selection to title case Not set

* On macOS, replace Ctrl with Cmd

** This may conflict with the default shortcut for Toggle checklist status; changing/removing one of the bindings is recommended


Note: these shortcuts currently do not work with multiple cursors

Installing the plugin

Refer to the official installation instructions for third-party plugins here.

Configuring settings

Go to Settings → Hotkeys to customise the keyboard shortcut for each action.

Contributing

Contributions and suggestions are welcome – feel free to open an issue or raise a pull request.

Comments
  • Feature Request: Quick Copy, Paste with Indention & Expand Selection

    Feature Request: Quick Copy, Paste with Indention & Expand Selection

    Hi, thanks for this useful plugins! I like the idea, it's simple but still useful. I use Sublime and I'd love to see the following commands added to Obsidian via this plugin as well.

    • Expand Selection to next match (Sublime Command:find_under_expand)
    • Paste & Indent (Sublime: paste_and_indent)
    • Expand to Brackets (Sublime: expand_selection to brackets)
    • Quick Copy & Quick Cut: without selection, using copy or cut will instead copy/cut the whole line (Sublime: copy_with_empty_selection, found in the preference section, not the keybindings section)
    opened by chrisgrieser 8
  • Add Emacs shortcuts

    Add Emacs shortcuts

    Hello!

    I've made some additions in this PR to add support for some common Emacs shortcuts (without adding any default hotkeys). Would that be something you'd be open to merging into the plugin?

    I'm fairly new to CodeMirror, so I'm sure there are better ways to do everything - let me know if you see anything that could be simpler. Thank you!

    opened by RohanM 7
  • Add support for copying lines up and down

    Add support for copying lines up and down

    I customized this to meet my needs better:

    • Changed Mod+J to Ctrl+J because VS Code uses Ctrl+J even on macOS.
    • Added Alt+Up/Down for moving lines like in VS Code.
    • Replaced Ctrl+Shift+D with Alt+Shift+Up/Down like in VS Code.

    I realized you probably won't want to merge this as-is since it will break what users currently expect (Ctrl-Shift-D) but feel free to incorporate it somehow if you wish.

    Also, I can't get tests to work. I'm getting TypeError: editor.transaction is not a function. But it works when I test the plugin manually.

    opened by mk12 7
  • Add convert to Title Case

    Add convert to Title Case

    Would it be possible to extend the case conversion routine to change the word to title case, as well as toggling between upper and lower case? It looks as if it should be simple enough.

    opened by seatrout 7
  • Minor Tweaks: Expand to bracket or quote // joining lines removes list markers

    Minor Tweaks: Expand to bracket or quote // joining lines removes list markers

    two minor additions, basically closing #7 and #21 (coincidentally created by me 😝 ).

    However, I did have trouble building the plugin on my end. After building, no command works – even the ones I did not modify. However, the changes are pretty straightforward, and yarn.test passed all tests, so I assume that everything should be fine? 😅

    For reference what happened on my end: ⬇️


    When running a command, I get the following error in the console, probably referring to .cm.operation here, but I have no idea what's missing here. In my main vault, where I use the last public release of Code Editor Shortcuts, all commands work fine though. :confused:

    app.js:1 TypeError: cm.operation is not a function
        at withMultipleSelections (eval at <anonymous> (app.js:1:1444405), <anonymous>:111:8)
        at Object.editorCallback (eval at <anonymous> (app.js:1:1444405), <anonymous>:619:35)
        at Object.e.mobileOnly.kb.isMobile.e.checkCallback (app.js:1:1566335)
        at rz (app.js:1:1565804)
        at e.executeCommandById (app.js:1:1567080)
        at e.onTrigger (app.js:1:1098107)
        at e.handleKey (app.js:1:864568)
        at t.e.handleKey (app.js:1:864681)
        at t.handleKey (app.js:1:864890)
        at e.onKeyEvent (app.js:1:865683)
    

    I assume I did something wrong while building? For reference, since I have no prior experience with nvm and/or yarn, this is the code I ran, where I never got an error during one of these.

    # install yarn + nvm
    brew install yarn
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
    # build
    nvm use # prompts to install the missing version
    nvm install 12.22.4
    nvm use
    yarn install
    yarn start
    # Cancel with ^C
    yarn test # all test passed
    
    # git
    git add -A
    git commit -m "..."
    git push # to my fork
    
    opened by chrisgrieser 6
  • [Feature Request] New Command: Select Table

    [Feature Request] New Command: Select Table

    Hello @timhor !!!!!!

    Before talking about my FR, I wanna say thank you for creating this amazing plugin. I use it a lot and everyday :)

    My FR

    My FR is simple to explain: would be amazing if we have a new command to select a markdown table.

    It’s the same meaning of Select Word Applied to markdown tables: if the caret cursor is inside a table,it will select the whole table when the new command is pressed

    Why Are you asking for this FR?

    Let me explain: there is a new plugin in beta called Markdown Table Editor that lets you edit markdown tables inside Obsidian !

    • The starting point of the plugin is to have the table that will be edited selected before hitting the command.

    That’s why I’m asking for this feature :)


    Thanks for reading this!

    Have a great day!!!!!!

    opened by FelipeRearden 6
  • Some hotkeys don't work on mac

    Some hotkeys don't work on mac

    I'm on macOS, Obsidian v0.14.7. Some default hotkeys don't work, like cmd + D and cmd + enter. However I can execute these commands from the command palette. Also, if I bind them to other hotkeys, like cmd + Q and ctrl + shift + Enter, then they will work.

    Also, I use Advanced Cursors before, which also has a feature to select word/ next occurrence. I used to bind this command to cmd + D as well, and it worked fine.

    opened by zcysxy 5
  • Select/move/delete by sentence

    Select/move/delete by sentence

    Something missing from Obsidian at present is the ability to perform operations on sentences, rather than lines.

    You can do this in Vim mode, but that has other drawbacks. I can see, sort of, how sentences might be defined in pseudocode

    • (search backwards for "[\?\!\.] " ;
    • search forwards for the same pattern or the end of the text;
    • select everything in between)

    but I don't know how to put that into typescript or indeed any language other than Python.

    Once a sentence is defined as a unit of movement, you can put in the commands that prose writers need:

    • move to next/previous sentence
    • delete from cursor to end/beginning of sentence (I use this all the time, when I get half way through a sentence and realis it has gone wrong)
    • cut and even sometimes copy sentence.

    All of these operations are really useful if you're writing continuous prose. I can have a try myself, but I can't guarantee success.

    opened by seatrout 5
  • CMD + D Doesn't seem to work in some cases

    CMD + D Doesn't seem to work in some cases

    For example:

    (hello)
    (hello)
    (hello)
    

    Selecting the first (hello) and hitting cmd + D doesn't select the next one. But just selecting hello works.

    Do you think it's maybe that searchText needs to be escaped here?

    https://github.com/timhor/obsidian-editor-shortcuts/blob/1e0e6e6816e2cac50ec07b33decaf829d6ee4e93/src/utils.ts#L266

    Eg. https://www.npmjs.com/package/escape-string-regexp

    opened by mgmeyers 4
  • Feature Request Delete to Start of Line

    Feature Request Delete to Start of Line

    Opposite of the Delete to End of Line command. I use the sentence Navigator plugin for this but it would be great to remove this and just keep code editor

    opened by brimwats 4
  • [Feature Request] `Select Word` command: Support for non-ASCII characters (e.g. á ã é í ó )

    [Feature Request] `Select Word` command: Support for non-ASCII characters (e.g. á ã é í ó )

    Hello again @timhor !!!!!!

    My FR is to add support for non-ASCII characters to the command Select Word :)

    When you select a word in a language like Portuguese or Finnish, we have this as result:

    8F8539F5-736B-42FE-9FE9-0DD753085AD4 49BEB65A-65EB-4CF6-A7A3-A6568AB10A14

    As you can see form the images, it’s only selecting the characters until the non-ASCII characters.

    This is a list of non-ASCII characters for the Portuguese and Finnish language:

    áàâãéèêíïóôõöúçÁÀÂÃÉÈÍÏÓÔÕÖÚÇ

    My Background

    Since I was born in 🇧🇷, Portuguese is my mother language. These type of characters are the used in every portuguese word as you can see above:

    | English | Portuguese | |:----------|:-------------| | Coffee | Café | | Sugar | Açúcar | | John | João |

    The same behavior applied to 🇫🇮 and many countries :)


    I hope you could add support for these characters 🙏 🙏 🙏 .

    Thank you very much for reading this !!!

    Have a great day 🌞

    opened by FelipeRearden 4
  • Markdown syntax not captured in

    Markdown syntax not captured in "Select word or next occurrence"

    Hello, thanks for developing this plugin first of all! Version: v1.10.0

    I tend to use the "Select word or next occurrence" feature often and found that there's a bug when attempting to select Markdown formatting artifacts in Live Preview & Source mode.

    To reproduce:

    ### Test 1
    ### Test 2
    ### Test 3
    

    Selecting just the ### and invoking "Select word or next occurrence" should select the next instance of ### into the selection, but it does nothing. I was also able to repro using lists as well, searching for -.

    The bug might be in findNextMatchPosition @ https://github.com/timhor/obsidian-editor-shortcuts/blob/master/src/actions.ts#L210

    opened by danyim 4
  • Add toggle case command

    Add toggle case command

    Hey! great plugin, it has nearly everything I want other than this and #44

    i'm a big jetbrains fan, they have a toggle case command which cycles the case of the selected text. this saves on remembering / using up 3 hotkeys.

    I've implemented this here as an example, this code is a little hacky so feel free to bin this and just treat it as a feature request if you like.

    Thanks!

    Matt

    https://user-images.githubusercontent.com/2782730/206207631-d9f5fb6e-b7c3-4e92-a7ff-717936a9703c.mp4

    opened by MatthewAlner 1
  • [Feature Request] Vertical select

    [Feature Request] Vertical select

    E.g. alt/option - command + up or down arrow to vertically insert cursors across multiple lines. Apologies if I overlooked something and this is already possible!

    opened by robinsonkwame 2
  • [Feature Request] move cursor up and down

    [Feature Request] move cursor up and down

    At first , thanks very much for this plugin, it's a good way, and the only way AFAIK to implement emacs keybindings in obsidian on windows and linux OS. I notice that there are move cursor right / left commands and go to previous line /next line commands, but emacs need move cursor up and down commands, because go to previous line is not useful on the lines which are wraped, I need move up as i see,not the previous line as the editor deal with.

    opened by FinallyFinancialFreedom 1
  • [Feature Request] New Command: Select Word (Not Select the Next Occurrence)

    [Feature Request] New Command: Select Word (Not Select the Next Occurrence)

    Hello @timhor !!!!

    A brief introduction before talking about the FR :)

    1️⃣ In version 1.0.7 we had the command Select Word that selected the word based on the caret cursor position.

    2️⃣ In version 1.0.8 this command gains superpower which lets us select word and select the next occurrence as well :)

    • Which is an amazing feature !!!!!

    My FR is about bring back the Select Word in a separated command

    • This way we can have the option two use both commands for different workflows :)

    I know that look strange to have two commands like this. Let me show how Select Word can have multiple workflows when you combine with other plugins :)

    My Workflow

    ℹ️ I import a lot of content to Obsdian. Especially Book Highlights, Podcasts Transcriptions and Web Artciles

    ℹ️ All my writing is created inside Obsidian. Even when I have to send a message, I write first in Obsdiamn than send to external sources.

    ℹ️ Additionally, I use a lot of html tags to decorate my notes.

    📸 Source Mode x Reading Mode 4B7AB918-2ECC-4912-A33F-038F4DDABF27

    This way I use a lot of Line Selection, Paragraphs Selection and Word Selection to easily apply this decorations to my notes.

    • Using QuickAdd I can create a macro to apply these text decorations.

    📸 This is my QuickAdd Macro B3EBF8E1-02C7-48A1-975C-01C0FC71AD3F 48E65BAA-54D9-4EB9-990F-F79C132E2C3F

    This Macro automatically Select the word at the caret cursor and then apply the decoration.

    The beautiful thing here is that the command respects if something where already select

    • This is amazing because I can have one hotkey to deal with selected and NOT select words;

    📽 2 Selected Words Selected

    https://user-images.githubusercontent.com/85180696/174653195-df0f4835-57c7-46a0-a7ff-9d8b3a5a2945.MOV

    Why I need a separated Command ?

    The video below shows why I need a command to only Select one Word

    📽 3x Michael Jordan

    https://user-images.githubusercontent.com/85180696/174653417-a6eb4003-484c-41ec-a80a-014f4f8b87d2.MOV

    In words: when I have two words select and I have the same words before and/or after the command Select Word and the Next Occurrence will apply the decoration to the next other matches

    • Which is perfect ! It exactly what the command should do :)

    But when we have a workflow where we want to apply some type of rule (in my case html tags) only to the select text and avoid the next occcurance I can use the same command. -The best scenario for this would be the old command that only selects one Michael Jordan :)

    We can apply this same insight to many workflow in Obsidian, I decided to share this one because its easy to see :)


    Thanks for reading this !!!!! I hope you like my suggestion 🙏 🙏 🙏

    Sorry for the long text. My idea was to show to you that a isolated command is something really important :)

    Let me know if you need more information !!!

    Have a great day 🌞

    opened by FelipeRearden 6
  • Expand selection to word/phrase/etc?

    Expand selection to word/phrase/etc?

    I commonly use expanding selection in both Emacs and Intellij, for example, something like this (with the cursor and selection denoted by |):

    testRegisteredDomainProcessor(buildEvent("goog|leapis.com"), "googleapis.com", null, "googleapis.com", null);
    *expand*
    testRegisteredDomainProcessor(buildEvent("|googleapis|.com"), "googleapis.com", null, "googleapis.com", null);
    *expand*
    testRegisteredDomainProcessor(buildEvent("|googleapis.com|"), "googleapis.com", null, "googleapis.com", null);
    *expand*
    testRegisteredDomainProcessor(buildEvent(|"googleapis.com"|), "googleapis.com", null, "googleapis.com", null);
    *expand*
    testRegisteredDomainProcessor(|buildEvent("googleapis.com")|, "googleapis.com", null, "googleapis.com", null);
    *expand*
    |testRegisteredDomainProcessor(buildEvent("googleapis.com"), "googleapis.com", null, "googleapis.com", null);|
    

    It would be great if this worked for text also, for example, just expanding to the current word would be super helpful. Something like:

    Hello. This "is so|me text. Yep."
    Hello. This "is |some| text. Yep."
    Hello. This "|is some text.| Yep."
    Hello. This "|is some text. Yep.|"
    Hello. This |"is some text. Yep."|
    Hello. |This "is some text. Yep."|
    |Hello. This "is some text. Yep."|
    

    I picked the unit that made the most sense to me (word -> sentence -> quotes -> outside quotes -> enclosing sentence -> entire text), but even just having "expand to word" would be very useful.

    Thanks for this plugin!

    opened by dakrone 3
Releases(1.10.0)
Owner
Tim Hor
Software Engineer @atlassian
Tim Hor
Vue2.x plugin to create scoped or global shortcuts. No need to import a vue component into the template.

vue2-shortcut Vue2.x plugin to create scoped or global shortcuts. No need to import a vue component into the template. Install $ npm install --save vu

Graxi 37 Aug 14, 2022
Add linked data to the YAML of your Obsidian notes.

Obsidian Linked Data Vocabularies Plugin This plugin adds YAML keys for the selected heading, url (optional), and broader, narrower and related headin

null 53 Oct 13, 2022
Get visual feedback that HMR completed

vite-plugin-notifier Provides visual feedback that HMR has completed. Only runs in dev mode. Example Setup To install the package: npm i --save-dev vi

Joshua Nussbaum 33 Dec 29, 2022
Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes, or dits and dahs.

@elonehoo/point-line Install # npm npm i @elonehoo/point-line # yarn yarn add @elonehoo/point-line #pnpm pnpm i @elonehoo/point-line Usage import {dec

Elone Hoo 5 Aug 3, 2022
A Vale client for Obsidian.

Obsidian Vale A Vale client for Obsidian. Prerequisites Vale Server or Vale CLI Configuration To install Vale CLI: Go to their release page. Under Ass

Marcus Olsson 76 Dec 30, 2022
Termbase für Übersetung in Form eines Obsidian Vault

lang file-id authors date tags topics en 2ff3822a-cc5f-4474-ab4e-d097dcc3a215 [email protected] 2022-01-06 #needs_completion #readme #winos #setup Readme

null 2 Jan 8, 2022
A renderless rich-text editor for Vue.js

We’re working on tiptap 2. Become a sponsor to get access immediately! Sponsor ?? tiptap A renderless and extendable rich-text editor for Vue.js [FAQ]

überdosis 17.4k Dec 29, 2022
A text replacer component for vue3.

A text replacer component for Vue 3. Requires Vue 3 as peer-dependency. Installation Install it from npm. npm install vue3-replacer pnpm add vue3-rep

Kadir Yazıcı 4 Feb 19, 2022
Bionic ReadingTool - Convert Text into Better Way to Read Faster

?? Bionic ReadingTool A revolutionary way for guiding the eyes through text using artificial fixation spots to make reading easier. As a result, the r

Lucian Daniel Crisan 335 Dec 24, 2022
Frolics is an offline, lightweight, full-text search library for Frontend applications

Frolics What Is Frolics Installation Document Preparing Customized Fields Hand-on Example Cache Usage What Is Frolics ? Frolics is an offline, lightwe

null 13 Dec 4, 2022
Vite-plugin-web-extension - A vite plugin for generating cross browser platform, ES module based web extensions.

vite-plugin-web-extension A vite plugin for generating cross browser platform, ES module based web extensions. Features Manifest V2 & V3 Support Compl

Ruben Medina 81 Dec 31, 2022
Based on vitawind, kowind brings ESLint plugin and some other plugins to it that help you to format your code quickly and efficiently.

?? KOWIND v3 ?? Vite helper based on vitawind ?? Easy To Install ⚡️ Automatically open Tailwind JIT Mode ⚙ One-Command Setting ?? Automatically config

Kayo Oliveira 13 Nov 26, 2022
Add Routify to your Svelte project

?? Add (work in progress) Routify to Svelte This is an adder for svelte-add; you should read its README before continuing here. ➕ Adding (work in prog

Svelte Add 5 Aug 3, 2022
:globe_with_meridians: Internationalization plugin for Vue.js

vue-i18n Internationalization plugin for Vue.js ?? Gold Sponsors ?? Silver Sponsors ?? Bronze Sponsors ⚠️ NOTICE This repository is for Vue I18n v8.x.

kazuya kawaguchi 6.9k Jan 8, 2023
An infinite scroll plugin for Vue.js.

Intro An infinite scroll plugin for Vue.js, to help you implement an infinite scroll list more easily. Features Mobile friendly Internal spinners 2-di

Peach 2.6k Jan 4, 2023
A Marko plugin for Vite

@marko/vite A Marko plugin for Vite. Installation npm install @marko/vite Example config import { defineConfig } from "vite"; import marko from "@mark

Marko 49 Nov 26, 2022
An Xray Panel (Trojan, Shadowsocks, Shadowsocks-Plugin,Vmess,Vless)

特征 安装Ioncube Loader Google Analytic Google Console Twilio AmazonSNS Alphadvantage (Exchange rate key) Paypal Tawk TelegramBot Mailgun Twilio-Sendgrid

null 9 Aug 4, 2021
A powercord plugin to create pet gifs

petpet A powercord plugin to create pet gifs Inspired by https://benisland.neocities.org/petpet/ Example Input Output Usage [p] is your powercord comm

Vens Powercord Plugins 20 Oct 13, 2022
A Figma plugin for generating skeleton UI placeholders, specific to Discord's usecases.

Project Scaffold Generator Why? This is an internal tool we use at Discord to generate Discord specific "skeleton/placeholders" for help in designing

Bryan Berger 17 Nov 22, 2022