Hotkey for select curent line

please make a hotkey that select current line at cursor

3 Likes

This could be done with vim mode if you’re already using that by using Shift + V

2 Likes

i dont use vim

Current workarounds / solution …

… which might temporarily cover a lot of use cases for the proposed hotkey:

Line (paragraph) under cursor can be selected by triple click.

Current line (around caret):

  • Wrapped part of line surrounding caret(sometimes called cursor) can be selected by sequence of hotkeys: [End, Shift+Home]
  • When that part starts with indentation, then press Shift+Home once more to include the indentation in the selection.
  • Whole wrapped line can be copied by Ctrl+C or cut out (= deleted) by Ctrl+X when no text is selected (Otherwise you would get the selection instead of current line). If some text is selected before this action, then first cancel the selection e.g. by pressing Escape or Left or Right or click. Canceling multiple selection might require sequence of presses.
  • Whole line can be selected by cutting it out by Ctrl+X and then immediately pressing Ctrl+Z (Undo). (tested in Obsidian v0.10.1 in Windows 7)

Sequences of presses can be triggered by single hotkey using e.g. AutoHotkey or Keyboard Maestro. This (or some clipboard manager) can also deal with loss of previous clipboard content produced by Ctrl+X.

1 Like

Proposed extension of behavior for wrapped lines:

  • In wrapped part of line (not first part):
    Second press of Shift+Home (/ of Home while holding Shift) extends selection to the beginning of current line,
    including leading indentation (to unify number of keypresses for the same effect, regardless of wrapping).
  • Equivalently for Shift+End (here the indentation is not an issue).
  • Side-effect: This would also allow to navigate to start of paragraph by pressing sequence [Shift+Home+Home, Home]. Equivalently for end of paragraph.

Edit: Reposted as separate feature request:

1 Like

This is awesome and really should be documented in the Help file. I’ve been missing functionality like this and wishing Obsidian had it. All along it did!

I don’t understand why this is part of workaround #3. It seems like it should be part of your last workaround (#4), right? Otherwise, I don’t understand what you’re saying here…there is no “selection” if you use Ctrl-C or Ctrl-X to copy or cut a paragraph that is not selected.

Anyways, so glad you posted this.

@FedeK

The QuickAdd plug-in have a feature that let the user create a hotkey that selects the active/current line . Might be what you are looking for :slight_smile:

@looper Thanks for feedback. Let me know if current edit of paragraph need 3 eliminates the confusion.

1 Like

hey. i just downloaded the plug-in. still confused how i can add a hotkey to select active line, i can’t see it in the command palette. thanks!

You have to enable making the thunder yellow
image

My proposal would be to override Control+A:

  • Press Control+A once → current line is selected
  • Press Control+A again → entire document is selected

I believe this is how OneNote functions and I find it very useful.

1 Like