Skip to content

Commit

Permalink
chore: update wiki with breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh committed Dec 12, 2023
1 parent f2dcee6 commit 3d2ad8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 89 deletions.
98 changes: 12 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma
<!-- panvimdoc-ignore-end -->

## 🚀 Migrating to v2.0.0
## 🚀 Migrating to v3.0.0
> [!IMPORTANT]\
> v2.0.0 has breaking changes and requires steps to properly migrate from v1.X.X.
> v3.0.0 has breaking changes and requires steps to properly migrate from v2.X.X.
>
> You can ignore this section if you have not previously installed any version of kitty-scrollback.nvim
Expand All @@ -52,92 +52,18 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma

<!-- panvimdoc-ignore-end -->

- If you are using the [lazy.nvim](https://github.com/folke/lazy.nvim) or [packer.nvim](https://github.com/wbthomason/packer.nvim) package manager, then
add the custom `User` event `KittyScrollbackLaunch` as a trigger for lazy loading.
See [Installation](#-installation) for additional details.

```lua
event = { 'User KittyScrollbackLaunch' }
```

- Regenerate default Kitten mappings and add to `kitty.conf`

```sh
nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1
```
- Remove previous kitty-scrollback.nvim Kitten mappings in `kitty.conf`

- The default mapping keys changed from `ctrl+shift` to `kitty_mod`. The default values for `kitty_mod` in Kitty is `ctrl+shift`.
- If you are using the default value for `kitty_mod` of `ctrl+shift`, then no change is needed.
- If you are using a different value for `kitty_mod`, then you should correct any potential mapping conflicts that may occur
now that `kitty-scrollback.nvim` is using `kitty_mod`.

- Migrate any customized configurations to the new format
- When you define your kitty-scrollback.nvim Kitten configuration, do not use `--config-file` `yourconfigfile.lua`. Instead,
move the contents of `yourconfigfile.lua` to an entry in the configuration passed to the kitty-scrollback.nvim setup function.
```lua
require('kitty-scrollback').setup({
yourconfig = function()
...
end,
})
```
Update your Kitten to use the name of the configuration defined in the setup function. In this example,
`--config-file yourconfigfile.lua` changes to `--config yourconfig`
## Highlight Groups

<details>

<summary>Real example</summary>

- > [!NOTE]\
> The configuration to view the last command output now references a builtin configuration instead of a file. The
> new configuration can be viewed by running `:KittyScrollbackGenerateKittens`.

- Old configuration
- The Kitten defined in `kitty.conf` references the configuration file `get_text_last_cmd_output.lua`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config-file get_text_last_cmd_output.lua
```

```lua
-- get_text_last_cmd_output.lua
local M = {}
M.config = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end

return M
```

- New configuration
- The Kitten defined in `kitty.conf` references the builtin configuration name `ksb_builtin_last_cmd_output`

```kitty
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
```

```lua
require('kitty-scrollback').setup({
ksb_builtin_last_cmd_output = function()
return {
kitty_get_text = {
extent = 'last_visited_cmd_output',
ansi = true,
},
}
end
})
```
- Existing highlight groups were renamed. If you were overriding any kitty-scrollback.nvim highlight groups, please update the names referencing the table below.

</details>
| Previous highlight name | New highlight name |
| -------------------------- | --------------------------------------- |
| KittyScrollbackNvimNormal | KittyScrollbackNvimStatusWinNormal |
| KittyScrollbackNvimHeart | KittyScrollbackNvimStatusWinHeartIcon |
| KittyScrollbackNvimSpinner | KittyScrollbackNvimStatusWinSpinnerIcon |
| KittyScrollbackNvimReady | KittyScrollbackNvimStatusWinReadyIcon |
| KittyScrollbackNvimKitty | KittyScrollbackNvimStatusWinKittyIcon |
| KittyScrollbackNvimVim | KittyScrollbackNvimStatusWinNvimIcon |

</details>

Expand Down
4 changes: 1 addition & 3 deletions python/kitty_scrollback_nvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,11 @@ def handle_result(args: List[str],

nvim_args = parse_nvim_args(args) + (
'--cmd',
' lua '
' lua'
' vim.api.nvim_create_autocmd([[VimEnter]], {'
' group = vim.api.nvim_create_augroup([[KittyScrollBackNvimVimEnter]], { clear = true }),'
' pattern = [[*]],'
' callback = function()'
# ' local orig_colorscheme = vim.g.colors_name or [[default]]'
# ' vim.cmd.colorscheme({ args = {[[vim]]}, mods = { emsg_silent = true }})'
f' vim.opt.runtimepath:append([[{ksb_dir}]])'
' vim.api.nvim_exec_autocmds([[User]], { pattern = [[KittyScrollbackLaunch]], modeline = false })'
f' require([[kitty-scrollback.launch]]).setup_and_launch([[{kitty_data}]])'
Expand Down

0 comments on commit 3d2ad8a

Please sign in to comment.