Skip to content

feat: add reposition method to snacks terminal provider#226

Open
3dyuval wants to merge 1 commit intocoder:mainfrom
3dyuval:feat/toggle-position-225
Open

feat: add reposition method to snacks terminal provider#226
3dyuval wants to merge 1 commit intocoder:mainfrom
3dyuval:feat/toggle-position-225

Conversation

@3dyuval
Copy link
Copy Markdown

@3dyuval 3dyuval commented Mar 26, 2026

Summary

  • Adds M.reposition() to lua/claudecode/terminal/snacks.lua that closes the current window (without killing the terminal process) and reopens the existing buffer in a new Snacks.win with different position opts
  • Exposes M.reposition(opts_override) on the public lua/claudecode/terminal.lua module, delegating to the provider if supported
  • Snacks-only: the call is guarded by if type(provider.reposition) == "function" so native/external providers are unaffected

Usage

local base_win_opts = opts.terminal.snacks_win_opts
local is_float = true
vim.api.nvim_create_user_command("ClaudeTogglePosition", function()
  local term = require("claudecode.terminal")
  if is_float then
    term.reposition({ snacks_win_opts = vim.tbl_extend("force", base_win_opts, { position = "right", width = 0.4 }) })
  else
    term.reposition({ snacks_win_opts = base_win_opts })
  end
  is_float = not is_float
end, {})

Closes #225

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.

[FEATURE] Toggle between split and float when using Snacks

1 participant