Skip to content

Commit

Permalink
docs(readme): improve keymap example (#367)
Browse files Browse the repository at this point in the history
* Updated Readme

* Standardized keymap section in Readme

* Fixed typo

---------

Co-authored-by: Kevin Suc <Kevin.Suc@comtradegaming.com>
  • Loading branch information
Catacomba and Kevin Suc committed Mar 24, 2024
1 parent e7f8660 commit 5ee5002
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions README.md
Expand Up @@ -166,23 +166,16 @@ require("telescope").setup {
You can use the `telescope-file-browser` as follows:

```lua
vim.api.nvim_set_keymap(
"n",
"<space>fb",
":Telescope file_browser<CR>",
{ noremap = true }
)
vim.keymap.set("n", "<space>fb", ":Telescope file_browser<CR>")

-- open file_browser with the path of the current buffer
vim.api.nvim_set_keymap(
"n",
"<space>fb",
":Telescope file_browser path=%:p:h select_buffer=true<CR>",
{ noremap = true }
)
```
vim.keymap.set("n", "<space>fb", ":Telescope file_browser path=%:p:h select_buffer=true<CR>")

Alternatively, you can also access the picker as a function via `require "telescope".extensions.file_browser.file_browser` natively in lua.
-- Alternatively, using lua API
vim.keymap.set("n", "<space>fb", function()
require("telescope").extensions.file_browser.file_browser()
end)
```

## Mappings

Expand Down

0 comments on commit 5ee5002

Please sign in to comment.