Giter Site home page Giter Site logo

vim-peekaboo's Introduction

vim-peekaboo

Peekaboo extends " and @ in normal mode and <CTRL-R> in insert mode so you can see the contents of the registers.

Installation

Using vim-plug:

Plug 'junegunn/vim-peekaboo'

Usage

Peekaboo will show you the contents of the registers on the sidebar when you hit " or @ in normal mode or <CTRL-R> in insert mode. The sidebar is automatically closed on subsequent key strokes.

You can toggle fullscreen mode by pressing spacebar.

Customization

Config Default Description
g:peekaboo_window vert bo 30new Command for creating Peekaboo window
g:peekaboo_delay 0 (ms) Delay opening of Peekaboo window
g:peekaboo_compact 0 (boolean) Compact display
g:peekaboo_prefix Empty (string) Prefix for key mapping (e.g. <leader>)
g:peekaboo_ins_prefix Empty (string) Prefix for insert mode key mapping (e.g. <c-x>)

License

MIT

vim-peekaboo's People

Contributors

deathlyfrantic avatar gelguy avatar junegunn avatar lo-tp avatar mhinz avatar nicolaiskogheim avatar tweekmonster 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-peekaboo's Issues

Prefix remapping prevent peekaboo from working

OS: MX Linux 17

NVIM v0.3.0-1029-g48967695c Build type: RelWithDebInfo.

Nvim configurations

I'd rather avoid shadowing @, which is used for macros, and remap the prefix to another key. I tried several in the format let g:peekaboo_prefix="<leader>2, but it had the effect of preventing peekaboo from working altogether.

Also for marks?

Hi,

Peekaboo is very convenient since it removes the need to remember what is stored in which register.
I think it would be very useful to have a similar mechanism for marks. Indeed marks are conceptually quite similar to registers, in the sense that there is a whole list of automatic and manual marks at different positions and it is often difficult to remember where every mark is located.
Do you think it would be possible to extend peekaboo (or create another plugin along the same concept), but with marks instead of registers?

Cannot read from register in insert mode with macro

What

Running a macro that does in insert mode to read from register does not work, and returns empty string - not contents of register.
Bug is only visible when running macro, not when recording it.

My setup

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 9 2014 22:01:23)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
The settings in my vimrc (mappings and functions removed)
Tested without other plugins.
Cannot reproduce with peekaboo plugin disabled.

How to reproduce

Record a macro that reads from a register in insert mode like this:
<C-R><register>

So, with 'hello' in the " register, this command qqi<C-R>"<ESC>q, writes 'hello', and is working as expected.

The issue emerges when running the macro with @q.

Expected: hello is printed
Actual: nothing is printed, and the bell rings (visuall and sound bell from terminal)

Possibly related:
If you do exactly the same as above, but add after and before ", then the " will be written out instead of nothing.

Off topic trivia:
When using <C-R><register> in a macro, you will paste whatever was in the register at the time of recording.
When you use <C-R><C-P><register>, you will paste whatever is in the register when you run the macro.

Release 0.1?

Hi. Peekaboo looks fascinating. Can I get a git tag so I can send my package managers to pull the plugin with a version number? Tyvm sir

Calling shell command on InsertEnter autocmd event hinders peekaboo

Here is a minimal .vimrc to show problem case:

" minimalvimrc
set nocompatible

" Add vim-peekaboo repository to runtime path.
set runtimepath+=/tmp/vim-peekaboo
runtime! 'plugin/vim-peekaboo.vim'

augroup foobar
  autocmd!
  " `silent! !true` provokes the same behavior.
  autocmd InsertEnter * silent! call system('true')
augroup END

Run vim -u minimalvimrc, then enter insert mode and press <C-r>0 (or insert any other register). For me, it doesn't output register content, but inserts <Plug>(pkbcr)0.

Question: format for g:peekaboo_window

My apologies for asking this question here, but I couldn't find how to configure the position of the peekaboo window. I noticed the setting g:peekaboo_window but it's not clear to me what format I should use for that.

I wanted to make the peekaboo_window show up at the top in a horizontal split, so my failed attempt was:

let g:peekaboo_window='split topleft'

thanks

gvim window shrinking

As my peekaboo window opens and closes my gvim window slowly get more and more narrow. There a resize happening that is causing my window to shrink

can this be made to work for C-r in cmode?

I guess there is some reason why it's not already mapped to cmode or you would have already done so. But just double checking.

I naively tried:

cnoremap call peekaboo#peek(1, 'ctrl-r', 0)

and the sidebar shows up, but not sure how to go on. Needless to say, my knowledge of viml is limited to let this and let that...

neovim: i_CTRL-r at end of line broken

I've noticed that with Neovim, (e.g. <c-r>*) in insert mode at the end of line will insert the register not at the end, but one character before it.

foo_
=> fobar_o

Can you confirm this?

Strange behaviour with register in macro, normal mode

This is a nasty one. And I'm not even sure of what is going on.

What

Special sequence of commands, involving moving a line up/down, pasting from a specified register, and moving back, produces strange output.

My setup

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 9 2014 22:01:23)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
The settings in my vimrc (mappings and functions removed)
Tested without other plugins.
Cannot reproduce with peekaboo plugin disabled.

Macros that trigger the bug

These produce the exact same output when peekaboo is enabled.
Should paste a word under the cursor

  • o^[""pk
  • $a^M^[""pk
  • j""pk
    Should paste a word over the cursor
  • k""pj

How to reproduce

  1. Fill the " register with the word YES
  2. Record this macro o^[""pk, or one from the list above (or just yank it into the q register)
  3. Go to the start of a line with text on (text makes it easier to see, but is not required)
  4. Run the macro

Expected:

some text that was here before
YES

Actual:

sYESome text that was here before
(empty line inserted from the  o-command, if you used the macro with an o-command)

Notes:
The bug does occur for other registers than the one used in the example.
The bug does not occur if you paste without specifying register with ".
The bug does not occur if you don't move back to the starting line. So this macro does not trigger it: k""p (the same as the last macro in the list of macros, but without the j for returning to the line).

Pasting ignores the space before the cursor

fmt.Println("|string") // ya"
test :=⋅| //<C-r>" // middle dot denotes a space here
--- Result:
test :="string"⋅ // note the middle dot's position, denoting a space
--- Expected:
test :=⋅"string"

Window is being resized when pasting in insert mode

Hi, thanks a lot for this plugin. The solved issue #61 allows me to use this plugin again...

Often, when I paste in insert mode (ctrl+r<register>p), I get the window resized to one line:

image

I can't get a pattern for that, So I don't know how to reproduce it, but it happens very often when pasting in insert mode. I don't have this problem when pasting in normal mode.

I'm using nvim 0.4.3. This was not a thing until 0.4.1

pasting in the expression register `"=`

If I enter in the expression register "=, either by doing <C-R>= in insert mode or "= in normal mode, and then try to paste something, as soon as I press ", the text Peekaboo is written on the commandline, and I can't paste anything unless I do the workaround of entering the commandline window with <C-F>.

Vim / Neovim install error / solution

Issue: Failed to install in Vim (Neovim) using the approach listed.

Aside:

## Symlinks (to use Vim settings with Neovim):
ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim

Solution: I manually recreated the autoload | plugin | syntax directory structure shown at https://github.com/junegunn/vim-peekaboo in /home/victoria/.vim/ (copied raw files/code to those locations).

In my case, I needed to create the /home/victoria/.vim/plugin/ and /home/victoria/.vim/syntax directories.

[victoria@victoria .vim]$ tree -L 2 -F ~/.vim -I 'bundle*|init*|readme*|spell*|swap|undo|view|vim*'
/home/victoria/.vim
├── autoload/
│   ├── pathogen.vim
│   └── peekaboo.vim
├── plugin/
│   └── peekaboo.vim
└── syntax/
    └── peekaboo.vim

<C-r> broken in macros

e.g.

hello world

qqVyo<c-r>"<esc>k

hello world
hello world
<blank line>

@q

Expected:

hello world
hello world
hello world
<blank line>
<blank line>

Actual

hello world
hello world
<blank line>
<blank line>
<blank line>

vsplit same buffer: unpredictable paste in insert mode

I often edit the same buffer in vertical split. When I try to paste in insert mode CTRL+R, while in the right pane, the cursor jumps to left pane, and pasted word appears in random area.

Here I try to delete word del to paste()
step 1
Here my cursor in between parens: paste(|), while in insert mode I press CTRL+R+-
step 2
The result:
step 3

Open peekaboo in current window

Hi,

Firstly, just want to say that I really love this plugin, it's a great idea and seems to be very well implemented. Thank you!

The issue that I'm having is that I'd like to open the peekaboo window in the current buffer window instead of in a separate split. I've attempted to use the g:peekaboo_window variable, but couldn't figure out how to do anything with it other than split windows.

Is it possible to achieve this with the plugin as it exists?

If not, it's a feature that I'd really like, as opening a split if often not desirable on wide monitors. I understand you might not have the time / desire to do this, in which case I'd be happy to fork it and attempt to implement it myself.

Thanks

Folded text if foldmarkers in registers

If the any text in in the registers has fold markers, some or most of the buffer ends up folded away.

Suggestion: setlocal foldlevel to something very high, so it is always open.

How to unmap @?

I did not pay attention.

For anyone using this plugin for the first time: you have the recording in the peekaboo menu.
So, you can still use recording like you normally do.

Cheers

Bug when combined with Limelight

Thanks for these great Vim plugins.

Unfortunately when I combine Limelight as an autocmd on .txt files and then use Peekaboo, if there's something already on the line I'm pasting to, the paste goes to the start of the line (which is very impractical).

Not sure what's causing the problem.

Interferes with expression register

For instance, my vimrc contains

iabbrev ddate <C-R>=strftime(%F")<CR>

to insert the current date. Vim-peekaboo captures the and prevents this from working. Is there a good way to work around that conflict?

Space Wasted by Leading Spaces

Screen Shot 2019-08-11 at 2 14 56 PM

Like the img above, when working with lines with leading spaces much of the space would be wasted.

It would be cool to trim the leading spaces.

Option to zoom window

Is there a way to temporarily maximize the view, perhaps by pressing a key that would never be used following " or @ (maybe <SPACE>)?

Error when loclist is open

Hi!

I get the following error when using peekaboo with an open loclist (opened by syntastic).

peekaboo_loclist_error

The peekaboo scratch buffer opens as expected, when pressing ", put as soon as i select a register, the cursor jumps to the loclist and i get the error in the screenshot.

Unfixable issues

Hello,
First of all thank you so much for this amazing plugins, it is one of my favorite plugins.

In different opened issues you mentioned that some issues are unfixable. Specifically you said: here #32 "I have learned from my experience that overriding the default behavior of Vim leads to many subtle issues that are very difficult or even impossible to fix".

I'm really interested in learning how you achieve this, and maybe use this popup for multiple things like commands I rarely use and can't really remember, like 'z..'. Can you explain exactly what is the problem?

For example would using floating windows in neovim help with this?

Thank you for everything

Plugin regularly (but unpredictably) crashes neovim

I'm using nvim v0.4.3 (also tested with git master), and with this plugin enabled, pressing " often (but not always) causes neovim to completely lock up. If I'm using the QT GUI, the mouse cursor changes to busy, and the application completely freezes. It doesn't respond to any keypresses or mouse clicks, and usually has to be killed with SIGKILL, as SIGTERM doesn't seem to do anything either.

Looking for a suggestion when running a macro on a bunch of lines

I love using this plug-in, but sometimes I might be doing a thing like:

:'<,'>normal @q

And so as this runs on every line I have to see the peekaboo panel toggle open and closed every time it executes the @q.

Do you have any suggestions for how you might handle a thing like this? I'm thinking maybe I should just have a function that I can call to toggle peekaboo on/off.

Not sure, though.

":'<'>normal q@" hangs

  1. Record a simple macro: qq0fe~q
  2. Visually select a few lines: Vjjj
  3. Play back the macro on the selected lines: :'<,'>normal @q

Vim version 7.4.692 hangs.

Register name gets inserted into current buffer, Neovim 0.4.2

This is a really weird thing I've started seeing lately, I'm guessing since I updated to Neovim 0.4.2. Say I have this buffer. I've selected the second "something" and I want to copy it:
Screen Shot 2019-09-26 at 8 59 17 AM
When I type the ", Peekaboo appears as normal. Then if I type + to choose the system clipboard register, this happens:
Screen Shot 2019-09-26 at 9 00 25 AM
It always seems to be the second word in the fourth line where this happens. The highlighted region is using the peekabooSelected highlight group. The selected item does get yanked to the correct register, but now I have an errant + in my buffer.

Any ideas would be appreciated. This is really strange!

Cmap for <Plug>(pkbcr)

Peekaboo is able to integrate with Cmd2.vim to allow Peekaboo to be called in command mode.

The only missing thing is that <Plug>(pkbcr) is not cnoremap-ped. Is it possible to put this as a default mapping to allow for a seamless integration?

Peekaboo breaks commandline window

If you enter the commandline window (with q: or :) and then try to paste something there, you get this series of errors:

image

For the time being I am fixing this by setting a delay for peekaboo, but I thought you could implement in the commandline window the same behavior it has on the commandline, namely, be inactive.

Thanks for the great plugin!

Open peekaboo window only after some timeout

When you know exactly what register to use, peekaboo gets in the way (visually, but might also "eat" some keys).

It would be nice if it could be deferred, e.g. until CursorHold or something similar is triggered - given the limited async capabilities Vim has.

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.