سؤال

Is there a way to make Vim work like notepad++ with explorer plugin or other text editors as pspad, ultraedit and editplus?

that is

keep a fileexplorer always left (left sidebar of 15% width) and opens all files in the content window (85% of width) and every file in a new tab (above).

I checked nerdtree and vimexplorer plugin but could not find any way to do what I want.

هل كانت مفيدة؟

المحلول

Check out NERD Tree. This isn't the best screenshot, but it'll give you an idea of what to expect:

enter image description here

نصائح أخرى

To your question there is definitely many ways you can possibly get the outcome. When you mentioned NERDTree does not work the way you want, I believe you have not tried it out well enough. I would recommend you read the documentation of the NERDTree plugin. Derek's answer just shows you that with NERDTree and minibufexplorer.

One solution I could suggest is have a windows file explorer open beside your gvim window. Follow instructions in the vim.wikia page to open files in a tab when you double click on the file. If you are using Mac, MacVim has an option to open new files in a tab by default.

Now that I have provided a solution, let me remind you that Vim is unlike most of the other editors you might have used earlier. Look at the answer titled "Your problem with Vim is that you don't grok vi.", here. Vim is different, learn to grok it.

Now the point of tabs in Vim. Tabs in Vim are different, look at an answer in SO here. Tabs in vi are more like workspaces. In Linux or Mac you have the concept of workspaces where you can place your application windows together. For example assume I am working on developing a website. In one workspace I would keep my code editor, my web browser and probably a terminal. And for all my personal stuffs I would you another workspace. Like for my social stuffs I would have another workspace with my twitter client, my chat messenger and a browser for facebook. Similarly in Vim use tabs as workspaces for your different files. You might be editing couple of files. Group the ones you edit, use window splits which vim is best for. This is my vim layout:

My Vim layout.

I havent used tabs but use NERDTree, minibufexplorer and serves my need. I don't have to use my mouse at all, it makes my editing more efficient. Take some time reading good articles about Vim. You will see that you actually don't need most of the GUI stuffs many other editors gloat about. Try using Command-T plugin for opening files. You will find it a lot more efficient.

Read the following to get a better idea about tabs, buffers and windows in Vim: http://jonathan.jsphere.com/post/9927807318/taming-vim-4-buffers-windows-tabs http://blog.interlinked.org/tutorials/vim_tutorial.html

I personally use a combination of minibufexplorer and NERDTree, and it works very well for me. minibufexplorer keeps a window at the top with all the files I've opened, which I can switch between using ctrl-tab. NERDTree is open on the left, and choosing a file opens it in my main editor window, and lists it in the minibufexplorer window.

My Vim window, with minibufexplorer and nerdtree

VIM includes netrw, which is already a filebrowser and I like it a lot more than NERDTree.

I have included the function below in my local .alias file. Thus, from a terminal or console execute vc (mnemonics for V.im C.ommander) and you'll get a nice double pane browser with ssh, ftp, file execution and a large array of capabilities.

In SH alike shells try:

vc () 
{ 
    local TARGET='';

    [ -z "$@" ] && TARGET=. || TARGET="$@";
    vim \
    -c "set cursorline" \
    -c vsplit \
    -c "normal gh" \
    -c "let &titlestring=\"netrw\"" \
    -c "set acd" "$TARGET";

    return 0
}

Enjoy!

PS:// If you need netrw filetype definitions (i.e., executing a movie player for movie files and so forth, i'll publish mine)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top