Skip to content

Question about hints kitten: Open code with line number in existing neovim window #8935

@jleweli

Description

@jleweli

I have a kitty tab with 2 windows: On top Neovim with my code, below a terminal window which runs a server.

What I want to achieve is: In the bottom window hit CTRL + G and select a path:line entry which is being logged. The selected file should be opened in the upper window.

Is this possible, if yes - how?

Bases on the docs
map ctrl+g kitten hints --type=linenum --linenum-action=tab nvim +{line} {path}
, I tried out many things, for example:

map ctrl+g kitten hints --type=linenum --linenum-action=self --program "kitten @ send-text --match neighbor:top 'nvim +{line} {path}\n'"
map ctrl+g kitten hints --type=linenum --linenum-action=self --program "kitten @ send-text --match neighbor:top \"\\e:e +{line} {path}\\r\""

In both cases, what happens is, that the file is being opened on the correct line but in the wrong (bottom) window.

I also tried different matching methods to make sure that I address the correct window. Without mapping I was able to send keys to the upper window and open a file programmatically.
pasting text
kitten @ send-text --match neighbor:top 'this text gets pasted above'
opening a file
kitty @ send-text --match neighbor:top '\e:e /Users/xxx/projects/xxx/server/config/xxx.ts\r11G'

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions