Fork me on GitHub
#vim
<
2021-08-31
>
timo09:08:51

Anyone has some good function to format e.g. log-output as json-string or edn-string to pretty-formatted? I found something with jet at some point but somehow lost it again

walterl21:08:19

Is anyone aware of some way to have function definitions open in a predefined window? The long story: I find that I'm often carefully studying one specific function f, and want to study definitions of functions called by f. What I currently do is :vsplit<CR>gd, but this has a lot of window management/navigation overhead. What I'd like to have is, while staying in f's window, some command/mapping I can trigger to jump to a definition in a predefined window. Kind of like vim-fireplace's :Source, but with a specified (normal) window as a target.

noisesmith21:08:15

@clojurians-slack100 not really addressing your main issue here, but a small improvement is using :vert gd - vert splits then runs your command in the new split, there's also tab for doing the same thing but in a new tab instead of a split

noisesmith21:08:45

there's also lefta etc. for opening the split in a specific relative direction

walterl21:08:30

TIL lefta et al 🎉

noisesmith21:08:47

@clojurians-slack100 you might be able to use "the preview window" for what you want - I haven't used this feature in anger

noisesmith21:08:59

:pedit sets the contents of this special window

1
walterl22:08:00

:call CocActionAsync('jumpDefinition', 'pedit')
🎉

walterl22:08:52

It's 99% of what I was looking for, thank!

noisesmith22:08:27

awesome, glad I could help (and I just found it by doc browsing, so TIL pedit too haha)

😅 1
noisesmith22:08:30

and then you can use :pp to rewind to the previous thing you looked up nope, that's a tag stack specific thing 😦

noisesmith21:08:48

if your source lookup uses the tag system, then :ptag has the kind of behavior you describe

👀 1
noisesmith21:08:06

using a dedicated window (the preview window) and replacing the last thing you looked up

walterl21:08:20

Hmmm. Possibly. But this is where a caveat comes in: I often need to go another level deeper, or edit, or otherwise navigate around from the definition I jumped to. Preview windows often don't work great for that level of interactivity. (That's why I mentioned "(normal) window" 😛)

noisesmith21:08:32

it has a stack you can pop

noisesmith22:08:39

@clojurians-slack100 when I used :pedit it's a normal buffer display window, it's just special in that the next :pedit always replaces contents of that window

noisesmith22:08:51

it's not a "preview" like "just read it, vim commands don't work"

walterl22:08:11

Meh. Looks like this is also bumping up against the limits of coc.nvim: it doesn't seem to use/support tags

walterl22:08:30

But thanks for the tips. You've given me some stuff to research 🙂

noisesmith22:08:37

more things should use / leverage the tag system, so many vim commands work on tags...

walterl22:08:11

Yeah. I use(d) it a lot when writing Python code

walterl22:08:00

:call CocActionAsync('jumpDefinition', 'pedit')
🎉