Closed gcoelho05 closed 11 months ago
I'm not sure about lua, but I've done this before:
diff --git a/vis.h b/vis.h
index b5a27fe..7a1dc95 100644
--- a/vis.h
+++ b/vis.h
@@ -722,6 +722,8 @@ bool vis_jumplist_next(Vis*);
/** Register specifiers. */
enum VisRegister {
VIS_REG_DEFAULT, /* used when no other register is specified */
+ VIS_REG_CLIPBOARD = VIS_REG_DEFAULT, /* system clipboard register */
+ VIS_REG_PRIMARY = VIS_REG_DEFAULT, /* system primary clipboard register */
VIS_REG_ZERO, /* yank register */
VIS_REG_AMPERSAND, /* last regex match */
VIS_REG_1, /* 1-9 last sub-expression matches */
@@ -734,8 +736,6 @@ enum VisRegister {
VIS_REG_8,
VIS_REG_9,
VIS_REG_BLACKHOLE, /* /dev/null register */
- VIS_REG_CLIPBOARD, /* system clipboard register */
- VIS_REG_PRIMARY, /* system primary clipboard register */
VIS_REG_DOT, /* last inserted text, copy of VIS_MACRO_OPERATOR */
VIS_REG_SEARCH, /* last used search pattern "/ */
VIS_REG_COMMAND, /* last used :-command ": */
There is a documentation section in the README.md that links to the Lua Api. Also check out the Wiki on plugins.
~/.config/dotfiles/vis/visrc.lua
is the configuration file (see vis(1)
)./usr/bin/vis-clipboard
(that’s the location on my system, yours may vary) is a shell scriptApplying @deepcube's diff seems like the best way to me. You can also do something like this :map! normal d <vis-register>+<vis-operator-delete>
.
In your viscr.lua:
vis:map(vis.modes.NORMAL, "d", "<vis-register>+<vis-operator-delete>")
From config.h:
{ "d", ALIAS("<vis-register>+<vis-operator-delete>") },
Abraços de Minas Gerais!
In addition to @jpaulogg answer, you may also find useful to copy the system clipboard content into the main register, by including the following line somewhere in your visrc.lua:
vis.registers['"'] = { io.popen("vis-clipboard --paste"):read("*all") }
Thanks everyone for the answers. I have found @deepcube's solution to be my favourite, but everyone helped me with their good insight
Did these changes work for you on a Mac? I am currently trying to use the system clipboard by default, but I receive this message when I compile with these changes: "Command failed System clipboard not supported". I also tried just setting the primary register = clipboard register. This works inside of vis, but when I paste outside of the editor it does not paste the contents of the yanked text.
Please let me know if you have any additional ideas that may help. Thank you.
@bscuron It would be probably better to write this as a separate ticket rather than continue this never ending story.
Sorry to reopen this.
@deepcube's solution was helpful, and I am now able to copy something from my e.g. browser to vis with p
, yet, something I yank in vis with y
cannot be copied into my browser. How can I get this to work?
You should be able to. The text is copied to PRIMARY
not CLIPBOARD
. You probably need to use middle mouse click to paste into your browser.
@rnpnr Isn’t this ticket long overdue for closing?
Yes I was waiting for confirmation about using middle mouse button but I am certain it is correct.
I have been using neovim for some years now, but vis seems like a much saner way to do things and I would love to make it my daily driver.
I'm not sure this is the right place to ask for help and if it's not, please forgive me and point me to the right direction.
I wanted to have vis use the system clipboard for everything. In neovim, this is how I would do that:
How can I replicate this behaviour in my lua config?
Also, I would be grateful if someone pointed me to some documentation on how to configure vis with lua.