I am new to both nvim (a vim user here), to lua and to lazy.nvim
I just came here, copy pasted what I figured out to be needed and can't get it to work.
~/.config/nvim/init.lua
{
'Wansmer/langmapper.nvim',
lazy = false,
priority = 1, -- High priority is needed if you will use `autoremap()`
config = function()
require('langmapper').setup({
local function escape(str)
-- You need to escape these characters to work correctly
local escape_chars = [[;,."|\]]
return vim.fn.escape(str, escape_chars)
end
-- Recommended to use lua template string
local en = [[`qwertyuiop[]asdfghjkl;'zxcvbnm]]
local ru = [[ёйцукенгшщзхъфывапролджэячсмить]]
local en_shift = [[~QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>]]
local ru_shift = [[ËЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ]]
vim.opt.langmap = vim.fn.join({
-- | `to` should be first | `from` should be second
escape(ru_shift) .. ';' .. escape(en_shift),
escape(ru) .. ';' .. escape(en),
}, ',')
})
end,
},
and in the very end:
require('langmapper').automapping({ global = true, buffer = true })
-- end of init.lua
Using lazy.nvim as a plugin manager. Starting nvim gives me:
E5112: Error while creating lua chunk: ~/.config/nvim/init.lua:248: unexpected symbol near 'local'
248 is: local function escape(str)
I am new to both nvim (a vim user here), to lua and to lazy.nvim I just came here, copy pasted what I figured out to be needed and can't get it to work.
~/.config/nvim/init.lua
and in the very end:
Using lazy.nvim as a plugin manager. Starting nvim gives me:
E5112: Error while creating lua chunk: ~/.config/nvim/init.lua:248: unexpected symbol near 'local'
248 is: local function escape(str)