Closed christopher-l closed 6 years ago
In all GUIs that implement sidebars, the thing that always seems to be missing is mapping support.
IMO this is what bridges "GUI" and "vim".
To me, the obvious approach would be to have an API that can be called via rpcrequest()
(or some other Nvim function). Default mappings could be provided.
E.g. a "ftplugin" for the sidebar might look like this:
nnoremap <buffer> j :call rpcrequest(g:nvimgtk_channel, 'nvimgtk_down')<CR>
nnoremap <buffer> k :call rpcrequest(g:nvimgtk_channel, 'nvimgtk_up')<CR>
nnoremap <buffer> <C-y> :call rpcrequest(g:nvimgtk_channel, 'nvimgtk_scroll_up')<CR>
...
In all GUIs that implement sidebars, the thing that always seems to be missing is mapping support.
I'm not sure that applies here. The sidebar is not a buffer and it cannot take focus. Vim doesn't know about it and it couldn't have any keybindings. Did I miss something?
The sidebar is not a buffer and it cannot take focus
There has been discussion of a sort of "dummy buffer" concept which could then support this.
But you're right, it would be awkward (but not impossible) currently.
I like title bar with file name / current directory - this is cool Tabs improvements is also cool
I think something wrong with changing current directory by single mouse click in file browser, don't know how it will be good, but this is strange for me. Selecting file by single click looks ok.
Think by default side bar must be hidden. Also state of side bar does not stored.
Also i like idea to allow user switch to browser and back with some hot keys, together with vim style navigation inside tree. So i can replace for example NERDTree with gui.
I think something wrong with changing current directory by single mouse click in file browser, don't know how it will be good, but this is strange for me.
I tried to guide that by the way Gedit does this. They also open files and directories with single clicks, but they underline the entries when hovered over. Do you think that would be enough of an indication?
Otherwise, what would be a good single-click action? My first ideas would be to open netrw or to just expand the directory in the tree.
Think by default side bar must be hidden. Also state of side bar does not stored.
I agree. Is there an interface within the application to store permanent state? This would also be interesting for the sidebar width. In the long run, I was also thinking about a preferences dialog for things like prefer_dark_theme and font and other settings that only concern the GUI but not Vim itself.
I thought of Gsettings, but this isn't available on Windows, is it? Is there a good way to use Gsettings and fall back to some alternative on Windows?
Also i like idea to allow user switch to browser and back with some hot keys, together with vim style navigation inside tree. So i can replace for example NERDTree with gui.
I see your point, but I'm not sure how to go about this. One of the main reasons for me to want a GUI file browser is that I don't need to worry about it stealing the focus anymore. Maybe don't give the focus to the sidebar, but control it from some kind of dummy buffer, as @justinmk suggested?
Maybe don't give the focus to the sidebar, but control it from some kind of dummy buffer,
A dummy buffer won't be possible without a change in Nvim core.
One of the main reasons for me to want a GUI file browser is that I don't need to worry about it stealing the focus anymore
I don't understand that. If you don't want it to be focused, you don't need it integrated at all. You can already control Nvim from a separate tool (which calls Nvim via the API or something like nvr which never gets focused...
Single or double click behavior changes depends on settings in nautilus. This settings applies globally also to gedit. So it will be good to use this setting for neovim also. Underline as behavior indicator is also good i think.
From my point of view current directory - is my current project, so in most cases it must always be same. But if i wrongly click on directory - currently i can't go back easily (for subfolder press up multiple times). So change current directory with underline indication together with navigation history will be good i think :smile:
I thought of Gsettings, but this isn't available on Windows, is it? Is there a good way to use Gsettings and fall back to some alternative on Windows?
Storing settings is a good question :smile: Currently i use gsettings only to get global font setting and simple toml files - for other settings. Gsettings works on windows, but problem is that if some schema does not exists - it fails with error, so i can't just get global gnome settings on windows. So what i did't like about gsettings is
So my current decision is use toml files for settings :smile:
I don't understand that. If you don't want it to be focused, you don't need it integrated at all. You can already control Nvim from a separate tool (which calls Nvim via the API or something like nvr which never gets focused...
It is not so much about integrating it with Vim for me but having it with the GUI around Vim.
Single or double click behavior changes depends on settings in nautilus.
Ah, I hadn't noticed that.
So change current directory with underline indication together with navigation history will be good i think
I always find back- and forward buttons in file browsers a bit awkward because part of me always expects them to go up and down the folder hierarchy, but I don't have a better idea either.
Gsettings works on windows
Oh, I didn't know that, too. ^^
Plus of gsettings is: change events easy gui mapping for future settings dialog this is standard for all gnome application
I also like about it, that it provides a good way to add and document options without (yet) exposing them in some settings dialog, but I see your point about toml files being more straight forward for the things you used them for.
Opening separate pull requests that can actually be merged.
This is more a request for comments than a final pull request.
I went and implemented a simple graphical file browser as a sidebar. Some of the other changes are related, but I also played around with some other things.
So my question is, what of this are you interested in, and what of that needs changing.
Other changes (mostly unrelated to the file browser):
subscriptions
module is used for this).Of course, I could split parts of this to separate commits / pull requests, if wanted.