Coder Social home page Coder Social logo

Comments (8)

xfzv avatar xfzv commented on May 24, 2024 1

Nerd Fonts 3.1.0 was released today and Neovim icon is now available \o/

image

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on May 24, 2024 1

@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

if config_name:match('^ksb_example_.*') then

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

    • You can move this file anywhere and name it whatever you want, this is just an example
  • 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

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on May 24, 2024

Nerd Fonts 3.1.0 was released today and Neovim icon is now available \o/

image

thanks!

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on May 24, 2024

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on May 24, 2024

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.

from kitty-scrollback.nvim.

xfzv avatar xfzv commented on May 24, 2024

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:

  • ~/.config/nvim/lua/plugins/kitty-scrollback.lua
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,
}
  • ~/.config/kitty/kitty.conf
# 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

> **kitty.conf**
> ```kitty
> action_alias kitty_scrollback_nvim kitten /Users/mike/gitrepos/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args -u kitty-scrollback-nvim-kitten-config.lua
> ```

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,
}

from kitty-scrollback.nvim.

xfzv avatar xfzv commented on May 24, 2024

Thank you so much for taking the time to write all these detailed instructions, I eventually got it working:
image

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!

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on May 24, 2024

@xfzv awesome looking good now 😎.

from kitty-scrollback.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.