Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add env configuration option and fix vim.notify scheduling#21

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
totalolage wants to merge3 commits intocoder:main
base:main
Choose a base branch
Loading
fromtotalolage:main

Conversation

totalolage
Copy link

@totalolagetotalolage commentedJun 7, 2025
edited
Loading

Summary

This PR adds environment variable configuration support to claudecode.nvim and fixes a critical error with vim.notify calls in fast event contexts.

Changes

1. Environment Variable Configuration

  • Addenv field to config for passing custom environment variables to Claude CLI
  • Update init.lua to pass env variables when spawning Claude terminal
  • Update terminal.lua to merge custom env variables into the terminal process
  • Allows users to set custom environment variables likeANTHROPIC_API_KEY

2. Fix vim.notify Scheduling Error

  • Wrap allvim.notify andnvim_echo calls invim.schedule() to prevent "E5560: nvim_echo must not be called in a fast event context" errors
  • This error occurred when logger functions were called from libuv callbacks

3. Code Cleanup

  • Remove trailing newlines from files
  • SupportCLAUDE_TERMINAL_CMD environment variable for terminal command configuration

Usage Example

require('claudecode').setup({env= {ANTHROPIC_API_KEY='your-api-key',CLAUDE_MODEL='claude-3-opus-20240229',-- any other environment variables  }})

Testing

  • Tested environment variable passing with various configurations
  • Verified vim.notify scheduling fix resolves the fast event context error
  • Ensured backward compatibility with existing configurations

Copy link
Member

@ThomasK33ThomasK33 left a comment

Choose a reason for hiding this comment

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

Looks good, I'd personally remove the vim.fn.getenv for theCLAUDE_TERMINAL_CMD and mention it in the docs if someone has that use case.

@ThomasK33
Copy link
Member

Hey@totalolage, you'll have to rebase onto main, as there's a merge conflict.

Could you also investigate the failing tests from the CI run?
You can run those tests locally usingmake test

@totalolagetotalolage changed the titlefeat: add env configuration optionfeat: add env configuration option and fix vim.notify schedulingJun 18, 2025
totalolageand others added3 commitsJune 18, 2025 09:21
- Add env field to config for passing environment variables to Claude CLI- Update init.lua to pass env variables when spawning Claude terminal- Allows users to set custom environment like ANTHROPIC_API_KEY🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ThomasK33ThomasK33ThomasK33 left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@totalolage@ThomasK33

[8]ページ先頭

©2009-2025 Movatter.jp