From 7ee767738ec4cbc7de7731dbe7bfe3a0b22b3dc4 Mon Sep 17 00:00:00 2001 From: Mike <10135646+mikesmithgh@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:23:27 -0500 Subject: [PATCH] fix: add warning during kitten generation if path contains whitespace (#294) --- lua/kitty-scrollback/api.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lua/kitty-scrollback/api.lua b/lua/kitty-scrollback/api.lua index 7a7f496..a4e1905 100644 --- a/lua/kitty-scrollback/api.lua +++ b/lua/kitty-scrollback/api.lua @@ -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', @@ -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