Skip to content

Commit

Permalink
feat(ui): add open_split_vertical option for splits opened (#387)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
  • Loading branch information
dwtong and mrcjkb authored May 10, 2024
1 parent 2eb8776 commit 3c822ac
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Config: Open vertical splits from floating windows with
`tools.float_win_config.open_split = 'vertical'`.
Thanks [@dwtong](https://github.com/dwtong)!

## [4.22.10] - 2024-05-04

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion lua/rustaceanvim/commands/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ local function set_open_split_keymap(bufnr, winnr, lines)
_window_state.latest_scratch_buf_id = vim.api.nvim_create_buf(false, true) -- not listed and scratch

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

-- set filetype to rust for syntax highlighting
vim.bo[_window_state.latest_scratch_buf_id].filetype = 'rust'
Expand Down
1 change: 1 addition & 0 deletions lua/rustaceanvim/config/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function M.validate(cfg)
max_height = { float_win_config.max_height, 'number', true },
max_width = { float_win_config.max_width, 'number', true },
auto_focus = { float_win_config.auto_focus, 'boolean' },
open_split = { float_win_config.open_split, 'string' },
})
if not ok then
return false, err
Expand Down
5 changes: 5 additions & 0 deletions lua/rustaceanvim/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ local RustaceanDefaultConfig = {
--- default: false
---@type boolean
auto_focus = false,

--- whether splits opened from floating preview are vertical
--- default: false
---@type 'horizontal' | 'vertical'
open_split = 'horizontal',
},

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

0 comments on commit 3c822ac

Please sign in to comment.