如何让vim yank到剪贴板(“y”)工作?
根据vim用户手册04.7(),您可以使用如何让vim yank到剪贴板(“y”)工作?,vim,virtual-machine,clipboard,yank,Vim,Virtual Machine,Clipboard,Yank,根据vim用户手册04.7(),您可以使用“*y从vim拖动到剪贴板,并使用”*p从剪贴板放入vim。我可以成功地使用“*p命令,但”*y命令目前不适用于我。这个问题已经持续了几个星期。我知道您可以使用gvim绕过这个问题,但我在从终端运行vim时需要一个解决方案 有没有人想过问题可能是什么?我已经在下面包含了我的.vimrc文件,正如您将看到的,它或多或少是vim预先打包的默认文件 我在Windows10上运行Ubuntu16.04作为虚拟机。提前感谢您提供的任何帮助 " An example
“*y
从vim拖动到剪贴板,并使用”*p
从剪贴板放入vim。我可以成功地使用“*p
命令,但”*y
命令目前不适用于我。这个问题已经持续了几个星期。我知道您可以使用gvim绕过这个问题,但我在从终端运行vim时需要一个解决方案
有没有人想过问题可能是什么?我已经在下面包含了我的.vimrc
文件,正如您将看到的,它或多或少是vim预先打包的默认文件
我在Windows10上运行Ubuntu16.04作为虚拟机。提前感谢您提供的任何帮助
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2016 Mar 25
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Activate pathogen file manager
execute pathogen#infect()
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
"if has("vms")
" set nobackup " do not keep a backup file, use versions instead
"else
" set backup " keep a backup file (restore to previous version)
" set undofile " keep an undo file (undo changes after closing)
"endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
set sts=4 " 3 options to halve displayed indent
set shiftwidth=4 " (without altering true tabstop)
set noexpandtab
endif " has("autocmd")
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif
if has('langmap') && exists('+langnoremap')
" Prevent that the langmap option applies to characters that result from a
" mapping. If unset (default), this may break plugins (but it's backward
" compatible).
set langnoremap
endif
" Add optional packages.
"
" The matchit plugin makes the % command work better, but it is not backwards
" compatible.
packadd matchit
“vimrc文件的示例。
"
“维护者:布拉姆·穆勒纳
“最后更改:2016年3月25日
"
“要使用它,请将其复制到
“对于Unix和OS/2:~/.vimrc
“对于Amiga:s:.vimrc
“对于MS-DOS和Win32:$VIM\\u vimrc
“对于OpenVMS:sys$login:.vimrc
当以“evim”启动时,evim.vim将已经完成这些设置。
如果v:progname=~?“evim”
完成
恩迪夫
“使用Vim设置,而不是Vi设置(更好!)。
“这必须是第一步,因为它会作为副作用改变其他选项。
兼容模式
“激活文件管理器
执行病原体#感染()
“允许在插入模式下对所有内容进行退格
设置退格=缩进、下线、开始
“如果有(“虚拟机”)
“set nobackup”不保留备份文件,而是使用版本
“否则
“设置备份”保留备份文件(还原到以前的版本)
“设置撤消文件”保留撤消文件(关闭后撤消更改)
“endif
设置历史记录=50“保留50行命令行历史记录
“设置标尺”始终显示光标位置
设置showcmd“显示不完整的命令
设置incsearch“执行增量搜索
对于Win32 GUI:从“GUI选项”中删除“t”标志:无tearoff菜单项
“let&guioptions=替换(&guioptions,“t”,“g”)
“不要使用Ex模式,请使用Q进行格式化
地图QGQ
“插入模式下的CTRL-U会删除很多内容。使用CTRL-G u键取消第一次中断,
“以便插入换行符后可以撤消CTRL-U。
inoremap u
“在许多终端模拟器中,鼠标工作正常,因此可以启用它。
如果有('鼠标')
设置鼠标=a
恩迪夫
当终端有颜色时,打开语法高亮显示
“同时打开高亮显示上次使用的搜索模式。
如果&t_Co>2||has(“gui_运行”)
语法高亮
高亮显示
恩迪夫
“仅当在支持自动命令的情况下编译时才执行此部分。
如果有(“自动MD”)
“启用文件类型检测。
使用默认的文件类型设置,使mail的“tw”设置为72,
“'cindent'在C文件等中处于打开状态。
同时加载缩进文件,以自动执行语言相关的缩进。
文件类型插件缩进
“将它们放在autocmd组中,以便我们可以轻松删除它们。
AugroupVimrcex
哎呀!
“对于所有文本文件,将“textwidth”设置为78个字符。
autocmd文件类型文本集本地文本宽度=78
编辑文件时,始终跳转到最后一个已知的光标位置。
“当位置无效或在事件处理程序中时,不要执行此操作
“(在gvim上删除文件时发生)。
autocmd BufReadPost*
\如果linux上的行(“\”)>=1&&line(“\”),则桌面剪贴板是+(quoteplus)寄存器。*(quotestar)表示X11视觉选择,如前所述。所以,试着用“+y
拉拽文本,用“+p
放文本 您必须使用支持X的vim版本。例如,Ubuntu提供了包含gvim的包vim gtk
和支持X的vim版本。您使用的是什么虚拟机?您可以在此处找到帮助:。无论哪种方式,这个问题都更适合,除非你的剪贴板共享在Vim之外运行良好。嗨,Jim,除了我的ubuntu剪贴板运行良好之外,这个问题局限于Vim。我正在使用Virtualbox,但您建议的线程处理windows和我的VM之间的复制和粘贴,这已经在运行(vim除外)。关于vim gnome
?回答得很晚,但您可以运行vim--version
,并检查+剪贴板
(不使用-
!)是否在构建选项中:)