Tag Info

You are wrong about tmux. Like every terminal-based program — including Vim — it only draws stuff inside cells. This means that Vim and tmux both use the same method to draw vertical borders: they just use a pipe-like character.
Tmux uses │ (U+2502) by default while Vim uses | (U+007C).
If you want the same separator in Vim, you can simply use the same ...

You might try to add the following to your .vimrc.
if &term =~ '256color'
" disable Background Color Erase (BCE)
set t_ut=
endif
The t_ut option (default = y) describes how vim handles what it wants as background colors compared to attempting to use the current background color. This snippet clears that option.
If not, then you might try to
set ...

It seems the problem is that tmux doesn't send your cursor-changing escape codes to the terminal emulator. You need to wrap your desired escape codes in a special sequence that tells tmux that it should pass it on to the outer terminal.
The sequence you need to wrap your escape sequence in is \<Esc>Ptmux;\<Esc> ... \<Esc>\\(Source). The ......

Ah, I found the culprit by bisecting my .vimrc file. I had mapped Escape in normal mode to clear search highlighting:
" Clear highlighting on escape in normal mode
nnoremap <esc> :noh<return><esc>
However, that will confuse vim as it tries to parse the mouse's escape codes. So what I ended up doing is taking the solution from this answer, ...

Well, I solved the problem by myself.
as @Carpetsmoker♦ commented, I started to suspect that my .vimrc is a problem. I read this question and started vim with this command inside tmux.
vim -u NONE -U NONE -N ~/.vimrc
After starting vim with command above, I ran this command inside vim.
:syn on
:colorscheme solarized8_dark
These highlighted my .vimrc ...

As of November 2017, all the terminals you are using support the same DECSCUSR escape sequences for changing the cursor shape1. So you don't need to test for the different terminals.
As such, the only thing that requires different treatment is tmux, which will only forward escape sequences on to the terminal when surrounded by a DCS sequence. You already ...

As far as Vim is concerned, <C-M> and <CR> are the same thing: they are represented in the same way internally.
If your terminal is truly sending different keycodes (mine doesn't) for when you press Ctrl-M vs Enter, then you might be able to map them separately by using their literal values when you set up the mappings.
Replace the following in ...

Even in my own screen-shot, tmux is not using any magic, the split is still a single character wide column. The less obtrusive visual effect is the use of a Unicode box drawing character that is less clunky than vim's ASCII default, and the lack of a highlight background color.
Very nearly the same effect is possible in vim by adding something like the ...

To send to another pane you'll need to call tmux from Vim. Specifically, you'll need the send-keys command (alias: send). For example, this will cause the current line number in Vim to be printed to the terminal in pane 2 using echo:
:exe "!tmux send -t 2 'echo " . line(".") . "' Enter"
Applying the same form to your command:
:exe "!tmux send -t 2 'behave ...

Add this line to your tmux.conf file
set -g default-terminal "screen-256color"
Add the line below to you shells rc file in my case its my .zshrc
if [[ $TERM == xterm ]]; then TERM=xterm-256color; fi
Add the line below to your .vimrc
set t_Co=256
The above configuration works for me, but if this fails try to follow this link for another methor to fix ...

No, this cannot be done in Vim, and would probably be very hard to implement in GVIM.
Vim sticks to the cell-based addressing used in the terminal; within a buffer, this is crucial for consistent vertical navigation with j / k. This addressing by cell-based x and y coordinates is so ingrained in Vim's implementation, I guess it's very hard to overcome.
...

Adding t_Co=256 to your vimrc should never be necessarily, save for some highly unusual and archaic situations. It's typically a sign that something else is set up wrong.
By far the most common problem is a wrong TERM environment variable. You mentioned tmux, try using screen-256color, which should be the correct TERM for tmux. This is typically set in your ...

Here's an example of inserting line number in a shell command:
:exe "!echo " . line(".")
So your mapping would be something like this:
nnoremap <silent> <leader>ef :exe "!tmux send -t 0.1 'mix test %:p:" . line(".") . "' Enter"<CR><C-L>
I run tmux so I was able to test that the command appeared in a tmux pane (though I can't ...

Looks more like a shell related question than a Vim related question. I would try the following (not tested, so might be wrong):
silent execute "!tmux send-keys -t " . _count . " -- \"" . text . "\""
Add a -- before the text. Most Unix commands stop option processing as soon as they see a -- and everything after it is handled as parameter.

After messing around a bit more and looking over some stuff I was able to get this to work by wrapping the external command and its parameters in an execute command then using the bar to send the redraw command.
:execute "silent !tmux send -t 0.1 'ruby test.rb' Enter" | :redraw!

From the vim manual: :h termguicolors recommends reading :h xterm-true-color
Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f|
and |t_8b| options explicitly. [ ... these are] only set [to some default] when `$TERM` is `xterm`.
I use a condition similar to the below:
if &term =~# '256color' && ( &term =~# '^...

I actually made it work just fine with termguicolors. This is what I did
1. in my ~/.bash_profile i put this:
export TERM=xterm-256color
and inside my ~/.vimrc I had this
syntax enable
colorscheme Spacegray
set termguicolors
and it worked perfectly! reference

The reason why Ctrl-Home and Ctrl-End don't work for Vim inside of Tmux is because Tmux eats those inputs.
To fix this you need to unbind the affected keys in your Tmux config wich is located at ~/.tmux.conf
To unbind a key
unbind-key -[key]
So for your example:
unbind-key C-Home
unbind-key C-End

Vim is able to use the same completion database if the database is external to each vim instance.
For example, completion will be somewhat 'shared' if you use ctags completion or youcompleteme or any other plugin that uses external processes or files.
Word completion is not quite useful for you because it will only use words in the same file: C-N/C-P
But ...

Term creates new terminals with
TERM=screen-256color
Put this in your .bashrc to fix the issue
export TERM=xterm-256color
EDIT:
As pointed out in the comments, you should probably run echo $TERM when you are not in tmux, then set export TERM= to whatever the output of echo was.

You can use Gbrowse! to get the url copied into the clipboard and then either paste it in the local browser or fire another :!ssh command from the remote machine to the local machine, like (from vim in the ssh session)
:Gbrowse! | exe "!ssh $LOCAL 'nohup google-chrome " . @+ . "' &"
change google-chrome to other browsers or xdg-open to use the default ...

This is obviously an opiniated question. Here's my opinion.
Advantages of neovim (or Vim) terminal:
Normal mode gives the power of Vim inside a terminal window
Can use vimscript to customize mappings and commands
Advantages of tmux:
Allows persistent sessions
IMHO this is the most important aspect of tmux, because:
It allows to detach a session, then ...

I have this in my .vimrc, which works when running tmux in gnome-terminal
if &term =~ '^tmux'
let &t_BE="\<Esc>[?2004h"
let &t_BD="\<Esc>[?2004l"
let &t_PS="\<Esc>[200~"
let &t_PE="\<Esc>[201~"
endif
Terminal in tmux is set to tmux-256color; fragment from ~/.tmux.conf:
set -g default-terminal tmux-...

As D. Ben Knoble said in his comment, "you haven't left the buffer or entered insert mode when you switch, so it makes sense those don't trigger.
And the help for FocusGained / Lost says: "Only for the GUI version and a few console versions where this can be detected." I guess the console never lost/gained focus as you switch tmux panes. So even if the ...