nb icon indicating copy to clipboard operation
nb copied to clipboard

WSL2 browse with w3m edit with code

Open ckazimie opened this issue 2 years ago • 5 comments

I find nb very useful. I run it in WSL2, Ubuntu. Everything seems to work as it should except the browse mode with edit. I use w3m and code is set as the editor in nb. When I enter the edit mode with E and then in the edit area [] hit Enter, nb is briefly switching to the shell while a temporary file is opened in VS Code. Unfortunately the file is marked as deleted (indeicated by a strikethrough font) so editing in VS Code doesn't have any effect. NB is not waiting for the file to be close in VS Code. It returns back to the edit page in NB.

When I change the nb editor to vim it works as it should. When I run w3m directly with the environment variable EDITOR=code w3m in edit mode switched to VS Code without any issue.

Is this a bug in NB or am I doing sth wrong?

ckazimie avatar Jan 13 '22 20:01 ckazimie

Glad you like it! To get w3m working with VS Code, set the editor command in w3m to code --wait in the w3m Options Setting Panel (open by typing o). Let me know if this resolves it for you.

xwmx avatar Jan 14 '22 16:01 xwmx

Yes, it did solve the problem. Thank you :)

ckazimie avatar Jan 15 '22 11:01 ckazimie

Sorry, but maybe this one you may answer also. While using w3m is there a way to select the text for copying? Also bookmarks they do not open when you use nb open command. One solution for WSL would be to open them in the default browser in Windows og just use w3m. Is it possible to configure?

ckazimie avatar Jan 15 '22 11:01 ckazimie

PS. For opening a url in a windows default browser there is wslview command which can be installed with https://github.com/wslutilities/wslu

ckazimie avatar Jan 15 '22 11:01 ckazimie

PS. For opening a url in a windows default browser there is wslview command which can be installed with https://github.com/wslutilities/wslu

How do you deal with the fact that wslview returns immediately, and therefore nb browse localhost server does not stay open long enough for the windows browser to load the cached files? Or perhaps I have wslview set-up the wrong way.

I'm using export BROWSER=wslview

Couldn't find anything in the readme so assumed this is the way. wslview works in that Firefox open on windows at the right url, but nothing loads because (presumably) nb has already returned to prompt and closed the web server.

trekze avatar Oct 11 '22 14:10 trekze