In my local PC I use p in Vim command mode for pasting and it works fine and the :echo has('clipboard') returns 1.

But, in the cluster I am working p in command mode, which just inserts a 0 instead of pasting and echo has('clipboard') returns 0.

I suppose I have to modify my .vimrc file.

I tried:

nnoremap p "0p"



but with no result.


VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 15 2020 16:44:08)
Included patches: 1-207, 209-629
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl             +cscope          +folding         +menu            +netbeans_intg   -sniff           +virtualedit
+arabic          +cursorbind      -footer          +mksession       +path_extra      +startuptime     +visual
+autocmd         +cursorshape     +fork()          +modify_fname    +perl            +statusline      +visualextra
-balloon_eval    +dialog_con      +gettext         +mouse           +persistent_undo -sun_workshop    +viminfo
-browse          +diff            -hangul_input    -mouseshape      +postscript      +syntax          +vreplace
++builtin_terms  +digraphs        +iconv           +mouse_dec       +printer         +tag_binary      +wildignore
+byte_offset     -dnd             +insert_expand   +mouse_gpm       +profile         +tag_old_static  +wildmenu
+cindent         -ebcdic          +jumplist        -mouse_jsbterm   +python/dyn      -tag_any_white   +windows
-clientserver    +emacs_tags      +keymap          +mouse_netterm   -python3         -tcl             +writebackup
-clipboard       +eval            +langmap         +mouse_sgr       +quickfix        +terminfo        -X11
+cmdline_compl   +ex_extra        +libcall         -mouse_sysmouse  +reltime         +termresponse    -xfontset
+cmdline_hist    +extra_search    +linebreak       +mouse_urxvt     +rightleft       +textobjects     -xim
+cmdline_info    +farsi           +lispindent      +mouse_xterm     +ruby/dyn        +title           -xsmp
+comments        +file_in_path    +listcmds        +multi_byte      +scrollbind      -toolbar         -xterm_clipboard
+conceal         +find_in_path    +localmap        +multi_lang      +signs           +user_commands   -xterm_save
+cryptv          +float           -lua             -mzscheme        +smartindent     +vertsplit       -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-strong --param=s
sp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D__linux__ -D_REENT
Linking: gcc   -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-rpath,/usr
/lib64/perl5/CORE  -Wl,-z,relro  -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux  -lncurses -lacl
-lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/COR
E -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc

I modified my .vimrc file as follows according to the comments:

set number
set shiftwidth=4
set clipboard=unnamed 
nnoremap p "*p nnoremap p <cmd>r !xclip -o -selection clipboard<CR> 

But, now p does nothing. I want p to paste.

  • Please edit and add the output of :version to your question. The clipboard feature is something that's compiled in - or not. My guess is your cluster has a minimal version of Vim installed.
    – Friedrich
    Dec 29, 2023 at 15:52
  • So in your cluster, your Vim does not have acess to the system clipboard. And even if it had, it would be hard to access your system clipboard from your cluster (it may work using ssh -X or similar). However I suppose your actual problem is getting your system clipboard accessible from within your cluster. That is not a Vim problem however. Dec 29, 2023 at 15:57
  • @Friedrich done. Dec 29, 2023 at 16:47
  • Thanks for updating. Note how it says -clipboard and "HUGE version without GUI". I'd try and install a GUI version. On your local PC, you probably have a GUI version with +clipboard. On a side note: 7.4 from ten years ago? We're using Vim 9 these days.
    – Friedrich
    Dec 29, 2023 at 16:50
  • Yes, you are right about + and - clipboard. Thanks a lot. The version of vim is provided in a cluster by the institution I work for. Dec 29, 2023 at 17:09

1 Answer 1


My understanding of the 'clipboard' feature is that: It synchronizes:

  • The + register and the system clipboard
  • The * register and the selection clipboard (On Windows there are the same)


  • When the 'clipboard' option is set to unnamed the * is the default register to yank (copy) and put (paste)
:set clipboard=unnamed
  • When the 'clipboard' option is set to unnamedplus the + is the default register to yank (copy) and put (paste)
:set clipboard=unnamedplus

You can use an external program (e.g. xclip) to read the content of the clipboard and insert it into your text:

nnoremap p <cmd>r !xclip -o -selection clipboard<CR>

You could be interested by the following questions:

  • You're talking about the 'clipboard' option while OP is asking about the +clipboard feature.
    – Friedrich
    Dec 29, 2023 at 15:57
  • 1
    My intention was to describe both but my text was confused (and actually wrong). I have made a new version. I believe it is more correct. Dec 29, 2023 at 16:00
  • Looks good. I doubt OP's problem can be fixed from within Vim but let's see if it helps.
    – Friedrich
    Dec 29, 2023 at 16:06
  • Hello, i modified my .vimrc file as follows set number 2 set shiftwidth=4 3 4 5 set clipboard=unnamed 6 nnoremap p "*p 7 nnoremap p <cmd>r !xclip -o -selection clipboard<CR> Dec 29, 2023 at 16:58
  • Hello, i modified my .vimrc file as follows set number set shiftwidth=4 set clipboard=unnamed nnoremap p "*p nnoremap p <cmd>r !xclip -o -selection clipboard<CR> But , now p do nothing. Thanks for the help. @VivianDeSmedt Dec 29, 2023 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.