Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possiblity to change cmake_build_executor split to vertical split #196

Closed
i-ilak opened this issue Feb 19, 2024 · 8 comments · Fixed by #197
Closed

Possiblity to change cmake_build_executor split to vertical split #196

i-ilak opened this issue Feb 19, 2024 · 8 comments · Fixed by #197

Comments

@i-ilak
Copy link

i-ilak commented Feb 19, 2024

Is your feature request related to a problem? Please describe.
I work on a wide, but not very high screen and would like to see the build log not in a horizontal, but vertical split.

Describe the solution you'd like
Currently, there is a setting to change the mode, i.e. job, dispatch, etc. and g:cmake_build_executor_height to set the height of the executor split.

Would be nice to have three variables:

  • the one to set the mode stays the same,
  • g:cmake_build_executor_split_type is 'horizontal' or 'vertical' (default can stay 'horizontal'),
  • g:cmake_build_executor_size to set size (default can stay 10)

Describe alternatives you've considered
Not sure if there are alternatives, or if this can already be achieved (I at least didnt find anything in the README).

@ilyachur ilyachur linked a pull request Feb 19, 2024 that will close this issue
@ilyachur
Copy link
Owner

Hi @i-ilak,

I created PR #197.
Hope, it should help you.

@ilyachur
Copy link
Owner

@i-ilak PR was merged. Feel free to reopen the issue in case if you have any problems.

@i-ilak
Copy link
Author

i-ilak commented Feb 20, 2024

@ilyachur Thanks a lot for the quick action!

The PR seems not to work for me. I updated this morning to master (and checked the log to make sure your changes are there), but after setting the two new variables

vim.g.cmake_build_executor_window_size = 25
vim.g.cmake_build_executor_split_mode = 'vsp'

and restarting nvim, the split is still horizontal and the window size is the default of 10. The other variables vim.g.cmake_build_path_pattern, vim.g.cmake_variants, etc are picked up correctly and work as expected. Any ideas what is going on?

Also, running

:lua print(vim.g.cmake_build_executor_split_mode)

produces the right values, so they are set.

@ilyachur ilyachur reopened this Feb 20, 2024
@ilyachur
Copy link
Owner

Hmm, I tested on vim and nvim... And it worked for me...
Could you please provide information about plugin configuration? Build executor and etc.?

@i-ilak
Copy link
Author

i-ilak commented Feb 20, 2024

@ilyachur Sure. Im using lazy.nvim. Here is the relevant part of the config.

--- init.lua for lazy.nvim

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable",
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

return require("lazy").setup(
    {
        "tpope/vim-dispatch",
       --- some more plugins....
        {
            lazy = true,
            event = "BufEnter *.{h, hpp, c, cpp}",
            "ilyachur/cmake4vim",
            config = function()
                require "plugins.cmake4vim"
            end
        },
        {
            "SantinoKeupp/lualine-cmake4vim.nvim",
            dependencies = "ilyachur/cmake4vim"
        },
        {
            lazy = true,
            "SantinoKeupp/telescope-cmake4vim.nvim",
            dependencies = "nvim-telescope/telescope.nvim"
        }
    })
--- plugins.cmake4vim.lua

local number_of_parallel_threads = 14
local cmake_usr_args_dict = {
    CONAN = "ON",
    CONAN_DISABLE_CHECK_COMPILER = "ON",
}
vim.g.cmake_build_path_pattern = { '/some_path/build_folders/%s/%s/%s',
    "fnamemodify( getcwd(), ':t' ), g:cmake_selected_kit, g:cmake_build_type" }

vim.g.cmake_build_executor_window_size = 80
vim.g.cmake_build_executor_split_mode = 'vsp'

vim.g.cmake_variants = {
    debug = {
        cmake_build_type = 'Debug',
        cmake_build_args = string.format('--parallel %s', number_of_parallel_threads),
        cmake_usr_args = cmake_usr_args_dict
    },
    release = {
        cmake_build_type = 'Release',
        cmake_build_args = string.format('--parallel %s', number_of_parallel_threads),
        cmake_usr_args = cmake_usr_args_dict
    }
}

Also, I noticed something: When I use :CMakeBuild it keeps splitting the window horizontally regardless of the settings, but calling :CMakeInfo splits it according to the config-file, i.e. in the above case it splits it vertically with the correct size.

@i-ilak
Copy link
Author

i-ilak commented Feb 21, 2024

@ilyachur My issue seems to be related to vim-dispatch. After adding

vim.g.cmake_build_executor = "job"

the feature works as expected... Sorry for the troubles!

@ilyachur
Copy link
Owner

@i-ilak Oh, good, thank you for sharing.

Unfortunately yes, my changes didn't affect dispatch, it works only for others executors.
I don't know the simple way how to support vertical layout with dispatch... Sorry :(

@i-ilak
Copy link
Author

i-ilak commented Feb 21, 2024

@ilyachur No problem of course. Thanks a lot for the help. Will close the issue 🙌

@i-ilak i-ilak closed this as completed Feb 21, 2024
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 a pull request may close this issue.

2 participants