only on osx (not on Ubuntu ) when I hightlight text while in a terminal ( iterm2 3.4.8 ) vim shows some kind of notice saying


and then across top of terminal a banner appears saying

Looks like you're trying to copy to the pastboard, but mouse reporting has prevented making a selection: Disable mouse reporting?

Problem is no matter how I answer that interactive prompt even when picking Permanent next time I open a terminal and repeat I again get this issue

I never want any visual assist simply need ability to highlight text so I can copy into clipboard to paste outside of that terminal ... this just works on Ubuntu when on linux my ~/.vimrc appears as

unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim

set ts=4
set ic

syntax on

"  to shut off paste indent
se paste

" how to disable mouse cursor paste location
" https://unix.stackexchange.com/questions/44513/disabling-mouse-support-in-vim-in-a-gnome-terminal-environment

" set mouse=
" set ttymouse=

"  If this does not work, a common problem is not having ownership of your ~/.viminfo file. If this is the case, then sudo chown user:group ~/.viminfo
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

So essentially I am looking for the osx equivalent to the above ~/.vimrc ( above works on Ubuntu )

Here is my vim version on osx 11.4

vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May  8 2021 05:44:12)
macOS version
Included patches: 1-2029
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
-arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      -mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        -termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
-balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            -gettext           +netbeans_intg     +termresponse
+builtin_terms     -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           -ipv6              -perl              +title
-clientserver      +job               +persistent_undo   -toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     -keymap            +postscript        -vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      -langmap           -profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
-conceal           +linebreak         -python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          -rightleft         +wildignore
+cursorshape       -lua               +ruby/dyn          +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
-emacs_tags        -mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      -mouse_netterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa
  • this message does not come from Vim. Perhaps from your terminal emulator? Jun 21 '21 at 12:29
  • It looks like you found a solution, please don't put it in your question but instead add an answer to your question and mark it as approved so that it's easier for future reader to find it.
    – statox
    Jun 21 '21 at 13:31

env var VIMRUNTIME is not defined on osx ( it is defined on Ubuntu ) so below seems to be the fix on osx

edit ~/.vimrc

old bad

source $VIMRUNTIME/defaults.vim

good new

source /usr/share/vim/vim82/defaults.vim

the balance of the content of ~/.vimrc appears in question

  • 1
    This is a bit misleading: $VIMRUNTIME is defined on macos when vim is running. But it is not exported by any shell files. So it is only present in vim and its subprocesses. There is probably something else wrong if $VIMRUNTIME is not being set. (:help $VIMRUNTIME.) But if you just want to portably load defaults.vim, use :runtime defaults.vim.
    – D. Ben Knoble
    Jun 21 '21 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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