Skip to content

Commit

Permalink
Add documentation for Org Roam Select
Browse files Browse the repository at this point in the history
Include hint to disable completion.
  • Loading branch information
seflue committed Jun 15, 2024
1 parent 7ed0ec7 commit 79501cb
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions DOCS.org
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,52 @@
- Press =<C-r>= to refresh the buffer. This can be handy if some
information has changed in the database.

** Org Roam Select

When within the select buffer, you can filter the list by typing.
- Press =<Enter>= to confirm the selection
- Press =<S-Enter>= to confirm the typed title if no selection is available
(e.g. when using [[#find-node][Find Node]])
- Press =<C-n>= or =<Down>= to select the next item in the list
- Press =<C-n>= or =<Up>= to select the next item in the list

*** Disable nvim-cmp completion in org-roam-select

If you use buffer completions with
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp), you might want to disable
them in the org-roam-select buffer. This can be done by implementing the
=enabled= function in nvim-cmp's options.

The simplest implementation would be to look for the =nofile= buffer type

#+begin_src lua
require('nvim-cmp').setup({
enabled = function()
local buftype = vim.api.nvim_get_option_value("buftype", { buf = 0 })
if buftype == "nofile" then -- or buftype == "nofile" then
return false
end
-- ... handling other conditions
end
})
#+end_src

If for some reason you don't want to disable completion for all =nofile=
buffers, you can also specifically identify the selection buffer by it's
name.

#+begin_src lua
require('nvim-cmp').setup({
enabled = function()
local bufname = vim.api.nvim_buf_get_name(0)
if bufname:match("org%-roam%-select$") ~= nil then
return false
end
-- ...
end
})
#+end_src

* API

** Add Alias
Expand Down

0 comments on commit 79501cb

Please sign in to comment.