Skip to content

doc: clarify get_current_dir nil return and add Telescope recipe#727

Open
harivansh-afk wants to merge 1 commit into
stevearc:masterfrom
harivansh-afk:fix/get-current-dir-nil-docs
Open

doc: clarify get_current_dir nil return and add Telescope recipe#727
harivansh-afk wants to merge 1 commit into
stevearc:masterfrom
harivansh-afk:fix/get-current-dir-nil-docs

Conversation

@harivansh-afk
Copy link
Copy Markdown

Expand get_current_dir docs to explain when nil is returned (non-oil buffer, non-files adapter, buffer context change). Add inline code examples showing the capture-before-call pattern for Telescope keymaps.

Update the existing Telescope keymap example in oil.txt to guard against nil. Add a dedicated Telescope recipe in recipes.md with find_files and live_grep examples.

Add a defensive nil guard in posix_to_os_path for edge-case Windows paths where the drive letter match fails.

Closes #682

Expand get_current_dir docs to explain when nil is returned (non-oil
buffer, non-files adapter, buffer context change). Add inline code
examples showing the capture-before-call pattern for Telescope keymaps.

Update the existing Telescope keymap example in oil.txt to guard against
nil. Add a dedicated Telescope recipe in recipes.md with find_files and
live_grep examples.

Add a defensive nil guard in posix_to_os_path for edge-case Windows
paths where the drive letter match fails.

Closes stevearc#682
@github-actions github-actions Bot requested a review from stevearc February 18, 2026 20:09
barrettruth added a commit to barrettruth/canola.nvim that referenced this pull request Feb 20, 2026
Problem: get_current_dir returns nil in several cases that were not
documented, causing confusion when used in keymaps that open pickers
like Telescope (stevearc#682). Also, posix_to_os_path could crash on Windows
when no drive letter is found.

Solution: expand get_current_dir docs to explain nil return cases, add
a Telescope recipe with nil guards, and add a defensive nil check in
posix_to_os_path.

Cherry-picked from: stevearc#727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: get_current_dir() works on telescope function but in normal function it returns nil

1 participant