local map = function(key) -- get the extra options local opts = {noremap = true} for i, v in pairs(key) do if type(i) == 'string' then opts[i] = v end end -- basic support for buffer-scoped keybindings local buffer = opts.buffer opts.buffer = nil if buffer then vim.api.nvim_buf_set_keymap(0, key[1], key[2], key[3], opts) else vim.api.nvim_set_keymap(key[1], key[2], key[3], opts) end end -- search for visual selection map {'v', '//', 'y/"'} map {'n', 'H', '^'} -- ex command map {'c', '', ''} map {'c', '', ''} -- auto expand brackets map {'i', '(;', '()O'} map {'i', '(,', '(),O'} map {'i', '{;', '{}O'} map {'i', '{,', '{},O'} map {'i', '[;', '[]O'} map {'i', '[,', '[],O'} -- toggle hybrid mode map {'n', 'h', ':set rnu!'} -- nvim-tree.lua map {'n', 'e', ':NvimTreeToggle'} -- Telescope map {'n', '', 'Telescope buffers'} map {'n', 'f', 'Telescope find_files'} map {'n', 'l', 'Telescope live_grep'} map {'n', ' gy', 'Telescope treesitter'} -- neo formatter map {'n', 'p', ':Neoformat'} -- goyo mapping map {'n', ' w', ':Goyo'} -- spelling map {'n', ' se', ':set spell spelllang=en'} map {'n', ' sd', ':set spell spelllang=de'}