Code Monkey home page Code Monkey logo

Comments (8)

pickfire avatar pickfire commented on May 18, 2024 6

I guess it could easily be supported as a plugin. I'm not sure if this is useful enough to be part of the core (I personally never used it).

I wish it is in core, I always use this. I missed this in kakoune and I had to manually copy out the region with lots of spaces in kakoune, bad experience.

from helix.

archseer avatar archseer commented on May 18, 2024 4

I'd like to see this added, I recommend using https://github.com/alacritty/copypasta since it also includes Wayland support.

Both yank and delete always use register::set:

register::set(reg, values);

Which is a dumb hashmap with a lock right now:

pub fn get(register: char) -> Option<Vec<String>> {

I think we should special case certain registers inside set/get, in this case + should interface with the clipboard instead of the map.

The register changing via " (i.e. "+y/"+p) could be a command that uses on_next_key to wait for the next key, then change the register on the context, similar to how count is handled inside ui/editor.rs (set_register would have to be added to commands::Context).

on_next_key example:

cx.on_next_key(move |cx, event| {
if let KeyEvent {
code: KeyCode::Char(ch),
..
} = event
{
// TODO: temporarily show SPC in the mode list
match ch {
'f' => file_picker(cx),
'b' => buffer_picker(cx),
'v' => vsplit(cx),
'w' => {
// save current buffer
let (view, doc) = cx.current();
doc.format(view.id); // TODO: merge into save
tokio::spawn(doc.save());
}
'c' => {
let view_id = cx.view().id;
// close current split
cx.editor.close(view_id, /* close_buffer */ false);
}
// ' ' => toggle_alternate_buffer(cx),
// TODO: temporary since space mode took it's old key
' ' => keep_primary_selection(cx),
_ => (),
}
}
})
}

from helix.

CBenoit avatar CBenoit commented on May 18, 2024 2

If no one is working on that yet, I'll take it
EDIT: I gave a try

from helix.

archseer avatar archseer commented on May 18, 2024

Some discussion on the implementation: #119 (comment)

from helix.

CBenoit avatar CBenoit commented on May 18, 2024

We also discussed on matrix about not using registers, for example using commands (clipboard-yank, clipboard-paste), to handle pasting and yanking from system clipboard.
This approach is similar to emacs and kakoune.

idk if this helps inform anything but in kakoune i set user y as yank to clipboard and user p as paste from clipboard and am reasonably happy with that. it doesn't let me do fancy things like idk, copying to the clipboard from somewhere else and executing that as a macro, but i don't really find myself needing more functionality often
since kakoune lacks a + register in the first place
especially since if you don't treat it as a register then you can make the semantics different from registers in the ways that they fundamentally differ

By ash from matrix (I don't know your GitHub ID)

from helix.

pickfire avatar pickfire commented on May 18, 2024

We also discussed on matrix about not using registers, for example using commands (clipboard-yank, clipboard-paste), to handle pasting and yanking from system clipboard.

I still think using registers is a cleaner approach. Because we have quite some keys that work with clipboard, like ctrl-r * later if we want to paste from clipboard in insert mode.

from helix.

tdupes avatar tdupes commented on May 18, 2024

Could helix support OSC 52 as a simpler alternative? that is if we only care about yanking to the clipboard and not from it.

from helix.

CBenoit avatar CBenoit commented on May 18, 2024

I guess it could easily be supported as a plugin. I'm not sure if this is useful enough to be part of the core (I personally never used it).

from helix.

Related Issues (20)

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.