Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add warning during kitten generation if path contains whitespace #294

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions lua/kitty-scrollback/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ M.generate_kittens = function(generate_modes)
':p'
)

local alias_warn = {}
if kitty_scrollback_kitten:find('%s') then
alias_warn = {
[[# WARNING]],
[[# ']] .. kitty_scrollback_kitten .. [[' contains whitespace.]],
[[# You may receive an error opening kitty-scrollback.nvim. If an error occurs, you can]],
[[# workaround this issue by symlinking the kitty-scrollback.nvim plugin directory to]],
[[# Kitty's configuration directory with the command:]],
[[#]],
[[# ln -s ']]
.. vim.fn.fnamemodify(kitty_scrollback_kitten, ':h:h')
.. [[' ~/.config/kitty/kitty-scrollback.nvim]],
[[#]],
[[# Then use the symlinked directory as the action_alias in kitty.conf instead of the real path]],
[[#]],
[[# action_alias kitty_scrollback_nvim kitten kitty-scrollback.nvim/python/kitty_scrollback_nvim.py]],
[[#]],
[[# Also, if you are using any kitty @ kitten commands update them to use the symlink path:]],
[[#]],
[[# kitty kitten kitty-scrollback.nvim/python/kitty_scrollback_nvim.py]],
[[#]],
[[]],
}
end

local action_alias = 'kitty_scrollback_nvim'
local alias_config = {
'# kitty-scrollback.nvim Kitten alias',
Expand Down Expand Up @@ -128,6 +153,7 @@ M.generate_kittens = function(generate_modes)
}

local configs = {}
vim.list_extend(configs, alias_warn)

local filetype
if target_gen_modes['maps'] then
Expand Down