从 VIM 编辑器复制到剪贴板在 CentOS 6 上不起作用?

从 VIM 编辑器复制到剪贴板在 CentOS 6 上不起作用?

我使用的是 CentOS 6(Gnome 桌面环境),我尝试通过使用编辑器打开 .txt 文件vim并将该文本粘贴到终端/命令行中来复制 URL,因为我需要它作为命令。

简单地按下"*dd不会将文本复制到剪贴板内存中,而是会播放错误鼓声。我只想依靠键盘,而不是鼠标,可以吗?


编辑1

如您所见,我clipboard的.我应该怎么做才能激活这些功能?xterm_clipboardvim

[dolly@centos Economics]$ vim --version | grep -i clipboard
-clipboard       +iconv           +path_extra      -toolbar
+eval            +mouse_dec       +startuptime     -xterm_clipboard
[dolly@centos Economics]$ 

编辑2

这是完整的输出vim 安装vim-X11

[dolly@centos Economics]$ vi --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 21 2016 17:06:34)
Included patches: 1-207, 209-629
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
-clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -Wl,-E -Wl,-rpath,/usr/lib/perl5/CORE   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux  -ltinfo -lacl -lattr -lgpm   -Wl,-E -Wl,-rpath,/usr/lib/perl5/CORE  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc       
[dolly@centos Economics]$ 

编辑3

[dolly@centos vim-master]$ sudo ./configure --with-features=normal --with-x --enable-gui
[sudo] password for dolly: 
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for library containing strerror... none required
checking for gawk... gawk
checking for strip... strip
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking --enable-fail-if-missing argument... no
checking for clang version... N/A
configure: checking for buggy tools...
- sh is 'GNU bash, version 4.1.2(2)-release (i386-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.' - probably OK.
- sed is    'GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.'.
checking for BeOS... no
checking for QNX... no
checking for Darwin (Mac OS X)... no
checking AvailabilityMacros.h usability... no
checking AvailabilityMacros.h presence... no
checking for AvailabilityMacros.h... no
checking --with-local-dir argument... Defaulting to /usr/local
checking --with-vim-name argument... Defaulting to vim
checking --with-ex-name argument... Defaulting to ex
checking --with-view-name argument... Defaulting to view
checking --with-global-runtime argument... no
checking --with-modified-by argument... no
checking if character set is EBCDIC... no
checking --disable-smack argument... no
checking linux/xattr.h usability... yes
checking linux/xattr.h presence... yes
checking for linux/xattr.h... yes
checking attr/xattr.h usability... no
checking attr/xattr.h presence... no
checking for attr/xattr.h... no
checking --disable-selinux argument... no
checking for is_selinux_enabled in -lselinux... no
checking --with-features argument... normal
checking --with-compiledby argument... no
checking --disable-xsmp argument... no
checking --disable-xsmp-interact argument... no
checking --enable-luainterp argument... no
checking --enable-mzschemeinterp argument... no
checking --enable-perlinterp argument... no
checking --enable-pythoninterp argument... no
checking --enable-python3interp argument... no
checking --enable-tclinterp argument... no
checking --enable-rubyinterp argument... no
checking --enable-cscope argument... no
checking --enable-workshop argument... no
checking --disable-netbeans argument... no
checking --disable-channel argument... no
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... yes
checking whether compiling with process communication is possible... yes
checking --enable-terminal argument... defaulting to no
checking --enable-autoservername argument... no
checking --enable-multibyte argument... no
checking --enable-hangulinput argument... no
checking --enable-xim argument... defaulting to auto
checking --enable-fontset argument... no
checking for xmkmf... no
checking for X... no
checking if X11 header files can be found... no
checking --enable-gui argument... no GUI support
checking X11/SM/SMlib.h usability... no
checking X11/SM/SMlib.h presence... no
checking for X11/SM/SMlib.h... no
checking for /proc link to executable... /proc/self/exe
checking for CYGWIN or MSYS environment... no
checking whether toupper is broken... no
checking whether __DATE__ and __TIME__ work... yes
checking whether __attribute__((unused)) is allowed... yes
checking elf.h usability... yes
checking elf.h presence... yes
checking for elf.h... yes
checking for main in -lelf... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking stdint.h usability... yes
checking stdint.h presence... yes
checking for stdint.h... yes
checking stdlib.h usability... yes
checking stdlib.h presence... yes
checking for stdlib.h... yes
checking string.h usability... yes
checking string.h presence... yes
checking for string.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking termcap.h usability... no
checking termcap.h presence... no
checking for termcap.h... no
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sgtty.h usability... yes
checking sgtty.h presence... yes
checking for sgtty.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/types.h usability... yes
checking sys/types.h presence... yes
checking for sys/types.h... yes
checking termio.h usability... yes
checking termio.h presence... yes
checking for termio.h... yes
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking inttypes.h usability... yes
checking inttypes.h presence... yes
checking for inttypes.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking unistd.h usability... yes
checking unistd.h presence... yes
checking for unistd.h... yes
checking stropts.h usability... no
checking stropts.h presence... no
checking for stropts.h... no
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/systeminfo.h usability... no
checking sys/systeminfo.h presence... no
checking for sys/systeminfo.h... no
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking sys/stream.h usability... no
checking sys/stream.h presence... no
checking for sys/stream.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking libc.h usability... no
checking libc.h presence... no
checking for libc.h... no
checking sys/statfs.h usability... yes
checking sys/statfs.h presence... yes
checking for sys/statfs.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking util/debug.h usability... no
checking util/debug.h presence... no
checking for util/debug.h... no
checking util/msg18n.h usability... no
checking util/msg18n.h presence... no
checking for util/msg18n.h... no
checking frame.h usability... no
checking frame.h presence... no
checking for frame.h... no
checking sys/acl.h usability... no
checking sys/acl.h presence... no
checking for sys/acl.h... no
checking sys/access.h usability... no
checking sys/access.h presence... no
checking for sys/access.h... no
checking sys/sysinfo.h usability... yes
checking sys/sysinfo.h presence... yes
checking for sys/sysinfo.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for sys/ptem.h... no
checking for sys/sysctl.h... yes
checking for pthread_np.h... no
checking strings.h usability... yes
checking strings.h presence... yes
checking for strings.h... yes
checking if strings.h can be included after string.h... yes
checking whether gcc needs -traditional... no
checking for an ANSI C-conforming const... yes
checking for working volatile... yes
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uid_t in sys/types.h... yes
checking for uint32_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for ino_t... yes
checking for dev_t... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for rlim_t... yes
checking for stack_t... yes
checking whether stack_t has an ss_base field... no
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.
[dolly@centos vim-master]$ 

“pip install neovim”出现错误

内容如下sudo pip install neovim 2> neovim-error.txt

DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lpARIW/greenlet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-b4twTs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lpARIW/greenlet/

答案1

您需要+xterm_clipboard版本信息中的 ,而不是-xterm_clipboard.我认为你需要安装vim-gui-common来解决这个问题,然后你可以拉入寄存器*,例如"*yy"将一行拉入剪贴板。

然而,我认为这里有一个案例neovim。它的目标之一是在发布时启用所有功能,因此您不必执行所有这些配置并安装/编译各个功能。也许在这种情况下它对你有用。

答案2

安装vim-X11软件包或从源代码编译 vim 并xterm_clipboard支持如下所示回答。

然后你需要使用"+dd删除并将其复制到寄存器中x clipboard

最后,我最终这样做了:

#!/bin/bash
sudo yum install yum-utils
sudo yum-builddep vim-X11
sudo yum install libX11 libX11-devel libXtst libXtst-devel \
                  perl-ExtUtils-Embed xclip xsel
cd ~/packages
git clone https://github.com/vim/vim.git --depth 1
cd vim
make distclean
./configure --with-features=huge \
            --with-x \
            --enable-cscope \
            --enable-gui \
            --enable-luainterp=yes \
            --enable-multibyte \
            --enable-perlinterp=yes \
            --enable-pythoninterp=yes \
            --enable-python3interp=yes \
            --enable-rubyinterp=yes \
            --prefix=/usr
sudo make install

相关内容