Vim Ctrl Arrow deletes lines

I often use tmux and vim on a remote development server, so I can work from everywhere without having to set up a specific environment. This works really well, but I had one annoying issue that broke my Vim.

I had the FZF plugin installed for opening files quickly, but when doing ctrl+left or ctrl+right, it would open the FZF thing at the bottom instead of navigating words as you would expect.

It proved quite difficult to find the solution because I did not know it was because of Tmux. That is why I am sharing the solution I found on superuser.com.

What you need to do is edit your ~/.vimrc file and add the following bit of configuration:

if &term =~ '^screen'
    " tmux will send xterm-style keys when its xterm-keys option is on
    execute "set <xUp>=\e[1;*A"
    execute "set <xDown>=\e[1;*B"
    execute "set <xRight>=\e[1;*C"
    execute "set <xLeft>=\e[1;*D"
endif

Then update your ~/.tmux.conf file and add the following line:

set-window-option -g xterm-keys on

Thanks to Chris Johnson for solving the issue on superuser.com