I've got no idea about the plugin prefixes these days, but from my understanding bat prints out the content and exits.
What you need is something to retain that information until you press a key or something.
nnn takes over because bat exited...
try a script with bat $nnn* && read -n 1 -s -r -p "Press any key to continue" or bat $nnn* | less
(btw not sure if unquoted variable in this case is a good idea, get shellcheck)
@0xACE is correct. Drop the *. I have updated the documentation to make this clearer.
bat can be forced to use a pager even on small files, use bat --paging=always $nnn
It was totally a misconfiguration and had little to do with nnn.
Thanks for your support.
I had the following set in my environment (set by zprezto):
export LESS='-F -g -i -M -R -S -w -X -z-4'
I changed it to
export LESS='-g -i -M -R -S -w -z-4'
(removed -X and -F)
The correct bat call seems to be (using it now with nuke for markdown files):
bat --color=always --paging=never "${FPATH}" | less -R
I use less so the bat output isn't put to terminal. Therefore --paging=never.
Next step: Find out how to use live preview and / or split the iTerm window.
@basbebe here is a version of our preview-tui plugin using bat: https://gist.github.com/leovilok/b09de81e30a5a51f5128c71a8b459b25
I'll leave implementing iterm window split version as an exercise :laughing:.
@leovilok please add this to the live preview wiki page.
I think it would also be a good idea to have the iterm example.
BTW, why can't we add iterm (and kitty, if possible) to preview-tui?
I don't have a mac, so I can't test iterm2 stuff. Besides, contoling panes in iterm2 seems to be done through applescript ... so it's probably harder than tmux/xterm.
It seems easier in kitty with its remote control capacity, but its disabled by default...
Thank you!
iTerm uses a Python API now.
I might try using ‘exa’ instead of ‘tree’ as well.
Maybe last try out neovim-remote open files with Neovim in another terminal.
@basbebe if you figure out how to do previews feel free to document it here: https://github.com/jarun/nnn/wiki/Live-previews
nnn can have python plugins too, BTW.
@leovilok if you figure how to do it with kitty, feel free to update the plugin.
@basbebe unfortunately, exa -t seems to wait before it gets the full tree before starting to print, wich make it very slow and quite useless as a previewer on dir containing deep/big hierachy. You could still use exa -l mode to preview dirs, or exa -t -L2 to limit tree level.
@jarun I can prepare a previewer for rust lovers, with bat+exa+ maybe hexyl for binary files, but should it take the shape of an anlternative version of @toddyamakawa's preview_cmd.sh, or an alternative version of preview-tui plugin?
Note that I don't use rust hype stuff myself, but I see why people might like them.
@leovilok actually I was more interested in the kitty solution (preview in a new pane) rather than the utilities used.
@leovilok maybe exa --tree --level=1
@basbebe unfortunately,
exa -tseems to wait before it gets the full tree before starting to print, wich make it very slow and quite useless as a previewer on dir containing deep/big hierachy. You could still useexa -lmode to preview dirs, orexa -t -L2to limit tree level.
I wasn't aware of that, thanks!
@jarun I don't know when I will be able to look into it but I will contribute when I figured it out!
@basbebe the new preview-kitty plugin uses bat and exa, so you can use it for inspiration if you like those tools.
@leovilok Thanks, looks great!
Quick update: I shortly looked into splitting windows via iTerm's Python API.
The Plugin then would also have to be written in Python or we would need another Plugin / script for handling the splitting.
iTerm has a really nice tmux Integration which already works and you don‘t need 20 lines of code to split the window.
Kakoune uses OSAscript I think to split iTerm windows, maybe I‘ll also look into that.
But I also looked at kitty and it seems really nice so I'll try out that for a while.
I might put the few lines of Python Code or the OSAcode into the wiki the coming days.
Sorry for hijacking the thread.