Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add Lua-only key mappings examples #2174

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ to get an understanding of how to use Telescope and how to configure it.
Try the command `:Telescope find_files<cr>`
to see if `telescope.nvim` is installed correctly.

Using VimL:

```viml
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
Expand All @@ -130,6 +132,16 @@ nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
```

Using Lua:

```lua
local builtin = require('telescope.builtin')
vim.keymap.set('n', 'ff', builtin.find_files, {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mappings dont have parity with the viml because of missing noremap = true

Copy link
Contributor Author

@sestrella sestrella Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Conni2461 thank you for the comment, I might be missing something here, but I don't see noremap as a valid option in the context of vim.keymap.set. There is an option called remap with false as the default value which I think is equivalent to noremap = true in the context of nvim_set_keymap

image

Copy link
Member

@Conni2461 Conni2461 Sep 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

It clearly links to map-arguments, noremap should be a map argument. But remap clearly meantions that the default is already false. maybe the neovim team changed the default to the better.

It also mentions all options from nvim_set_keymap which meantions noremap explicitly.

btw docs are from nvim 0.7.2, which is the current target version

vim.keymap.set('n', 'fg', builtin.live_grep, {})
vim.keymap.set('n', 'fb', builtin.buffers, {})
vim.keymap.set('n', 'fh', builtin.help_tags, {})
```

See [builtin pickers](#pickers) for a list of all builtin functions.

## Customization
Expand Down