[self-solved] Toolsclient


#1

I’m writing a tagbar-like plugin for kakoune. Currently it works like so:


Displaying tags in indented named blocks, like Functions, Variables, etc.

I’d like to utilize a tools client for it, in a way that tagbar will always appear as a panel at the side of the screen (in tmux), and if I select the tag in it and press Ret the jump to the tag will be executed in non-tools client.

Currently if I press Return key, tagbar will jump to the definition of the tag in current client, which will look like so:

So, I suppose I need to store parent client (a client that spawned tagbar) somewhere and execute jumping inside it, instead of tools client itself, but I’m not aware if there is a proper way for this. Any suggestions?

That would also be great to have same behavior in grep running at tools client, since grep will open search result in tools too, which is kinda strange, because tools client should be for tools only.


#2

Ah, I think that I’m supposed to use jumpclient for that.


#3

Meh, I was over-complicating it, and as a result asking questions that are already answered.


#4

I’m really looking forward to your tagbar plugin!

I appreciate that scripts that use toolsclient/jumpclient like make and grep fallback to showing output in a new buffer when those options are unset. This is preferable to spawning new terminal windows when kakoune is not running inside tmux. Please keep that convention.

For your plugin are you reading from a project wide tags file, generating a temporary file, or reading from ctags’ stdout?


#5

I’m generating a tags file for current buffer only, as tagbar originally did. It would make less sense for such outline viewer to display whole project structure, because it will look like whole project is stored in single file.

Unfortunately i can’t read from ctags stdout, because that will mean that I’ll need to rebuild tags on every jump, which isn’t great idea. Instead Im making a temporary tag file in $TMPDIR which defaults to /tmp if unset, and cat them to named pipe. When kakoune closed, those files are cleared.

I think plugin will be ready in next few days, so stay tuned!


#6

Here’s my (admittedly ugly) code for ensuring that jumpclient and toolsclient are set the way I want:

It could use some love, I think.


#7

That’s interesting script, yet I feel it’s a bit overkill for me.