]> git.phdru.name Git - dotfiles.git/commitdiff
.vimrc: Set universal encoding for .viminfo
authorOleg Broytman <phd@phdru.name>
Thu, 9 May 2019 17:38:46 +0000 (20:38 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 9 May 2019 17:43:25 +0000 (20:43 +0300)
Set encoding in autocmd `VimLeavePre` for `.viminfo`.

.vimrc

diff --git a/.vimrc b/.vimrc
index d06404d6e4496ca27ba23b41dc4a352d73292b25..b25ff63f9d891c1088edfe5d6110d9e1c475dea6 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -785,5 +785,15 @@ command! UName Uname
 endif
 " ----------
 
 endif
 " ----------
 
+if has("iconv")
+function! SetViminfoEncoding()
+   " Set universal encoding for .viminfo
+   if &encoding != 'utf-8'
+      set encoding=utf-8
+   endif
+endfunction
+autocmd VimLeavePre * call SetViminfoEncoding()
+endif
+
 " This has to go to the very end of ~/.vimrc to allow reading the .vimrc
 set secure        " safer working with script files in the current directory
 " This has to go to the very end of ~/.vimrc to allow reading the .vimrc
 set secure        " safer working with script files in the current directory