Skip to content

Commit

Permalink
Version 0.2.1
Browse files Browse the repository at this point in the history
Merge pull request #2 from speelbarrow/v0.2.1
  • Loading branch information
speelbarrow authored May 13, 2024
2 parents fd9592d + 5644f69 commit 88384d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### [0.2.1](https://github.com/speelbarrow/spLauncher.nvim/tree/v0.2.1)
- Implement auto-scrolling and create an associated configuration parameter ([87b878a](
https://github.com/speelbarrow/spLauncher.nvim/commit/87b878af8232934aa59fb5ce6afde3a08123e2b9))

### [0.2.0](https://github.com/speelbarrow/spLauncher.nvim/tree/v0.2.0)
- Add `hide` configuration parameter ([9d21203](
https://github.com/speelbarrow/spLauncher.nvim/commit/9d21203f95d9a1065faa18d607a5ca5643ea7a05))
Expand Down
4 changes: 4 additions & 0 deletions doc/spLauncher.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ table/VimScript dictionary):
window when |spLauncher| opens a |terminal|. `"above"` and `"below"` will
result in horizontal splits, and `"left"` and `"right"` result in vertical
splits. See |nvim_open_win| for more information.

- `scroll` (default: `"true"`)
When `true`, the terminal window will scroll to the bottom when it is
opened (and thus will stay "pinned" to the bottom of the terminal output).

- `keymap` *spLauncher-config-keymap*

Expand Down
6 changes: 6 additions & 0 deletions lua/spLauncher/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function M.setup(config)
focus = true,
persist = true,
position = "below",
scroll = true,
},
keymap = (config ~= nil and config.keymap ~= nil and
config.keymap.merge == false) and nil or {
Expand Down Expand Up @@ -173,6 +174,11 @@ function M.direct_spLaunch(command, config)
end
end
})

-- Move cursor to the bottom of the terminal window to automatically scroll the output (unless `scroll` is false)
if config.window.scroll then
vim.schedule_wrap(vim.api.nvim_buf_call)(term_buf, function() vim.cmd "normal! G" end)
end
end

return M
3 changes: 3 additions & 0 deletions lua/spLauncher/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
--- Defines which area of the screen should hold the new window when spLauncher opens a terminal. `"above"` and
--- `"below"` will result in horizontal splits, and `"left"` and `"right"` result in vertical splits. See
--- `nvim_open_win` for more information.
---@field scroll boolean? Default: `true`
--- When `true`, the terminal window will scroll to the bottom when it is opened (and thus will stay "pinned" to the
--- bottom of the terminal output).

---@class spLauncher.Config.Keymap See `:help spLauncher-config-keymap`
---@field merge boolean Default: `true`
Expand Down

0 comments on commit 88384d7

Please sign in to comment.