I want to: Automaticaly close Lexpore after opening a file for better experience but I don't know vim script. It shouldn't be hard, I suppose. I will appreciate any comment!
I'm now learning vim script and trying to do it. here is where I've got by now:
:autocmd <Lexplore> * :<Lexplore-exit>
or
if <command-mode> == "Lexplore *.*"
excute \\close last buffer. (because now I am in new buffer)
I just need to know how to say "RUN" / "RUNED" in script then i use regex for anyfile and i need to say "CLOSE".
The truth is I'm actually Hopeless! :)))))))))))))
There are other avenues to try before going full-on with VimScript. In this case, a simple mapping would probably be enough.
Basically, the right-hand side of a mapping is just a macro, a sequence of commands that you would type yourself, which makes mappings a very good and approchable way to discover Vim automation.
Assuming a simple layout, with only one window, how do you do what you describe manually?
:Lexploreand browse around.<CR>to open the file.<C-w>p.<C-w>q.Steps 2-4 above are easy to turn into a mapping (
<key>is a placeholder, use what you want):But that mapping will be available everywhere, which may not be a good idea. Enters the notion of filetype plugins:
Create these directories if they don't already exist:
Create a
netrw.vimfile in the directory above:Put the mapping above in that file:
The
<buffer>tells Vim to only define that mapping inNetrw.This is the simplest approach, which may or may not work for you.
A few notes regarding your comments…
:Lexplore.:Explore,:Sexplore,:Vexplore, and:Texploreare much more useful.:help netrw-t.