I have made several changes to my .vimrc
file, which includes several vim-plug plugins, some syntax/coloring options and some key mappings.
Whenever I open a new Vim session however, not all of these are being applied (most notably coloring and syntax highlighting). If I run :so ~/.vimrc
the file gets sourced and the changes apply immediately. Obiously I don't want to have to do this every time I start vim.
Why are these changes not being applied automatically? (This is after a complete restart and new terminal/vim session).
Update
I've discovered this is related to tmux. When I run vim
straight from terminal, .vimrc
is applied as expected. If I run vim
from inside a tmux
session, then I have to manually source the file every time.
Any ideas how to solve this?
~/.vimrc
contents:
" PLUGINS - see vim-plug
call plug#begin()
Plug 'crusoexia/vim-monokai'
Plug 'pangloss/vim-javascript'
Plug 'crusoexia/vim-javascript-lib'
call plug#end()
" Enable Monokai colors
syntax on
colorscheme monokai
set t_Co=256
" Easy tab movement with keys 1|2
nmap 1 :tabp <enter>
nmap 2 :tabn <enter>
" Line Numbers
set number
" 2 space tabs
set tabstop=8 softtabstop=2 expandtab shiftwidth=2 smarttab
In my case, tmux was overriding the TERM
value until .vimrc
was sourced.
Running echo $TERM
in a regular shell gave xterm-256color
, whereas running it in tmux gave screen
.
The solution was to explicitly export the desired TERM
value:
export TERM="xterm-256color"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With