Skip to content

Commit

Permalink
chore: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh authored Nov 1, 2023
1 parent 90acc95 commit 43a594b
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma

## 🚀 Migrating to v2.0.0
> [!IMPORTANT]\
> v2.0.0 has breaking changes and requires steps to properly migrate from previous versions.
> v2.0.0 has breaking changes and requires steps to properly migrate from v1.X.X.
>
> You can ignore this section if you have not previously installed any verions of kitty-scrollback.nvim
Expand All @@ -38,6 +38,76 @@ Navigate your Kitty scrollback buffer to quickly search, copy, and execute comma
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`

- 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`
<details>
<summary>Real example</summary>

The configuration to view the last command output now references a builtin configuration instead of a file. The
new configuation 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 ctrl+shift+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 ctrl+shift+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
})
```
</details>

</details>


Expand Down

0 comments on commit 43a594b

Please sign in to comment.