From c2e9618887427c8728b11b636c814d05044ff310 Mon Sep 17 00:00:00 2001 From: Von Random Date: Fri, 19 Jun 2015 18:33:36 +0300 Subject: [PATCH] set vim encoding conditionally --- vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index b6d8aa5..24d8657 100644 --- a/vimrc +++ b/vimrc @@ -15,8 +15,6 @@ set showcmd set smartcase set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc -set termencoding=utf-8 -set encoding=utf-8 " scroll before reaching the first / final line set scrolloff=8 set sidescrolloff=15 @@ -28,6 +26,10 @@ set noerrorbells visualbell t_vb= if $TERM == 'xterm' || $TERM == 'screen' || exists("$SSH_CLIENT") let &t_Co=256 endif +if $LANG =~ '^.*UTF-8$' || $LANG =~ 'utf8$' + set termencoding=utf-8 + set encoding=utf-8 +endif " insert shebang in the beginning of the file based on its name extension autocmd BufNewFile *.zsh 0put =\"#!/usr/bin/env zsh\\"|$