macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.53k stars 685 forks source link

Gui file explorer feature? #1176

Open rickalex21 opened 3 years ago

rickalex21 commented 3 years ago

Thanks to everyone for their contributions to this project. Are there any plans of including a feature like a gui file explorer on the side like visual studio code workspace folders?

I understand that this is vim but this is the 'gui' version of vim. There are text based file explorers out there but when it comes to web development I find myself going back to visual studio code every time. I'm not new to vim, I've created lots of personal vim plugins. I just find it easier in vscode to go in and out of folders, drag and drop folders/images/files etc.. Once everything is set, I go back to vim.

You could have an option to hide or show the folder workspace if people want to use it.

eirnym commented 3 years ago

Hey, do you mean you want to add something like NerdTree plugin?

I'm asking because of:

  1. I like the idea :)
  2. VSCode has very vague definition of "project" (but there's a project file though)
  3. MacVim currently is just a special terminal with some additional keybindings
  4. Such idea is generally good for Vim as a whole to integrate (with this it's better to go to the upstream, and in my opinion make sense)
  5. I don't understand how to properly implement this without breaking "pure Vim" experience as MacVim currently has
  6. What's about opening files from the same project from terminal? What's about other corner cases?
rickalex21 commented 3 years ago

Yes, something like that but a gui version since this is Macvim. This is what I'm talking about.

I don't really use the project files '.vscode' but I'm sure others find them useful. Ya I agree with you on '2', that's why I was suggesting this feature.

I don't understand how to properly implement this without breaking "pure Vim" experience as MacVim currently has

I'm sure there will be changes that would have to be made but I don't know to what extent. I would imagine that this would need to be separated from vim to prevent things from breaking and have an intermediate module to reflect changes in vim windows. For example, if a user clicks on a file then it should be shown in the vim window. This is not much different from File -> open.

What's about opening files from the same project from terminal? What's about other corner cases?

I think opening workspace folders from the menu on macvim is fine. The main idea is the ability to drag and drop stuff into folders just like you can in visual studio code.

eirnym commented 3 years ago

OK, while generally agree with this idea and willing to have this in MacVim implemented, I have questions before we start implementation to be on the same page and not to make a thing won't be totally needed by others

let's imagine, we have this feature implemented. Where is the root directory? or / is the root directory and we show tree as NerdTree? How we can define workspace? what would be saved there?

There's sessions in Vim, as an already implemented feature, and we theoretically can extend it by adding something used only by MacVim (some work could be required in the upstream, but it's ok)

rickalex21 commented 3 years ago

Where is the root directory? or / is the root directory and we show tree as NerdTree?

Make it work the same way vscode works. I'm not a big fan of terminal file explorers when it comes to web development so I can't comment much on nerd tree, netrw, or any other file explorer.

How we can define workspace? what would be saved there?

By saving the workspace, I mean just save what files and folders I have open. I know mksession does this but it does not have gui folders. As you can see in the image above I have two folders pandoc and wiki along with a makefile. That was all restored from a workspace save. Which basically is just a json file, another method of saving would need to be used by macvim.

{
    "folders": [
        {
            "path": "../../pandoc"
        },
        {
            "path": "../../hugo/wiki"
        }
    ],
    "settings": {
        "liveServer.settings.multiRootWorkspaceName": "pandoc"
    }
}

Only implement the basic stuff first. You can always add features later on like ability to save workspace or mksession. For now just the basics.

It would look like this, you would click on a file and it would show up in the terminal. Nerdtree and other file explores do this but it's not as fluid like in a gui where you can drag and drop.

eirnym commented 3 years ago

Sweet, I like the idea more and more.

There's my thoughts on how to integrate this feature as smooth as possible to MacVim without breaking "pure vim" experience. (this could lead to PRs in Vim)

On file format for sessions/workspace, I'd extend existing Vim mechanism (see notes below)

Top folder

let's imagine following scenarios: prerequisites:

I have scenarios, multiplied by how I open files. How MacVim should behave?

Let's multiply this by:

What user actions will change session file? how these actions could be customized?

Foot Notes

I see following constraints and integrations points to introduce it as smooth as possible by inviting as many users as possible without creating a monster with "Mac"-specific UI

Sessions:

File Tree:

PS: These constrains doesn't neglect drag&drop fluidness and other features you mentioned. I try to involve to this as many people as possible, not only MacVim community, but whole Vim community!

rickalex21 commented 3 years ago

These constrains doesn't neglect drag&drop fluidness and other features you mentioned. I try to involve to this as many people as possible, not only MacVim community, but whole Vim community!

Yes I agree with you it should be feature rich and something that everyone would want to use :) . As far as the technical details go, I wouldn't be much help since I'm not familiar with developing for Mac, swift, or the macvim code. The developers in macvim would know more about how to do this. As long as it has a similar file explorer to visual studio code I'm fine with it. I just want to drag and drop files, move folders around etc... You can download visual studio code or vscodium if you would like to check it out.

nyngwang commented 3 years ago

So now you want this? Try keyword: fern  🌿🌿 (my keyboard shortcut is )

image

eirnym commented 3 years ago

@nyngwang great tool, thanks, I'll give it a try

eirnym commented 3 years ago

The only thing it doesn't satisfy is drag-n-drop feature inside MacVim, from and out :) This is why I'd like to have a standardized GUI drawer, not the text-only.

PS: this won't make such plugins obsolete as text-only UI for Vim is widely used and I'd prefer to have them around

nyngwang commented 3 years ago

The only thing it doesn't satisfy is drag-n-drop feature inside MacVim, from and out :) This is why I'd like to have a standardized GUI drawer, not the text-only.

PS: this won't make such plugins obsolete as text-only UI for Vim is widely used and I'd prefer to have them around

@eirnym What do you mean drag-n-drop feature? In my case the vertical bar can be adjusted like this without trouble, the following is done in sequence, it looks like Vim but I'm actually using MacVim, the trick is that I set the titlebar of MacVim Hidden:

  1. Adjust left:

  2. Move bottom up:

  3. Adjust right:

  4. Move bottom down:

rickalex21 commented 3 years ago

@nyngwang

What do you mean drag-n-drop feature?

The ability to easily move images, files, etc... in and out of folders with the mouse. I wouldn't suggest it on vim but since this is MacVim a 'gui' version of vim, it would be a nice feature to have.