سؤال

In a previous post here - vim buffer Trying char-by-char conversion - I was running into a problem when opening up certain files and vim wasn't able to detect the encodings in that file and this was resolved by the solution provided by Ingo.

But after I installed vim's NERDTree plugin, I am running into the same problem again.

It appears that buffer opened by NERDTree mapping map <F2> :NERDTreeToggle<CR> does not obey the :set encoding=utf-8 directive.

I have to manually run :set encoding=utf-8 again in order for the Trying char~by-char conversion... problem to be resolved.

Also, my nerdtree directory shows up with a weird ? instead of the | symbol. Like this:- enter image description here

What am I doing wrong?

هل كانت مفيدة؟

المحلول

I have temporarily solved this problem by mapping

map <F2> :NERDTreeToggle<CR>:set encoding=utf-8<CR>

instead of the original plain

map <F2> :NERDTreeToggle<CR>

However this solution is not good enough as the Trying char~by-char conversion warning still pops up whenever I browse open a specific directory in the NERDTree buffer.

So, I would like to hear if anyone has a better solution! Thanks!

The nerdtree ? character problem was solved by this post - vim - nerdtree suddenly broke

نصائح أخرى

You shouldn't need to do anything: NERDTree doesn't manipulate encoding and encoding is a global option that you set once and for all in your ~/.vimrc. Go back to an almost empty ~/.vimrc and build from that (with encoding and other options).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top