michaelb / sniprun

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
MIT License
1.49k stars 47 forks source link

feat: more flexible terminal display options #229

Closed zhengpd closed 1 year ago

zhengpd commented 1 year ago

This commit enhance Sniprun configurations with following changes:

  1. Allows to merge user options into default config_values key by key. Consider below situation:
-- config_values
{ display_options = { terminal_width = 45, notification_timeout = 5 } }

-- user options
{ display_options = { terminal_scrollback = 1 } }

-- previous behavior result:
--   overrides display_options and lost default options
{ display_options = { terminal_scrollback = 1 } }

-- new behavior result:
--   merge into default options
{ display_options = { terminal_wdith = 45, notification_timeout = 5, terminal_scrollback = 1 } }

This is implemented with vim.tbl_deep_extend("force", M.config_values, opts).

  1. Sets local non-intrusive scrollback option in terminal buffer. Previous implementation set scrollback=1 changes scrollback globally, which affects non-sniprun terminals.

  2. Adds 3 new display options: terminal_scrollback, terminal_line_number and terminal_signcolumn.