tversteeg / registers.nvim Goto Github PK
View Code? Open in Web Editor NEW๐ Neovim plugin to preview the contents of the registers
License: GNU General Public License v3.0
๐ Neovim plugin to preview the contents of the registers
License: GNU General Public License v3.0
Pressing "X
results in E21: Cannot make changes, 'modifiable' is off
.
https://github.com/vim-scripts/ReplaceWithRegister allows "*gr
with a motion for replacing with system clipboard. Unfortunately, it doesn't work with this plugin. I noticed that https://github.com/junegunn/vim-peekaboo has similar behavior and mappings to this plugin but it is compatible with vim-scripts/ReplaceWithRegister. Anyway, I'd prefer to use registers.nvim if it could made compatible.
When using this awesome plugin on a headless machine that's not running X11 or wayland (or any clipboard proxying SSH magic), the following error message is displayed by neovim (version 0.6.1) when opening the registers.nvim UI:
clipboard: No provider. Try ":checkhealth" or ":h clipboard".
clipboard: No provider. Try ":checkhealth" or ":h clipboard".
Press ENTER or type command to continue
Nothing in my configuration sets the clipboard, but it seems to be upset that an X11/wayland clipboard tool is not available. Ideally, the plugin should continue without warning and use the neovim internal clipboard
Steps to reproduce:
Let me know if there is anything else I can do to help with this. Thanks!
Recreation instructions:
registers.nvim
, set:let g:registers_show_empty_registers=0
let g:registers_hide_only_whitespace=1
let g:registers_delay=500
if x > y then:
x = 3
endif
yip
.p
to paste a copy, note that it is pasted correctly.Ctrl-R
, wait 500 ms to see the menu. Then press 0
. Note that the text that's inserted has a 'staircase' effect of extra leading whitespace:if x > y then:
x = 3
endif
Mac
I never saw this working
so the popup window always starts from the current line where the cursor is at?
If the cursor is at the bottom, then the popup window only shows a small part of it. Is there any option to config where to display the popup window?
I have an iabbrev
like this:
iabbrev DATE <C-R>=strftime("%F")<CR>
It inserts the date when I type DATE
. With https://github.com/junegunn/vim-peekaboo, this works. However, with registers.nvim
, this abbrevation breaks; when I press space after DATE
, I go to the command line with just =
shown.
My registers.nvim
configuration is:
let g:registers_show_empty_registers=0
let g:registers_hide_only_whitespace=1
let g:registers_delay=500
If I open the popup with "
in normal mode and were to click on the underlying buffer, the popup stays open. The next time i press "
again, a new one is created and this can be repeated ad infinitum.
The first time I accidentally ran into it, any keypress would throw me an invalid window id error so there wasn't even a way to get away from it.
Maybe the popup should be closed when the user clicked (unusual with vim, I know) somewhere outside the popup, or at least check that there is at most one popup open?
For illustrative purposes:
Thanks in advance.
I was having issues related to Issue 40 that you fixed in yesterday's update. I have updated, but I'm now having a strange problem where the keymappings aren't set for any file opened after nvim has started. So if I open a file from the command line > nvim /path/to/file
, there are no problems. But if I cold-start nvim and then either :edit /path/to/file
or open by Telescope, the keymappings aren't set.
I noticed that in the updated release you also made changes to the way the keymappings are run. Is that possibly the origin of the problem?
I'm using packer and I don't do anything fancy for loading:
use 'tversteeg/registers.nvim'
If I open a file from the command line, there are no problems. But when I open nvim from my project directory and use telescope to find and open a file, or :e /path/to/file
, the keybindings aren't set, but the plugin seems to be loaded. I can run :Registers
and get the popup window, or even
:lua require'reigsters'.registers()
But the behaviour with "
(in V or N mode) or <C-r>
(in I mode) is as plain nvim.
Let me know if I can help.
NVIM v0.6.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f/build/config -I/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f/src -I/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f/.deps/usr/include -I/usr/include -I/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f/build/src/nvim/auto -I/build/neovim-gauiiQ/neovim-0.6.0~ubuntu1+git202109271150-96614f84a-adeb5640f/build/include
Compiled by buildd@lgw01-amd64-024
Features: +acl +iconv +tui
See ":help feature-compile"
Some things I've tried:
$> nvim foo.txt
vs $> nvim
then :e foo.txt
. Keybindings are no loaded in the latter case.registers.vim
(where the mappings are set), then nothing happens. (The neovim instance isn't fixed.)A small source of misery,
A pebble in a shoe,
Removed, at last!
(This plugin makes neovim so much more pleasant!)
In the past, I used peekaboo, and I liked this feature. Is it possible to be available?
Regards
Lucas
After opening a file in nvim I do a GG
to paste something in the bottom of the file then :Registers
and get this error:
E5108: Error executing lua ...os/.config/nvim/plugged/registers.nvim/lua/registers.lua:161: 'height' key must be a positive
Integer
Press ENTER or type command to continue
Guess it's just that it doesn't fit within the screen.
In normal mode, e.g. "ap
, it currently prints out "a
in command output:
registers.nvim/lua/registers.lua
Line 766 in d155742
I think it'd be nice to provide an option to disable this. It especially doesn't play well with set cmdheight=0
.
If not really needed, perhaps we can even just remove this line?
Yes
Steps to reproduce:
<C-r>
This should show the registers popup window, but in this situation, it seems to fall back to the default <C-r>
behavior.
I'm using the default config, apart from this option (which I imagine doesn't make a difference):
vim.g.registers_window_border = "single"
Hi, thanks for the plugin!
If I use this plugin and coc.nvim
, and try to show register content, I get the following error.
E5108: Error executing lua .../site/pack/packer/start/registers.nvim/lua/registers.lua:81: Vim
(call):E785: complete() can only be used in Insert mode
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
vim.g.node_host_prog = "NODE_PATH"
vim.g.python3_host_prog = "PYTHON3_PATH"
return require('packer').startup(function()
use {'wbthomason/packer.nvim', opt = true}
use "tversteeg/registers.nvim"
use {
'neoclide/coc.nvim',
run = 'yarn install --frozen-lockfile',
config = function()
vim.cmd("let g:coc_global_extensions = ['coc-tsserver']")
end
}
end)
Before anything I want to mention I love this plugin. Thanks for creating it!
I have a weird issue and I am not sure how to even begin debugging it. When using the plugin my text gets pushed around and... garbled? This doesn't happen when pasting from a register directly which is weird. Any advice?
Here's a GIF that'll hopefully make it clearer, I am having a hard time describing it accurately.
I use vmap <C-c> "+y
to copy text from nvim to system clipboard, but it's broken by the pop-up ๐ . Maybe a delay option could make it work.
Originally posted by @zhengpd in #33 (comment)
Currently, the popup window is too wide. It seems there is no option to control the window width.
Firstly thanks for making this. I really like peekabo
and I really like your re-imagining of this functionality and the plan for it to be unobtrusive.
I just downloaded it and noticed something. When I have a lot of registers populated the window opened is quite large and moves the cursor several rows up covering up my current line
It makes it harder to know what I actually meant to get out of the register since I can no longer see the line I opened it from. The examples in your README show a less populated registers buffer so it stays below the cursor line. I wonder if it'd be possible to calculate how much space there was above or below and open it where there is more space although since technically you can have 26+9+x registers it might be better to truncate at a certain point and add the ability to scroll the window.
After pasting from a register, the dot command does not work as expected.
I made a video to show the problem, I hope you can get the problem with it.
Thank you.
EDIT: typo in the video. The result of the dot command is expected to be { foo
, but with this plugin: {
.
๐๐ผ
I just noted today that this plugin wasn't working any more for me. I have it setup with the following packer
settings:
use({ -- Interactive registers.
'tversteeg/registers.nvim',
keys = {{'i', '<c-r>'}, {'n', '"'}, {'v', '"'}},
})
This previously worked fine and loaded registers.nvim
when I triggered one of the keys. This is no longer working - likely due to recent changes.
Hello, I have switched to this from peekaboo and I have to say the floating window is far superior to peekaboo's janky splits. The only difference is that peekaboo highlights the register after choosing it and closes only when the "action" key (sey p
for paste) is pressed. This makes me not-forget which register I am using and it would be great to have an option for that here.
Here is exactly what I mean:
"
is pressed the window pops up as it does now.a
. This moves the cursor to highlight register a
and the window does not close. If the register is selected "manually" (with <C-j>
/<C-k>
or arrow keys and confirmed with <CR>
) the window also stays open, waiting for the "action" key.p
. The window closes and the register contents are pasted into the working buffer.This could be a separate option, say vim.g.registers_close_after_select
, defaulting to 1 (the current behavior). There could also be a separate highlight group, say RegistersSelected
to further emphasize the selected register before p
is pressed (if you are feeling fancy).
Thanks again for making this plugin, it's making my life much easier!
Hi, and thanks for a wonderful plugin that actually makes me take advantage of the registers!
At the moment, it seems there is no way to access the colon
register while using the plugin. Is there a way around this?
This is reporting work-around.
i_<C-R>
is default map to call registers.
So when we put i_<C-R>
to call registers from telescope.nvim prompt, this plugin kills the window of telescope.nvim.
In such case, we should suppress imap <C-R>
and set new map like this:
vim.g.registers_insert_mode = false -- Suppress imap <C-R>
vim.cmd([[
imap <buffer> <expr> <C-R> &ft=='TelescopePrompt' ? '<C-R>' : registers#peek('<C-R>')
]])
Could you put this guide on your README.md?
registers.nvim looks great and I would look forward to using it as a replacement for https://github.com/junegunn/vim-peekaboo.
However, one thing that blocks me from doing that is a delay in the pop-up. Probably 75% of the time I know which registers I want and the pop-up is just a distraction. It would nice if I could configure a delay (e.g. 500ms) before the pop-up appears, which allows me to see the registers only if I pause for a moment's indecision.
Great work though, looks great so far!
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.github/workflows/ci.yml
actions/checkout v3
dineshsonachalam/markdown-autodocs v1.0.7
stefanzweifel/git-auto-commit-action v4
Linux
I never saw this working
with the latest code
E5108: Error executing lua ...pack/home-manager/start/registers.nvim/lua/registers.lua:187: String cannot contain newlines
stack traceback:
[C]: in function 'nvim_buf_set_lines'
...pack/home-manager/start/registers.nvim/lua/registers.lua:187: in function 'update_view'
...pack/home-manager/start/registers.nvim/lua/registers.lua:380: in function 'registers'
and neovim 0.7-dev (012c055804876346a3ef5c1d0cdb8e0a7ee58481) but it has been failing ever since I've installed this plugin a few months ago I think.
Hi, here is my experience with visual map in quickfix or floaterm window that I feel not right.
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent execute '!curl -fLo '.s:home.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.config/nvim/bundle/pkgs/')
Plug 'tversteeg/registers.nvim'
call plug#end()
filetype plugin on
filetype indent on
:grep something
in a file:copen
"+
+
the cursor jump to editing file from quickfix window.some problem happen from a floaterm window, it go the insert mode instead yank the text
I test with nvim-0.7.0 but it should also reproduce with nvim 0.6
It seems that I can not change the border of floating window via this option.
minimal init.vim:
set runtimepath+=/home/haojiedong/.local/share/nvim/site/pack/packer/start/registers.nvim
" double does not work neither
let g:registers_window_border = "single"
nvim -u init.vim
If we press "
in normal mode, the floating window still does not have a nice single line border.
When in command-line mode (:
), Ctrl-R pastes a register in. However, unlike in insert mode, registers.nvim
doesn't pop up a window in this case. It would be nice if it did.
Thanks for all your hard work on this plugin!
Sorry, not that familiar with the internals...
Maybe
Mac
I never saw this working
In ctrl-r
mode, when trying to insert from "
register, the following error happens:
Thanks for the plugin, btw.
NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.0/share/nvim"
Run :checkhealth for more info
local registers = require("registers")
registers.setup({
register_user_command = false,
system_clipboard = false,
show_register_types = false,
show_empty = false,
bind_keys = {
return_key = false,
ctrl_n = false,
ctrl_p = false,
ctrl_j = false,
ctrl_k = false,
},
window = {
highlight_cursorline = false,
border = "rounded",
},
})
I am trying to figure out if I am doing something wrong. My normal workflow is to visually highlight something, then hit "ay
to grab it. When I hit "a
using the plugin, it pastes the a
register on top of what I am trying to yank into that same a
register. I saw this issue but no detail: #4 Let me know if I am doing silly or missing something, thanks.
mini.vim
I used to test this:
set nocompatible
filetype plugin indent on
syntax on
set hidden
call plug#begin('~/.config/nvim/plugged')
Plug 'tversteeg/registers.nvim', { 'branch': 'main' }
let g:registers_window_border = "double" "'none' by default, can be 'none', 'single','double', 'rounded', 'solid', or 'shadow'
let g:registers_show_empty_registers = 0 "1 by default, an additional line with the registers without content
call plug#end()
Firstly, thank you for this plugin! I use the registers a fair bit and this is useful for me!
The issue:
What:
It would be helpful to have an option to automatically insert the register after selecting it in normal mode after using the "
command and selecting the register.
Happy to help with a PR.
No response
I never saw this working
To recreate:
iabbrev XYZ <C-R>=2*3<CR>
XYZ
. NeoVim shows an error about a recursive mappingI suspect this is because registers.nvim
captures <C-R>
somehow.
First of all, thanks for this simple and useful nvim plugin! Super useful ๐
When I copy an image to the clipboard (e.g. my avatar while writing this issue on github), registers.nvim break outputting this error:
E5108: Error executing lua ...os/github.com/tversteeg/registers.nvim/lua/registers.lua:81: Vim:clipboard: provider returned invalid data
Mac
I never saw this working
First of all, thanks for this plugin.
In visual mode, with some columns selected, pasting from registers
to replace the selected content does not work.
selection (before applying some register to replace the selected content):
Like the title says ๐
Hey @tversteeg awesome plugin, I wanted to point out that perhaps using xnoremap is better that vnoremap. vnoremap from my experience breaks replace feature in snippet and auto-completion.
registers.nvim/plugin/registers.vim
Line 22 in b8f6283
let g:registers_paste_in_normal_mode = 1
lets you paste in normal mode but it always paste, if "a
is pressed its pasting the content of "a
.
I want an option that let you use copy registers as normal but still let you browse the registers and paste them if you want.
The option can be selected with let g:registers_paste_in_normal_mode = 2
Thanks for this great plugin first of all. I had been using vim-peekaboo which is no longer being maintained and has got glitches from time to time, switching to this plugin saved me from this pain.
Back to the feature request, I'm wondering if comand-line/ex modes can be supported as well? For example after :
& Ctrl-R, it'd be nice to see the pop-up as well.
Maybe that's just my workflow, but I often yank text to different registers to use that later. While I love the plugin with interactive inserts it partially brakes the flow of yanking to designated registers.
Can we make an option or how we can override the default mappings "
in normal/visual modes:
https://github.com/tversteeg/registers.nvim/blob/main/plugin/registers.vim#L57
Thanks.
Mac
It used to work, and then stopped
Since the update to Neovim 0.8 I have been getting the following error:
Error detected while processing /Users/claus/.local/share/nvim/plugged/registers.nvim/plugin/registers.lua:
E5113: Error while calling lua chunk: vim/shared.lua:0: key found in more than one map: symbols
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'tbl_extend'
...l/share/nvim/plugged/registers.nvim/plugin/registers.lua:67: in main chunk
Press ENTER or type command to continue
A cursory search on E5113 indicates that this might be a Homebrew issue (I do have Neovim installed via Homebrew). Got any ideas?
Hello! Thanks for writing a great plugin.
It would be nice if users are allowed to make a customization on the floating window: currently many options are hard-coded in https://github.com/tversteeg/registers.nvim/blob/main/lua/registers.lua#L143-L153. For example, style
or border
, etc. as done in many other plugins involving floating windows.
Hey ๐๐ผ,
Cheers for creating this plugin. ๐ป
I noted a somewhat nasty bug today when trying to do a lot of color replacements. I yank a color with ye
and when move the cursor to the beginning of the color I want to replace and run ce<c-r>0
. The yanked color is pasted but not at the correct stop. See attached gif.
What should happen is that it should go back to the visual selection, but it doesn't.
Currently, the background color of floating window is hardly discernable from the main window background color, making it difficult to know the boundary between them. It would be great to give the user a choice to change the background highlight of this floating window.
Hi, thanks for the plugin.
I've been waiting a time for some to replace vim-peekaboo since it does not work with nvim property.
Whenever I try to select a visual block and paste something from a register, I have a problem. To simulate, just try to paste in visual block mode with the plugin.
Thanks for making this pluguin, works great.
One thing I'm missing is the ability to filter the type of registers that I want to see. I generally only want to check the selection and numbered registers and it is distracting to see all of them. Could we have an option to pass a list of the types of registers to show?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.