GithubHelp home page GithubHelp logo

tversteeg / registers.nvim Goto Github PK

View Code? Open in Web Editor NEW
591.0 591.0 23.0 774 KB

๐Ÿ“‘ Neovim plugin to preview the contents of the registers

License: GNU General Public License v3.0

Lua 100.00%
lua neovim nvim plugin registers

registers.nvim's Introduction

Ferris

Metrics

registers.nvim's People

Contributors

actions-user avatar austinliuigi avatar dharmx avatar frandsoh avatar frederick888 avatar gotalovefiracode avatar gravndal avatar hanspinckaers avatar hexium310 avatar imgbotapp avatar kyran-c avatar mvargasmoran avatar qibaobin avatar renovate[bot] avatar triarius avatar ttytm avatar tversteeg avatar weihanglo avatar yutkat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

registers.nvim's Issues

"Clipboard: no provider" error message when used on headless hosts

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:

  1. Create a chroot or VM and install latest nvim
  2. Add registers.vnim to config
  3. Try to open registers panel without installing X11 or wayland

Let me know if there is anything else I can do to help with this. Thanks!

registers.nvim inserts extra whitespace when pasting

Recreation instructions:

  1. Install registers.nvim, set:
let g:registers_show_empty_registers=0
let g:registers_hide_only_whitespace=1
let g:registers_delay=500
  1. Create a file contained some indented and non-indented text, e.g.
if x > y then:
    x = 3
endif
  1. Yank the paragraph of text with yip.
  2. Press p to paste a copy, note that it is pasted correctly.
  3. Enter insert mode, press 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

The popup windows only show a small part

Please select which platform you are using.

Mac

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

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?
CleanShot 2022-05-08 at 00 11 13@2x

registers.nvim breaks iabbrev commands with <C-R>

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

Popup stays open on focus lost

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:

registers

Keymappings are not set if file is opened by ":edit โ€ฆ" or Telescope.

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?

Some details:

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.
  • I tried using packer to load the package on keypress as in Issue 41. It made no difference.
  • This is strange. If I open a file so that the mappings aren't loaded, and then I manually source registers.vim (where the mappings are set), then nothing happens. (The neovim instance isn't fixed.)

Error when invoking Registers at the end of file.

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.

image

Option to stop showing fed keys?

What would you like registers.nvim to be able to do?

In normal mode, e.g. "ap, it currently prints out "a in command output:

vim.api.nvim_err_writeln(keys)

I think it'd be nice to provide an option to disable this. It especially doesn't play well with set cmdheight=0.

If you have any ideas on how this should be implemented, please tell us here.

If not really needed, perhaps we can even just remove this line?

Is this a feature you are interested in implementing yourself?

Yes

`<C-r>` doesn't show popup after inserting a space

Steps to reproduce:

  1. Enter insert mode
  2. Type a space
  3. Press <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"

It's not working with coc.nvim

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

Minimum configuration

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)
2021-03-19.13-58-47.mp4

Text garbled when using the plugin

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.

registers

Cannot visualise current line if window is too large

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

image

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.

It breaks the dot command

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.

Screen.Recording.2021-05-21.at.08.38.43.mov

Thank you.

EDIT: typo in the video. The result of the dot command is expected to be { foo, but with this plugin: {.

Loading async with keys using packer

๐Ÿ‘‹๐Ÿผ

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.

Feature request: hide the window after the action key is pressed

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:

  1. After " is pressed the window pops up as it does now.
  2. A register key is pressed, say 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.
  3. An "action" key is pressed, say 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!

Colon register not available

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?

registers.nvim conflicts with telescope.nvim

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?

Feature Request: delay pop-up

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!

Dependency Dashboard

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.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • dineshsonachalam/markdown-autodocs v1.0.7
  • stefanzweifel/git-auto-commit-action v4

  • Check this box to trigger a request for Renovate to run again on this repository

String cannot contain newlines

Please select which platform you are using.

Linux

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

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.

visual map not work in quickfix or floaterm window

Hi, here is my experience with visual map in quickfix or floaterm window that I feel not right.

vimrc

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

reproduce

  1. vim open a file
  2. :grep something in a file
  3. :copen
  4. visually select a line then "+
  5. after hitting + 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

env

I test with nvim-0.7.0 but it should also reproduce with nvim 0.6

The option g:registers_window_border does not work.

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.

  • nvim version: 0.5.0
  • OS: Linux CentOS 7.4

Support Ctrl-R in command line mode

What would you like registers.nvim to be able to do?

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!

If you have any ideas on how this should be implemented, please tell us here.

Sorry, not that familiar with the internals...

Is this a feature you are interested in implementing yourself?

Maybe

Unable to paste from `"` in insert mode using `<C-R>`

Please select which platform you are using

Mac

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

In ctrl-r mode, when trying to insert from " register, the following error happens:

image

Thanks for the plugin, btw.

Neovim version

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

Setup

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",
	},
})

Visual mode yank to register broken?

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()

pmenu does not conform to list of registers

Firstly, thank you for this plugin! I use the registers a fair bit and this is useful for me!

The issue:
What:

  • The popup window does not conform to the list of registers in it for me. I fully appreciate that this may not be an issue with the plugin and that I may be missing a configuration somewhere.

image

registers.nvim conflicts with use of <C-R> in iabbrev RHS

Please select which platform you are using.

No response

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

To recreate:

  • Install and configure registers.nvim
  • Add an abbrevation to init.vim or similar iabbrev XYZ <C-R>=2*3<CR>
  • Open an empty file, type XYZ . NeoVim shows an error about a recursive mapping

I suspect this is because registers.nvim captures <C-R> somehow.

clipboard error "target STRING not available"

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

It breaks with multi column selection

Please select which platform you are using.

Mac

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

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):
image

"0p without this plugin (how it is supposed to work):
image

"0p with this plugin:
image

Feature request: paste in normal mode only when selecting with enter

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

Feature request: Support command-line/ex modes

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.

Vim 0.8 Error E5113: Error while calling lua chunk

Please select which platform you are using.

Mac

Was this something which used to work for you, and then stopped?

It used to work, and then stopped

Describe the bug

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?

Output is incorrect when using <Ctrl-R>

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.

Peek 2021-05-20 08-43

Option to change floating window background color

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.

It's not working in visual block

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.

Feature request: option to define what registers to show

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?

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.