Closed mikesmithgh closed 11 months ago
Nerd Fonts 3.1.0 was released today and Neovim icon is now available \o/
Nerd Fonts 3.1.0 was released today and Neovim icon is now available \o/
thanks!
:tada: This issue has been resolved in version 2.3.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Hey @xfzv , I just merged the change to let you use the Neovim icon. The instructions are here https://github.com/mikesmithgh/kitty-scrollback.nvim/tree/main#nerd-fonts. Configuring kitty-scrollback.nvim is odd right now, so I plan to improve the experience but this should work for now. Please let me know if you hit any issues.
Nice!
Configuring kitty-scrollback.nvim is odd right now
I guess it is, at least I can't figure how to use the Neovim icon, I'm still getting the Vim one. It's not a Nerd Font issue, the Neovim icon works just fine in Lualine or when inserted from nerdy.nvim.
My current setup:
return {
"mikesmithgh/kitty-scrollback.nvim",
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = "User KittyScrollbackLaunch",
config = function()
require("kitty-scrollback").setup({
ksb_example_visual_selection_highlight_mode_reverse = function()
return {
visual_selection_highlight_mode = "reverse",
}
end,
})
end,
}
# kitty-scrollback.nvim Kitten alias
action_alias kitty_scrollback_nvim kitten /home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py
# Browse scrollback buffer in nvim
map kitty_mod+h kitty_scrollback_nvim --config ksb_example_visual_selection_highlight_mode_reverse
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
# Show clicked command output in nvim
mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
Is a distinct kitty-scrollback-nvim-kitten-config.lua
file actually required for this? Can't it just be used in the config function?
I tried this but it doesn't work:
return {
"mikesmithgh/kitty-scrollback.nvim",
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = "User KittyScrollbackLaunch",
config = function()
require("kitty-scrollback").setup({
{
ksb_example_visual_selection_highlight_mode_reverse = function()
return {
visual_selection_highlight_mode = "reverse",
}
end,
},
{
ksb_example_status_win_nvim = function()
return {
status_window = {
icons = {
nvim = "îš®",
},
},
}
end,
},
})
end,
}
@xfzv
Regarding your config function, configurations that are prefixed with ksb_builtin_
or ksb_example_
are reserved.
If it is working as expected, then your configuration with ksb_example_visual_selection_highlight_mode_reverse
should not
actually be called. You can just remove that and it will fallback on the example configs in lua/kitty-scrollback/configs/example.lua
. The logic for this is here https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/625f356ec7844a870a4a243bd952cfe6e9e45b63/lua/kitty-scrollback/launch.lua#L284
The reason your the icon isn't showing up is a couple things,
By default kitty-scrollback.nvim passes the arguments --clean --noplugin -n
. This means that your ~/.config/nvim
is not loaded so your kitty-scrollback.lua
is never called. If you would like to have your config loaded, then you have to pass either --no-nvim-args
or --nvim-args
to your kitten.
For example:
action_alias kitty_scrollback_nvim kitten /home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --no-nvim-args
or
action_alias kitty_scrollback_nvim kitten /home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args <your args here see nvim --help>
Even if you do the above, the config ksb_example_status_win_nvim
is reserved, so you do not need to explicitly define it in your config.
The problem if you are using ksb_example.*
is that it will conflict with the other configs --config ksb_example_visual_selection_highlight_mode_reverse
, --config ksb_builtin_last_cmd_output
, --config ksb_builtin_last_visited_cmd_output
. For example, you can't do this:
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output --config ksb_example_status_win_nvim
kitty-scrollback.nvim will just take one of those configs and you will not have all the configurations that you expected
As I type this out, I realize how much a mess the config is for kitty-scrolback.nvim 😹. I plan to have a big refactor to try and get rid of these pain points and have it just make sense. But, that is a big lift at the moment.
For now, I suggest you do this:
Create the file, /home/xfzv/.config/nvim/lua/kitty-scrollback-nvim-kitten-config.lua
In your file above kitty-scrollback-nvim-kitten-config.lua
, add the following
-- since your entire config isn't loaded, we can just add kitty-scrollback.nvim to neovim runtime path
-- I see you are using lazy.nvim and know where the file is that is how I am referencing it below
-- it should be /home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim
vim.opt.runtimepath:append(vim.fn.stdpath('data') .. '/lazy/kitty-scrollback.nvim')
-- this is where you can configure everything now
require('kitty-scrollback').setup({
-- global is a special reserved config that will apply to all of your configurations
-- for example if you pass --config ksb_builtin_last_cmd_output, global will still be loaded
global = function()
return {
visual_selection_highlight_mode = 'reverse',
status_window = {
icons = {
nvim = 'îš®',
},
},
}
end,
another_config = function() -- this is just an example, you can remove this. But imagine you have a config that is specific to a certain
-- map in kitty.conf, you can use this like map f1 kitty_scrollback_nvim --config another_config
-- also in this case, whatever you have in the global config will be merged as well
-- ...
end
})
Then in your kitty.conf
# kitty-scrollback.nvim Kitten alias
# by default kitty-scrollback.nvim passed --clean --noplugin -n to nvim
# what we are doing here, passing our own args to nvim
# this is passing -u /home/xfzv/.config/nvim/lua/kitty-scrollback-nvim-kitten-config.lua
# -u is that flag that lets you pass a config file to nvim
# nvim --clean --noplugin -n is now nvim -u /home/xfzv/.config/nvim/lua/kitty-scrollback-nvim-kitten-config.lua
# notice --clean --noplugin -n have been removed since we didn't specify them
action_alias kitty_scrollback_nvim kitten /home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args -u /home/xfzv/.config/nvim/lua/kitty-scrollback-nvim-kitten-config.lua
# Browse scrollback buffer in nvim
# I remove --config ksb_example_visual_selection_highlight_mode_reverse
# because it is now defined the the global config kitty-scrollback-nvim-kitten-config.lua from above
# since global is a special reserve config, it will be merged with all of the mappings to kitty_scrollback_nvim
map kitty_mod+h kitty_scrollback_nvim
# Browse output of the last shell command in nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
# Show clicked command output in nvim
mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output
Ooof, hopefully this made sense. As I typed it out, I realized how complicated it is. Let me know if it works
Thank you so much for taking the time to write all these detailed instructions, I eventually got it working:
I realize that my config was completely wrong, it looks like visual_selection_highlight_mode = "reverse"
was only working because of:
# Browse scrollback buffer in nvim
map kitty_mod+h kitty_scrollback_nvim --config ksb_example_visual_selection_highlight_mode_reverse
I'm curious to see how you'll manage to "simplify" the setup. It would be great if we could set all the options directly in opts
or in the config
function without using an additional file, like what I was trying to do. I'm not a dev by any means so it's just my two cents, maybe it's technically not feasible.
Keep up the good work!
@xfzv awesome looking good now 😎.
Add an opt-in configuration to use the Neovim icon instead of Vim icon. See https://github.com/ryanoasis/nerd-fonts/pull/1391
Depends on next release of https://github.com/ryanoasis/nerd-fonts potentially
v3.1.0