Skip to content

Commit 3c822ac

Browse files
dwtongmrcjkb
andauthored
feat(ui): add open_split_vertical option for splits opened (#387)
Co-authored-by: Marc Jakobi <[email protected]>
1 parent 2eb8776 commit 3c822ac

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [Unreleased]
10+
11+
### Added
12+
13+
- Config: Open vertical splits from floating windows with
14+
`tools.float_win_config.open_split = 'vertical'`.
15+
Thanks [@dwtong](https://github.com/dwtong)!
16+
917
## [4.22.10] - 2024-05-04
1018

1119
### Fixed

lua/rustaceanvim/commands/diagnostic.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ local function set_open_split_keymap(bufnr, winnr, lines)
2727
_window_state.latest_scratch_buf_id = vim.api.nvim_create_buf(false, true) -- not listed and scratch
2828

2929
-- split the window to create a new buffer and set it to our window
30-
ui.split(false, _window_state.latest_scratch_buf_id)
30+
local vsplit = config.tools.float_win_config.open_split == 'vertical'
31+
ui.split(vsplit, _window_state.latest_scratch_buf_id)
3132

3233
-- set filetype to rust for syntax highlighting
3334
vim.bo[_window_state.latest_scratch_buf_id].filetype = 'rust'

lua/rustaceanvim/config/check.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function M.validate(cfg)
6161
max_height = { float_win_config.max_height, 'number', true },
6262
max_width = { float_win_config.max_width, 'number', true },
6363
auto_focus = { float_win_config.auto_focus, 'boolean' },
64+
open_split = { float_win_config.open_split, 'string' },
6465
})
6566
if not ok then
6667
return false, err

lua/rustaceanvim/config/internal.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ local RustaceanDefaultConfig = {
168168
--- default: false
169169
---@type boolean
170170
auto_focus = false,
171+
172+
--- whether splits opened from floating preview are vertical
173+
--- default: false
174+
---@type 'horizontal' | 'vertical'
175+
open_split = 'horizontal',
171176
},
172177

173178
--- settings for showing the crate graph based on graphviz and the dot

0 commit comments

Comments
 (0)