local function escape(str) local escape_chars = [[;,."|\]] return vim.fn.escape(str, escape_chars) end local en_shift = [[~QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>]] local ru_shift = [[ËЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ]] local en = [[`qwertyuiop[]asdfghjkl;'zxcvbnm]] local ru = [[ёйцукенгшщзхъфывапролджэячсмить]] vim.opt.langmap = vim.fn.join({ escape(ru_shift) .. ';' .. escape(en_shift), escape(ru) .. ';' .. escape(en), }, ',') vim.o.timeout = false -- Key mapping local map = vim.api.nvim_set_keymap -- Configuration fast editing. local opts = {nowait=true, silent = true} map('n', '\\rconf', ':source $HOME/lib/nvim/init.lua\n', opts) map('n', '\\econf', ':e $HOME/lib/nvim/init.lua\n', opts) map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts) map('n', '\\ic', ':set ic!\n', opts) map('n', '', 'o', opts) -- Quit map('n', '\\q', ":quit\n", opts) map('n', '\\qa', ":qa\n", opts) -- Moving around. map('n', '\\home', ":cd $HOME\n", opts) map('n', '\\cd', ":cd ", {silent = false}) map('n', '\\lcd', ":lcd ", {silent = false}) map('n', '\\tcd', ":tcd ", {silent = false}) map('n', '\\pwd', ':pwd\n', {silent = false}) map('n', '\\aa', ':argadd ', {silent = false}) map('n', '\\bb', ':b ', {silent = false}) map('n', '\\b#', ':b#\n ', {silent = true}) map('n', '\\lex', ":Lexplore\n", opts) map('n', '\\ex', ":Explore\n", opts) -- Literal tabs with Shift-Tab map('i', '', '', opts) map('n', '', 'hx', opts) map('n', 'gp', '`[v`]', opts) -- Search map('n', '\\noh', ':noh\n', opts) map('n', '', 'i', opts) -- Tabs. map('n', '\\tn', ':tabnew\n', opts) map('n', '\\tc', ':tabnew terminal', opts) -- Fold map('n', '<2-LeftMouse>', 'za', opts) -- Insert -- Empty map('n', '', '', opts) -- Help. map('n', '\\th', ":tab help ", {silent=false}) map("t", "", "", opts) -- vim.api.nvim_del_keymap('n', '') -- vim.api.nvim_del_keymap('n', '') -- Windows -- Moving --map('n', '', '', opts) --map('n', '', '', opts) opts = {silent = true} map('n', '', 'l', opts) map('n', '', 'h', opts) map('n', '', 'k', opts) map('n', '', 'j', opts) map('n', '~.', '~l', opts) map('n', '', '', opts) map('n', '', '', opts) map('n', 'gl', 'l', opts) map('n', 'gh', 'h', opts) map('n', 'gk', 'k', opts) map('n', 'gj', 'j', opts) -- Resizing map('n', '+', '+', opts) map('n', '-', '-', opts) -- map('n', '', '3<', opts) -- map('n', '', '3>', opts) map('n', '', '3>', opts) map('n', '', '3<', opts) -- Splitting map('n', '\\|', 'v', opts) map('n', '\\-', 's', opts) -- Move map('n', 'L', '$', opts) map('n', 'H', '^', opts) -- Netrw vim.api.nvim_create_autocmd('filetype', { pattern = 'netrw', callback = function() local buf = vim.api.nvim_get_current_buf() vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts) end, })