How to disable mouse support in terminal?

You can hold the Shift key to use the normal mouse selection while xterm mouse-tracking is enabled. That works in all terminal emulators that I know (xterm, vte (like xfce-terminal) or rxvt-based ones).

In vim specifically, mouse is normally not enabled by default in terminals. So there's probably a set mouse=a somewhere in you ~/.vimrc or your OS-supplied system vimrc. You can always add:

set mouse=

to your ~/.vimrc to disable it. Or:

if !has("gui_running")
  set mouse=
endif

to avoid disabling it for the GUI versions of vim.

Mouse support is (sort of) advertised in the terminfo database with the kmous capability. Now, not all applications rely on that to decide whether to enable mouse tracking or not.

You could redefine the entry for your terminal (in a local terminfo database) to remove that capability:

infocmp -1x | grep -v kmous= | TERMINFO=~/.terminfo tic -x -
export TERMINFO=~/.terminfo

For applications using ncurses, it's enough to set the XM user-defined capability (not documented in terminfo(5) but mentioned in curs_caps(5) and curs_mouse(3)) to the empty string. That doesn't prevent the application from handling mouse events if they're sent by the terminal, but that prevents the application from sending the sequence that enters the mouse tracking mode. So you can combine both with:

infocmp -1x |
  sed '/kmous=/d;/XM=/d;$s/$/XM=,/' |
  TERMINFO=~/.terminfo tic -x -
export TERMINFO=~/.terminfo