Hot answers tagged

42 votes
Accepted

Can the split separator in vim be less than a full column wide?

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 ...
  • 35.1k
21 votes
Accepted

How to label tmux tabs with the name of the file edited in vim?

There you go : autocmd BufReadPost,FileReadPost,BufNewFile,BufEnter * call system("tmux rename-window 'vim | " . expand("%:t") . "'") Decomposing : autocmd BufReadPost,FileReadPost,BufNewFile,...
  • 15.5k
20 votes
Accepted

Tmux is changing part of the background in vim

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 ...
13 votes
Accepted

No syntax highlighting in tmux

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 -...
  • 465
13 votes
Accepted

Separate C-m and Enter

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 ...
  • 29.9k
12 votes
Accepted

Mouse wheel scrolling inserts characters

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&...
  • 393
12 votes
Accepted

Cursor shape under vim + tmux

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 ...
  • 236
9 votes
Accepted

Sending command to different tmux pane from vim

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 ...
  • 18.9k
8 votes

No syntax highlighting in tmux

From the vim manual: :h termguicolors recommends reading :h xterm-true-color, also see :h $TERM Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f| and |t_8b| options ...
  • 136
8 votes

Change cursor shape in different terminals

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 ...
  • 29.9k
7 votes

Pasting text on Vim inside tmux breaks indentation

Manually toggling :set paste/:set nopaste as suggested by francois P is cumbersome, and resetting the TERM variable as evaristegd suggests is a very bad idea as explained in the comments (which hint ...
7 votes
Accepted

Does Vim have functionality similar to tmux's `display-panes` command for selecting (goto) a specific window by number?

I'm not aware of any Vim feature or even plugin that does that; in fact, up until recently it would be rather hard to display it like that, but with Vim 8.2's popup windows it wouldn't be too hard; ...
6 votes
Accepted

Tmux messing with Vim highlighting

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; ...
  • 786
6 votes

Can the split separator in vim be less than a full column wide?

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 ...
  • 2,175
6 votes

Running code in a different tmux pane

The run-shell example you mention looks identical to that in my 'Unix & Linux' post on this topic so you may have read that. If so, at the very end I mention use of a mapping to prevent external ...
  • 18.9k
5 votes

No syntax highlighting in tmux

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 ...
  • 581
5 votes

Can the split separator in vim be less than a full column wide?

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 ...
  • 17.2k
5 votes

Vim, tmux, and xterm-bracketed-paste

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&...
5 votes
Accepted

How to activate bracketed paste mode in GNOME Terminal for Vim inside tmux

It is even supposed to be by default in Vim 8. Only if Vim thinks the terminal is xterm-compatible, which is the case if TERM is xterm or some derivative. If TERM is gnome, Vim won't enable the ...
  • 5,657
4 votes

Cursor shape under vim + tmux

The correct value of $TERM environments variable is very important. Make sure that it is different from screen-256color. Set it to xterm-256color for example.
  • 1,039
4 votes
Accepted

Truecolor (termguicolors) causes display issues in Tmux

Turns out this was a bug in Vim itself. The problem is resolved as of Vim 7.4.1942.
  • 181
4 votes

How to label tmux tabs with the name of the file edited in vim?

To restore the default tmux naming scheme when quitting vim you can also do: autocmd VimLeave * call system("tmux setw automatic-rename")
  • 41
4 votes

Send message to tmux properly

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 ...
  • 81
4 votes
Accepted

Why isn't vim applying syntax highlighting to this code?

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 ...
4 votes
Accepted

Send file and line number to tmux

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....
  • 18.9k
4 votes

Sending command to different tmux pane from vim

Uploaded my personal config tvp-repl Copy from one pane with Ctrl+c and paste to another (requires xclip) vim with +clipboard, .vimrc: set clipboard=unnamedplus vnoremap <C-c> "+y tmux ...
4 votes
Accepted

Nvim can not detect focus change inside tmux sessions

I opened an issue on Neovim repo and get the right answer. We need to turn on the focus-events for tmux. Edit the tmux config file ~/.tmux.conf and add the following setting: set -g focus-events on ...
  • 945
4 votes
Accepted

Cannot send `--` into tmux panes from vim

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 . "\""...
  • 8,817
4 votes

Running code in a different tmux pane

If you build tmux from Git master you can send the output to an empty pane, for example: mybuildcommand|tmux splitw -dI -c/my/source/directory I don't know how to stop vim hiding the code while this ...
4 votes
Accepted

Change Neovim cursor in insert mode under st (simple terminal) and tmux

You need to tell Tmux how to translate the control sequences sent by Nvim to the outer terminal, here st. This is done by setting the unofficial extensions to terminfo Ss and Se. From man tmux: Ss, ...
  • 5,657

Only top scored, non community-wiki answers of a minimum length are eligible