On a Swedish keyboard to the right of the keyboard one has:
O, P, Å
L, Ö, Ä
[ and ] are extensively used by Vim, and hard to reach on my keyboard, so therefore I've mapped these to Ö and Ä in my .vimrc file.
map ö [
map ä ]
I'd like <leader>[, or in reality <leader>ö to move a line up. So I've tried:
" Does not work
nmap <leader>[ :m .+1<CR>==
" Works
nmap <leader>ö :m .+1<CR>==
Note that I don't want to have special characters Ö and Ä in my vimrc file, in order to keep it universal. I've tried different combinations of map, nmap, and nnoremap, without success.
Note that I always want Ö and Ä to be remapped, except for when writing in insert mode. Now I can use them normally in insert mode, which is unexpected.
How should I go about this?
:h 'langmap'? Something likeset langmap=ö[to makeöbehave like[in normal mode and then your mapping should work. (Also unless you know what you are doing, you should use the non recursive version of the mapping commandsnnoremap) – statox May 07 '20 at 09:15set langmap=ö[ä]but didn't work still. Still, this mapping worksnnoremap <leader>ö :m .+1<CR>==, this doesn'tnnoremap <leader>[ :m .+1<CR>==. – Max May 08 '20 at 14:33[]keys requires me to useALT-GR, and they don't work with the leader key. This seems to be related tometakeys sending some key combination that includes anESC, or something similar. Maybe the mappings work, but it's the map to the bracket that messes it up. – Max May 08 '20 at 14:40'langmap'work either... In theory it should work, so I don't know why it doesn't... Is it completely broken? Not very sure how to troubleshoot it either since the translation happens at a fairly low level... Maybe need to increase verbosity to understand what's going on there? – filbranden May 10 '20 at 20:58