Skip to content

Commit c9a31e5

Browse files
authored
Merge pull request #37 from krishna-bala/krishna.add-floating-window-2
feat: add floating window support
2 parents 275c476 + 1952ba2 commit c9a31e5

8 files changed

Lines changed: 1054 additions & 152 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- New `split_ratio` config option to replace `height_ratio` for better handling of both horizontal and vertical splits
13+
- Support for floating windows with `position = "float"` configuration
14+
- Comprehensive floating window configuration options including dimensions, position, and border styles
1315

1416
### Fixed
1517

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This plugin was built entirely with Claude Code in a Neovim terminal, and then i
2929
- 🧠 Support for command-line arguments like `--continue` and custom variants
3030
- 🔄 Automatically detect and reload files modified by Claude Code
3131
- ⚡ Real-time buffer updates when files are changed externally
32-
- 📱 Customizable window position and size
32+
- 📱 Customizable window position and size (including floating windows)
3333
- 🤖 Integration with which-key (if available)
3434
- 📂 Automatically uses git project root as working directory (when available)
3535
- 🧩 Modular and maintainable code structure
@@ -93,10 +93,20 @@ require("claude-code").setup({
9393
-- Terminal window settings
9494
window = {
9595
split_ratio = 0.3, -- Percentage of screen for the terminal window (height for horizontal, width for vertical splits)
96-
position = "botright", -- Position of the window: "botright", "topleft", "vertical", "rightbelow vsplit", etc.
96+
position = "botright", -- Position of the window: "botright", "topleft", "vertical", "float", etc.
9797
enter_insert = true, -- Whether to enter insert mode when opening Claude Code
9898
hide_numbers = true, -- Hide line numbers in the terminal window
9999
hide_signcolumn = true, -- Hide the sign column in the terminal window
100+
101+
-- Floating window configuration (only applies when position = "float")
102+
float = {
103+
width = "80%", -- Width: number of columns or percentage string
104+
height = "80%", -- Height: number of rows or percentage string
105+
row = "center", -- Row position: number, "center", or percentage string
106+
col = "center", -- Column position: number, "center", or percentage string
107+
relative = "editor", -- Relative to: "editor" or "cursor"
108+
border = "rounded", -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
109+
},
100110
},
101111
-- File refresh settings
102112
refresh = {
@@ -201,6 +211,26 @@ Note: After scrolling with `<C-f>` or `<C-b>`, you'll need to press the `i` key
201211

202212
When Claude Code modifies files that are open in Neovim, they'll be automatically reloaded.
203213

214+
### Floating Window Example
215+
216+
To use Claude Code in a floating window:
217+
218+
```lua
219+
require("claude-code").setup({
220+
window = {
221+
position = "float",
222+
float = {
223+
width = "90%", -- Take up 90% of the editor width
224+
height = "90%", -- Take up 90% of the editor height
225+
row = "center", -- Center vertically
226+
col = "center", -- Center horizontally
227+
relative = "editor",
228+
border = "double", -- Use double border style
229+
},
230+
},
231+
})
232+
```
233+
204234
## How it Works
205235

206236
This plugin:

doc/claude-code.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,21 @@ default configuration:
9191
-- Terminal window settings
9292
window = {
9393
split_ratio = 0.3, -- Percentage of screen for the terminal window (height or width)
94-
position = "botright", -- Position of the window: "botright", "topleft", "vertical", "vsplit", etc.
94+
position = "botright", -- Position of the window: "botright", "topleft", "vertical"/"vsplit", "float", etc.
9595
enter_insert = true, -- Whether to enter insert mode when opening Claude Code
9696
start_in_normal_mode = false, -- Whether to start in normal mode instead of insert mode
9797
hide_numbers = true, -- Hide line numbers in the terminal window
9898
hide_signcolumn = true, -- Hide the sign column in the terminal window
99+
100+
-- Floating window configuration (only applies when position = "float")
101+
float = {
102+
width = "80%", -- Width: number of columns or percentage string
103+
height = "80%", -- Height: number of rows or percentage string
104+
row = "center", -- Row position: number, "center", or percentage string
105+
col = "center", -- Column position: number, "center", or percentage string
106+
relative = "editor", -- Relative to: "editor" or "cursor"
107+
border = "rounded", -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
108+
},
99109
},
100110
-- File refresh settings
101111
refresh = {

0 commit comments

Comments
 (0)