Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么复制vim中的内容到系统的粘贴版 #11

Closed
Korov opened this issue Jan 24, 2021 · 11 comments
Closed

怎么复制vim中的内容到系统的粘贴版 #11

Korov opened this issue Jan 24, 2021 · 11 comments
Assignees

Comments

@Korov
Copy link
Contributor

Korov commented Jan 24, 2021

  • Describe the bug
    A clear and concise description of the bug.

  • ccls --version

  • ccls version
    clang version 11.0.1

  • nvim --version

  • nvim --version
    NVIM v0.4.4

  • checkhealth screenshot

image

@Martins3
Copy link
Owner

, y 和 , p 实现复制粘贴

@Korov
Copy link
Contributor Author

Korov commented Jan 24, 2021

用了 ,y 下面显示 14 lines yanked into "+ 但是在外面用ctrl + v没有获取到复制的内容

@Martins3
Copy link
Owner

那么你可以使用 " + y 来拷贝到系统的剪切板吗 ?

@Korov
Copy link
Contributor Author

Korov commented Jan 24, 2021

也不行,我用的archlinux,是哪里没配好吗?

@Martins3
Copy link
Owner

  1. 你是在 mac 上使用的吗 ?
  2. 你是在远程服务器上使用的吗 ?

@Martins3
Copy link
Owner

Martins3 commented Jan 24, 2021

也不行,我用的archlinux,是哪里没配好吗?

我以前就是在 archlinux 上使用的,是没有问题的。从 checkhealth 上看,配置的很正常。

@Korov
Copy link
Contributor Author

Korov commented Jan 24, 2021

我知道了是archlinux的问题
https://vim.fandom.com/wiki/Accessing_the_system_clipboard

vim --version | grep clipboard

-clipboard and -xterm_clipboard

@Martins3
Copy link
Owner

所以,解决了?

@Korov
Copy link
Contributor Author

Korov commented Jan 24, 2021

所以,解决了?

sudo pacman -S wl-clipboard 用这个就可以复制了xclip还是不行,除非重新编译vim或者用gvim

image

@xcaptain
Copy link

xcaptain commented Mar 5, 2021

为啥在编辑器内复制直接 y 就可以,要复制到系统剪贴板就得 , y 感觉不够一致

@Martins3
Copy link
Owner

Martins3 commented Mar 5, 2021

@xcaptain

你可以看看 vim 里面的 register 这个概念。在 vim 中间,不只是有一个剪切板,使用 y, y 对应两个剪切板,第一个是 vim 内部的,第二个是系统的。
这种做法的好处是,在 vim 内部粘贴的时候,不会污染系统的剪切板。

show all the registers in vim
DeepinScreenshot_select-area_20210305111559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants