Split

This is the command I use for splitting, or creating a new client editing the same buffer with the same selections:

declare-option -hidden str split_bufname
define-command -docstring "open the current buffer in a new client" split %{
    set-option global split_bufname %val{bufname}

    new 'edit %opt{split_bufname};' "select %val{selections_desc}"
    # NOTE:
    # %opt{split_bufname} must be single-quoted so it will be expanded
    # by the new client, ensuring it will treat it as a single argument
    # even if it has whitespace in it.
    # %val{selections_desc} must be double-quoted so it will be expanded
    # by this client into multiple arguments. The select command expects
    # each selection description to be a separate argument.
}
3 Likes

I recently posted split command that I use. I ended up going with bit more complicated setup, since it was important to me to have the split buffer look exactly like the original.

If you’re interested, have a look: Split current buffer to a new window