Giter VIP home page Giter VIP logo

obsidian-sentence-navigator's Introduction

Sentence Navigator

Note

Due to personal circumstances, active development is paused on this project until approximately mid-2024. Please continue to use the existing features, submit issues and contribute pull requests, but expect a delayed response.

This Obsidian plugin lets you manipulate sentences as a unit of movement. Select, move and delete by whole sentences. Credit for the original idea goes to @seatrout.

Command Shortcut *
Delete to start of sentence Ctrl + Shift + Backspace
Delete to end of sentence Ctrl + Shift + Delete
Move to start of current sentence Not set
Move to start of next sentence Not set
Select current sentence Not set
Select to start of sentence Not set
Select to end of sentence Not set

* On macOS, replace Ctrl with Cmd

Important notes

  • If the cursor is already at the start of a sentence or list item, 'Move to current sentence' will jump to the start of the previous sentence.

Installing the plugin

Refer to the official installation instructions for third-party plugins here and search for the plugin Sentence Navigator.

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.

To get started:

  • Switch to the specified Node version: nvm use
  • Install dependencies: yarn install
  • Run the extension: yarn start
  • Run tests: yarn test (use --watch for watch mode)

Support

This plugin is completely free to use, but if you'd like to say thanks, consider buying me a coffee! ๐Ÿ˜„

ko-fi

obsidian-sentence-navigator's People

Contributors

lumitry avatar seatrout avatar timhor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

seatrout lumitry

obsidian-sentence-navigator's Issues

I find myself wanting "Select to end of sentence"

I love this plugin, and I find myself wanting "Select to end of sentence" and "Select to beginning of sentence," for the same reasons that "Delete to end of sentence" and "Delete to beginning of sentence" are useful.

Just a thought.

Thank you for making this plug-in!

feat req: Select to end/start of paragraph

I realize this plugin is focused mainly on manipulation of sentences but I was wondering if selecting to the end/beginning of a paragraph would fit into the scope of this plugin.

ex:

Lorem ipsum dolor sit amet, consectetur adipiscing elit<cursor here>. Vivamus gravida sagittis maximus. Nam vel lobortis lectus. Morbi rutrum ex nec risus rutrum, at ultrices libero pellentesque. Vestibulum lacinia, odio non sagittis ornare, diam nibh malesuada nulla, eget ultricies quam sapien sed diam. Aenean non viverra quam. Donec bibendum consectetur laoreet. Pellentesque et semper libero. Nulla nec metus eleifend, dapibus diam ac, porta sapien. Nulla sagittis sollicitudin pellentesque.
  • so in this example, if select to end of paragraph were invoked. everything after Lorem ipsum dolor sit amet, consectetur adipiscing elit would be selected.
  • inversely, if the select to beginning of paragraph were invoked. Only Lorem ipsum dolor sit amet, consectetur adipiscing elit would be selected.

Let me know if you have any thoughts

idiot question

Is it possible to work on this on Windows at all? The Marcus Olsson guide to writing plugins suggests running npm run dev to compile it. That complains that there is no "dev" script. npm run build gives an error message which suggests that it's looking in the directories under npm, rather than here.

I think that by plundering and reusing the utils and actions scripts from your editor plugin I might make some progress, but not if I can't get anything to run at all.

Navigating in outlines

It would be really nice if when you navigate to the beginning of the sentence and then navigate back again, it would take you to the previous bullet. When you go forward at the end of a bullet, it does take you to the next one.

I think this functionality is being blocked by the Outliner plugin, which prevents you from going to the bullet when going to the beginning of a line. Unfortunately, Outliner is a super useful plugin (and very widely used), so I can't disable it.

I understand if you don't want to solve a problem caused by another plugin, but if this is something that you'd consider, I'd appreciate it :).

Best,
Dan

A few suggestions

Firstly, thank you so much for this plugin and the time you've taken to develop it.
I end up doing a lot of editing of long-form text for publishers and have a few suggestions which may be useful.

In no particular order:

  • Delete to last/next punctuation. Don't often need to remove a whole sentence, sometimes, it's just a clause you need to adjust.

  • Some capitalisation options that work alongside the existing delete sentence functionality. For example, delete from end of previous sentence to cursor, and then capitalise word at cursor. Really great for editing the starts of sentences quickly, so you can chop off words that lead up to where the start of the sentence should be.

  • zoom to sentence. Sometimes, I just want to see just the current sentence so it can be re-written without any of the surrounding text in a kind of sentence scratch-pad to try new versions, see how things sound when expressed differently, etc. Imagine being able to zoom into a current sentence, try a few different versions/re-writes, and then zoom out to see your selected modification in context of the rest of your text. A bit like a sandbox for sentences.

Thank you!

Issues with "select current sentence" feature

I just started using this plugin and found the select current sentence feature to be neat, but the first sentence I tried it with was a bulleted list item, and I found that by default the Regex will select the list bullet. I have managed to fix this by changing the regex to:
[^.!?\-\*\+\s][^.!?]*(?:[.!?](?!['"]?\s|$)[^.!?]*)*[.!?]?['"]?(?=\s|$) (adds \-\*\+ in the first negated set)

I can put this in a PR for constants.ts if you'd like, though perhaps a better option (that I know far too little to work on myself) would be adding 'presets' to the settings page, with human-readable descriptions of a few different methods/expressions.

Note: I'm not the best with Regex but as far as I'm aware this doesn't have any glaring issues with it. Feel free to correct me if this would mess with anything.

Another issue I found is when the sentence you're selecting is at the end of a paragraph. I'm not that great with javascript/typescript but it seems like the issue is in actions.ts where the plugin tries to select the space after a sentence. If the sentence is at the end of a paragraph, though, this will select the next line below. This causes two issues:

If there is no line below what you're selecting, an "Uncaught RangeError" occurs in the console. Removing the +1 from line 170 prevents the error from occurring. I don't think this actually affects anything, but it's still nice to avoid.
Uncaught RangeError in Obsidian Developer Console

Additionally, All characters in the found sentence following the character you're currently selecting will be moved to a new line, along with your editing caret. Removing the +1 from line 170 also prevents this from happening.
Sentence split at cursor position

I personally don't see the value in selecting the space after the sentence, but it was put there intentionally so I understand you probably have reasons for doing so. The only reason I can think of for doing it would be to delete the sentence in its entirety, which is a good use of the select sentence feature, but could also be moved to its own command. A more user-friendly solution might be to not select the space afterwards, but to remember that it's there until an action is performed. If the delete key is pressed, then delete the space. This means users who were bolding/italicizing/quoting don't have to move their formatting.

Again, I'm not exactly able to do that myself, but I can create a PR for removing the +1 from line 170 in actions.ts if you'd like me to.

P.s. Thanks for all your work on this plugin! It fixes some annoying things with selection/deletion on macOS which can be very inconsistent otherwise, and I imagine it's even nicer to have on Windows/Linux which don't have the paragraph select feature AFAIK

Move to next sentence

As a writer, this plug-in has potential to make Obsidian the preferred writing application.

The commands work well, but the Move to next sentence moves directly to the next block, skipping other sentences.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.