1

I am using a non us keyboard layout. I would like to map "j" to Turkish "ü" character, but also "k" to "j" since it is more convenient and natural for me. (I know this may be bad in the long run etc., but I have decided to do that)

I have put in my .vimrc file following commands

set encoding=utf-8  " The encoding displayed.
set fileencoding=utf-8  " The encoding written to file.

nnoremap ü k
nnoremap k j

k works as expected, however "ü" does not work. "ü" generally stucks after moving two lines above the current line.

To see if the problem is related to non ascii character, I also tried to exchange "j" and "k" via

nnoremap j k
nnoremap k j

I also tried following via enterin Ctrl-V up/down arrows

nnoremap j <Up>
nnoremap k <Down> 

but I have seen the same behaviour. I presume the problem is not relevant to being utf-8 but I still wanted to point out in the question.

Any help much appreciated.

  • 1
    So do I get you right in that the swapping of j and k also does not work? That would be really strange. How exactly do these maps then behave? Does this also happen with a minimal vimrc; i.e. no other stuff in there? Which Vim version? Do any mappings work correctly? – Ingo Karkat Dec 20 '19 at 7:20
  • 1
    You don't need :set fileencoding in your .vimrc; this is a buffer-local setting and will be set automatically based on the detected file encoding. You could place scriptencoding utf-8 after the set encoding=utf-8, but I doubt that it'll be necessary. – Ingo Karkat Dec 20 '19 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.