title: Defining Keybindings in Lua ```lua vim.keymap.set('i', '', function() print("hello world") end, {expr = true}) ``` or ```lua vim.keymap.set('n', '\hello', "ihello") ``` Basically the third argument can be either a lua function, or a string. If a string, it is executed as if [vimscript](/editor/vim/vimscript). See [neovim docs](https://neovim.io/doc/user/lua.html) and in particular nvim_set_keymap() for more. In short: ``` -- Map to a Lua function: vim.keymap.set('n', 'lhs', function() print("real lua function") end) -- Map to multiple modes: vim.keymap.set({'n', 'v'}, 'lr', vim.lsp.buf.references, { buffer=true }) -- Buffer-local mapping: vim.keymap.set('n', 'w', "w", { silent = true, buffer = 5 }) -- Expr mapping: vim.keymap.set('i', '', function() return vim.fn.pumvisible() == 1 and "" or "" end, { expr = true }) -- mapping: vim.keymap.set('n', '[%', '(MatchitNormalMultiBackward)') ```