1

When debugging with Vimspector, I would love to customize the default window layout. I mainly want to have a wider view of the vimspector.Watches window on the left. I can do this after firing up a session by using CTRL-W <, CTRL-W > etc., but I would love to persistently change the default. I've checked Vimspector's Readme and Configuration Options based on the .vimspector.config, but couldn't find a way. Maybe I just missed something. Thanks in advance!

0

2 Answers 2

1

For just window sizes

This experimental section says

Please Note: This customisation API is unstable, meaning that it may change at any time. I will endeavour to reduce the impact of this and announce changes in Gitter.

The following options control the default sizes of the UI windows (all of them are numbers)

  • g:vimspector_sidebar_width (default: 50 columns): The width in columns of the left utility windows (variables, watches, stack trace)
  • g:vimspector_bottombar_height (default 10 lines): The height in rows of the output window below the code window. Example:
let g:vimspector_sidebar_width = 75 let g:vimspector_bottombar_height = 15 

For more control

There's this experimental section saying

The above customisation of window sizes is limited intentionally to keep things simple. Vimspector also provides a way for you to customise the UI without restrictions, by running a User autocommand just after creating the UI or opening the terminal. This requires you to write some vimscript, but allows you to do things like:

  • Hide a particular window or windows
  • Move a particular window or windows
  • Resize windows
  • Have multiple windows for a particular buffer (say, you want 2 watch windows)
  • etc.

You can essentially do anything you could do manually by writing a little vimscript code.

The User autocommand is raised with pattern set with the following values:

  • VimspectorUICreated: Just after setting up the UI for a debug session
  • VimspectorTerminalOpened: Just after opening the terminal window for program input/output.

The following global variable is set up for you to get access to the UI elements: g:vimspector_session_windows. This is a dict with the following keys:

  • g:vimspector_session_windows.tagpage: The tab page for the session
  • g:vimspector_session_windows.variables: Window ID of the variables window, containing the vimspector.Variables buffer.
  • g:vimspector_session_windows.watches: Window ID of the watches window, containing the vimspector.Watches buffer.
  • g:vimspector_session_windows.stack_trace: Window ID of the stack trade window containing the vimspector.StackTrace buffer.
  • g:vimspector_session_windows.code: Window ID of the code window.
  • g:vimspector_session_windows.output: Window ID of the output window.

In addition, the following key is added when triggering the VimspectorTerminalOpened event:

  • g:vimspector_session_windows.terminal: Window ID of the terminal window

You'll probably find win_id2win()/win_id2tabwin() and win_execute() helpful if you go this route.

0

I tweaked an example from the repo and this should work:

" Define an autocommand to move the Vimspector watches window to the top of the screen function! s:CustomiseVimspectorUI() call win_gotoid( g:vimspector_session_windows.watches ) execute "wincmd K" endfunction augroup MyVimspectorUICustomisation autocmd! autocmd User VimspectorUICreated call s:CustomiseVimspectorUI() augroup END 
1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Jan 27 at 12:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.