Skip to content

[Feature Request] Allow char ranges for :FnlBuffer #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexmozaidze opened this issue Feb 20, 2025 · 0 comments
Open

[Feature Request] Allow char ranges for :FnlBuffer #43

alexmozaidze opened this issue Feb 20, 2025 · 0 comments

Comments

@alexmozaidze
Copy link
Contributor

Selecting a small portion of code for evaluation is a very often thing I do, but Tangerine's default keymaps don't allow char-wise evaluation, it simply expands to the whole line the selection touched.

I propose removing line ranges from :FnlBuffer and adding a check for whether the command was ran from Visual mode.

I made a hacky alternative to the default mapping you could use, though, it's not robust:

(lambda get-selection-range []
  (let [selection-start (vim.fn.getpos "v")
        selection-end (vim.fn.getpos ".")
        selected-text (vim.fn.getregion selection-start selection-end {:type (vim.fn.mode)})
        selected-text (table.concat selected-text "\n")]
    selected-text))

(map! [x] "gE" (λ []
                 (let [tangerine (require :tangerine/api)]
                   (tangerine.eval.string (get-selection-range)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant