Coder Social home page Coder Social logo

Comments (20)

10b14224cc avatar 10b14224cc commented on July 18, 2024 1

oh yes it works now. Many thanks.

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

Hey @10b14224cc thank you for reporting. kitty-scrollback.nvim has some options that are set by default https://github.com/mikesmithgh/kitty-scrollback.nvim/blob/main/lua/kitty-scrollback/launch.lua#L118

Particularly, vim.o.number and vim.o.laststatus that will hide line numbers and lualine.

kitty-scrollback.nvim has the option restore_options that restores the user options after setup. Could you try the following and let me know if this resolves your issues?

require('kitty-scrollback').setup({
  {
    restore_options = true,
  },
})

Regarding the background, kitty-scrollback.nvim should try to use kitty's background color if you are using the default nvim colorscheme. Otherwise, it should use your Neovim colorscheme's background color. There may be a bug or some configuration option that I am not checking causing this problem for you.

If your Neovim config is available, could you share a link to it?

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

Particularly, vim.o.number and vim.o.laststatus that will hide line numbers and lualine.

Actually I would prefer having lualine but hiding barbar (not useful there, right?)

kitty-scrollback.nvim has the option restore_options that restores the user options after setup. Could you try the following and let me know if this resolves your issues?

It shows lualine but the background is still black.

Also there is considerable space between window margin and lualine

If your Neovim config is available, could you share a link to it?

To set the colorscheme in nvim I do:

require("lazy").setup({
        "catppuccin/nvim"
})
[...]
vim.cmd.colorscheme("catppuccin-macchiato")
-- Set fully transparent background
-- Must be done after specifying colorscheme because it's overrode by colorscheme specification
-- To set transparency in vimL, see: https://stackoverflow.com/questions/37712730/set-vim-background-transparent/37720708#37720708
-- To port to Lua, see: https://stackoverflow.com/questions/71152802/how-to-override-color-scheme-in-neovim-lua-config-file/73370407#73370407
--]]
vim.api.nvim_set_hl(0, "Normal", {guibg = NONE, ctermbg = NONE})

For kitty:

include current-theme.conf
# Background transparency
background_opacity 0.9

and current-theme.conf is:

# vim:ft=kitty

## name:     Catppuccin Kitty Macchiato
## author:   Catppuccin Org
## license:  MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/macchiato.conf
## blurb:    Soothing pastel theme for the high-spirited!



# The basic colors
foreground              #CAD3F5
background              #24273A
selection_foreground    #24273A
selection_background    #F4DBD6

# Cursor colors
cursor                  #F4DBD6
cursor_text_color       #24273A

# URL underline color when hovering with mouse
url_color               #F4DBD6

# Kitty window border colors
active_border_color     #B7BDF8
inactive_border_color   #6E738D
bell_border_color       #EED49F

# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system

# Tab bar colors
active_tab_foreground   #181926
active_tab_background   #C6A0F6
inactive_tab_foreground #CAD3F5
inactive_tab_background #1E2030
tab_bar_background      #181926

# Colors for marks (marked text in the terminal)
mark1_foreground #24273A
mark1_background #B7BDF8
mark2_foreground #24273A
mark2_background #C6A0F6
mark3_foreground #24273A
mark3_background #7DC4E4

# The 16 terminal colors

# black
color0 #494D64
color8 #5B6078

# red
color1 #ED8796
color9 #ED8796

# green
color2  #A6DA95
color10 #A6DA95

# yellow
color3  #EED49F
color11 #EED49F

# blue
color4  #8AADF4
color12 #8AADF4

# magenta
color5  #F5BDE6
color13 #F5BDE6

# cyan
color6  #8BD5CA
color14 #8BD5CA

# white
color7  #B8C0E0
color15 #A5ADCB

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

@10b14224cc

Actually I would prefer having lualine but hiding barbar (not useful there, right?)

Yes, I agree barbar doesn't make much sense unless you have multiple buffers open. You could configure this in barbar like

    require('barbar').setup({
      auto_hide = 1, -- if # of buffers is <= to this, then hide barbar
      -- your config here
    })

you could also do something like
auto_hide = vim.env.KITTY_SCROLLBACK_NVIM == 'true' and 1 or -1,
or add some hooks into the after_ready callback to do something similar.

It shows lualine but the background is still black.

This is definitely a bug, I was able to reproduce with vim.api.nvim_set_hl(0, 'Normal', {}). Thanks for pointing this out, I created the issue #181 and plan to fix it.

Also there is considerable space between window margin and lualine

Could you please provide a screenshot of what you are seeing?

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

@10b14224cc I just fixed #181, that should fix you background color issue. Also, the spacing issue I believe you saw was actually the difference in the Kitty terminal background color and Neovim's background color. That should be fixed as well if that assumption is correct.

Let me know if this fixes your issues or if you help with anything else.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

@10b14224cc I just fixed #181, that should fix you background color issue. Also, the spacing issue I believe you saw was actually the difference in the Kitty terminal background color and Neovim's background color. That should be fixed as well if that assumption is correct.

Let me know if this fixes your issues or if you help with anything else.

I don't know.

I now see the background as transparent as it should be.

I also see line numbers and lualine, they were supposed to not be there, weren't they?

But most importantly, if for example I press dd the line disappears, but pressing p doesn't put it back.

If I press i, another popup shows up, sometimes with the text in nvim and sometimes not, and press <C-CR> to run it.

image

Also, the output of the last command include the last prompt as well (I have starship):

image

I think this is overshooting it.

I really don't need my nvim config there.

Once upon a time I pressed the keybinding for the current buffer, the windows flashed a bit and I could use my nvim keybindings directly in the buffer, and after yanking what I needed it inserted the text in a new prompt.

I liked the old way better. I really don't need all this features.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

Sorry, the popup that is being opened with i is always empty. So I don't have the text in nvim there.

How do I modify the output of the last command before running it?

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

I now see the background as transparent as it should be.

👍

I also see line numbers and lualine, they were supposed to not be there, weren't they?

If you have restore_options set to true then it will show whatever configuration you have for numbers and lualine ( see #179 (comment)).

If you don't want numbers or lualine, you can remove restore_options from your config.

But most importantly, if for example I press dd the line disappears, but pressing p doesn't put it back.
If I press i, another popup shows up, sometimes with the text in nvim and sometimes not, and press to run it.

I'm not sure I follow what you are saying here. If you press dd in the scrollback buffer it shouldn't allow that since you can't modify that buffer. If you dd and p inside the paste window, I would expect that to work. Where are you doing dd and p ?

If I press i, another popup shows up, sometimes with the text in nvim and sometimes not, and press to run it.

i will enter insert mode. The paste window should be blank, unless you have already copied text to it previously. For example, yy should copy a line to the paste window. esc will close the paste window. Then i will reopen the paste window with the previous text that was pasted.

Also, the output of the last command include the last prompt as well (I have starship):

This last command is whatever kitty returns from kitty @ get-text --extent=last_cmd_output. You can test this by commenting out map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output in your kitty.conf, reloading, and then pressing kitty_mod+g. This will open in kitty's default scrollback pager less. The results should be the same.

I liked the old way better. I really don't need all this features.

Check out no-configuration on the README. There haven't been any new features added, this is simply just using your Neovim configuration now which you may or may not want depending on your use case.

Just update your kitty.conf to include the args --nvim-args --clean --noplugin -n and you will have the same behavior as previously.

Something like this:

action_alias kitty_scrollback_nvim kitten /your/path/here/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args --clean --noplugin -n

You should check out separte-neovim-configuration as well. There are options for no config, separate, and minimal configs.

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

Sorry, the popup that is being opened with i is always empty. So I don't have the text in nvim there.

How do I modify the output of the last command before running it?

i just opens the paste window, you need to select the text you want by yanking it and it should open in the paste window. Then, modify the command and execute.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

This last command is whatever kitty returns from kitty @ get-text --extent=last_cmd_output. You can test this by commenting out map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output in your kitty.conf, reloading, and then pressing kitty_mod+g. This will open in kitty's default scrollback pager less. The results should be the same.

Yes, it returns the prompt as part of the output.

So is this a kitty bug?

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

This last command is whatever kitty returns from kitty @ get-text --extent=last_cmd_output. You can test this by commenting out map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output in your kitty.conf, reloading, and then pressing kitty_mod+g. This will open in kitty's default scrollback pager less. The results should be the same.

Yes, it returns the prompt as part of the output.

So is this a kitty bug?

Yep that would be an upstream bug in Kitty.

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

Hey @10b14224cc, I am closing this issue. Feel free to reopen or create a new issue if you have any other problems.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

Hello @mikesmithgh,

Sorry for bothering you.

I don't understand how it works anymore.

I run

echo "hello"
echo "bye"

I type CTRL+SHIFT+G and I get this:
image

How do I select and copy the bye?

<Space>y types . y, so I don't understand if it's yanking and if so why it is typing.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

Once upon a time with previous versions of kitty-scrollback.nvim the cursor stayed in the terminal, and I could move it using vim-keybindings.

Now it is opening a new window and I don't understand how to use it.

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

I think my vim keybindings are conflicting with that <Space>y maybe?

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

I type CTRL+SHIFT+G and I get this:
image

Hey @10b14224cc thanks for letting me know. That is not expected behavior. So, the window are you seeing is the "paste window". That should only be opened when you yank text from the buffer or enter insert mode.

It seems like something may be automatically triggering insert mode in this case causing the paste window to open.

y types . y, so I don't understand if it's yanking and if so why it is typing.

The "paste window" is in insert mode, so it is entering your text. You should be able to hit escape to enter normal mode, then escape to go back to the scrollback buffer. But, still this shouldn't happen automatically like you are seeing.

<Space>y means that if you yank anything using your leader key <Space> it will copy that text to the clipboard and exit kitty-scrollback.nvim.

Could you do two things for me?

1. Try updating the action_alias line in kitty.conf similar to:

action_alias kitty_scrollback_nvim kitten /your/path/here/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args --clean --noplugin -n

Then reload your Kitty config with ctrl+shift+f5 (⌃ + ⌘ + , on macOS)

The args --nvim-args --clean --noplugin -n will open a clean nvim without your config or plugins.

Please let me know if this works. If this works, then we can try to hunt down what is causing the paste window to open automatically.

2. If you nvim config is available on github, could you share the link so I could take a look?

from kitty-scrollback.nvim.

10b14224cc avatar 10b14224cc commented on July 18, 2024

The args --nvim-args --clean --noplugin -n will open a clean nvim without your config or plugins.
Please let me know if this works. If this works, then we can try to hunt down what is causing the paste window to open automatically.

Yes with this it opens the scrollback buffer, and after I yank it opens the "paste window"

  1. If you nvim config is available on github, could you share the link so I could take a look?

It is not available on github, but now that I think about it, maybe this section of my init.lua is relevant?

-- when switching to a terminal window, automatically switch to insert mode
-- see: https://vi.stackexchange.com/a/43781/36430
vim.api.nvim_create_autocmd({ "TermOpen", "BufEnter" }, {
    pattern = { "*" },
    callback = function()
        if vim.opt.buftype:get() == "terminal" then
            vim.cmd(":startinsert")
        end
    end
})

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

It is not available on github, but now that I think about it, maybe this section of my init.lua is relevant?

-- when switching to a terminal window, automatically switch to insert mode
-- see: https://vi.stackexchange.com/a/43781/36430
vim.api.nvim_create_autocmd({ "TermOpen", "BufEnter" }, {
    pattern = { "*" },
    callback = function()
        if vim.opt.buftype:get() == "terminal" then
            vim.cmd(":startinsert")
        end
    end
})

ah that looks like it! let me check a couple things and I can give you a way to avoid this for kitty-scrollback.nvim

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

@10b14224cc could you try?

vim.api.nvim_create_autocmd({ 'TermOpen', 'BufEnter' }, {
  pattern = { '*' },
  callback = function()
    if vim.env.KITTY_SCROLLBACK_NVIM ~= 'true' and vim.o.buftype == 'terminal' then
      vim.cmd(':startinsert')
    end
  end,
})

I was able to reproduce the issue you were seeing, and kitty-scrollback.nvim is in a broken state due to that unexpected insert mode.

from kitty-scrollback.nvim.

mikesmithgh avatar mikesmithgh commented on July 18, 2024

oh yes it works now. Many thanks.

awesome!

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.