Using VIM on Windows to access windows server share directory - windows

In Windows Explorer I can navigate to "\\servername\shared_directory". Is there any way I can navigate to the same directory using VIM and NERDTree?
Example:
:NERDTree \\servername\shared_drirectory

I think you might want to report this behavior to the NERDTree developer. I tried it myself and no, it does not work.
You could try pulling the current NERDTree from https://github.com/scrooloose/nerdtree or writing the developer.

I don't use NERDTree, but both :browse e \\servername\shared_directory and :e \\servername\shared_directory\filename.txt work fine for me in gvim.
Playing with this a bit more, I see that the forward-slash syntax seems to even work with tab-completion (after I get the server and initial directory right, of course).
If NERDTree doesn't want to work with either //servername/directory or \\servername\directory, you might want to try executing a :lcd //servername/directory first, followed by :NERDTree ..

This issue was fixed in this branch : https://github.com/actionshrimp/nerdtree .
Download nerdtree from https://github.com/actionshrimp/nerdtree/downloads

Related

I seem to have two different Vim environments. What is causing this?

I am trying to set up a development environment on Windows 10. So far I've installed Vim and Cmder (the full version with Git for Windows).
Playing around, I noticed some strange behavior which I don't understand, but I feel like it is important that I understand.
Case A
I open PowerShell
Locate the folder that contains vim.exe
Run .\vim.exe
Vim pops up and displays the default screen (VIM - Vi IMproved, version 8.1.1, etc.)
In Normal Mode I type :version to check the version number and to see where my _vimrc file is located
Vim gives me the expected output
Case B
I open Cmder and open a new PowerShell tab (I am assuming that that gives me access to the PowerShell instead of the default cmd.exe, but please correct me if I am wrong.)
NOW THIS IS WHERE IT GETS INTERESTING
If I repeat steps 2-6 exactly as in Case A, I get exactly the same result.
BUT:
If instead of locating the folder that stores vim.exe I just type in vim and hit Enter it opens Vim once again, but this time it has a tab on the bottom that says "unix". See attached images.
Out of curiosity, in Normal Mode I type :version, just like in Case A, but this time I am getting a different date in the version section, a different selection of options, and a different Unix-like path to the vimrc file which in now .vimrc instead of _vimrc.
What gives? My guess is that Git for Windows that came with Cmder is simulating a Unix environment and accessing a different Vim version that was compiled for Unix?
If this is true, then could you help me make sense of this Windows/Unix environment duality? Do I now have two HOME folders, two copies of the vimrc file, and two copies of who knows what else? What is simulating this Unix environment - Cmder?
Thanks!
I don't have experience with Cmder, but I use Git for Windows a lot.
Git for Windows comes with some Unix utilities and uses Cygwin which is Unix emulator for running those. Vim is among them as default text editor for commit messages, etc. So it might be it.
I tried to reproduce this on my machine. but I cannot reproduce what you are seeing. Nonetheless I found the vimrc file for the Vim you are probably using in the second case.
It is in <Cmder-dir>\vendor\git-for-windows\etc\vimrc.
You have two different versions of Vim installed, and depending on the environment you start it from, one or the other gets selected. Git (as a tool that initially was developed on and for Linux) typically brings with it a set of Windows-ports.
You can check what Vim binary is used (respectively) from within Vim via
:echo v:progpath
Whether you live with this duplication or try to consistently use one Vim instance is up to you. It looks like the Vim that accompanies Git has more Unix-centric settings; it might be good to keep that to avoid interoperability issues.
You definitely don't need to clone your whole Vim configuration - as long as you stick to Unix-style (LF) line endings, it can be understood by any Vim. By setting the HOME environment variable (but that may affect other programs!), you can make Vim use the same location. Else, you could give one Vim config location a small .vimrc that just corrects 'runtimepath', and then :sources the "real" vimrc from the other location.

How to launch babun in a specified directory via the command line

now I'm currently using Visual Studio Code and I wanted to make the terminal use babun instead of the default cmd.exe
In fact, I have already managed to do that in theory - the problem is that, unlike with cmd.exe, the directory that I'm in upon starting the terminal is no longer the currently open project, it's just simply /home/myusername (i.e. a path in babun's directory tree).
This kinda sucks, since I don't really want to navigate to my directory every time.
Next, I also found out how to tell babun (in my case, zsh.exe) to use a default directory such as C:/ by adding cd /cygdrive/c to the end of .zshrc - Unfortunately, that's not what I want either, since I don't want babun to always use the same directory.
Now I figured that, seeing as this would be the most comfortable option with VSC*, there might be some console argument that tells zsh.exe to use a specific directory. Sadly, I couldn't find anything, hence this question.
Weirdly enough
Anyone know how to help me out? Appreciate the help :)
*VSC allows you to specify the path to your shell, as well as an array of arguments that will be passed.
You could place your directory into a cmd file and run it as a shell:
d:
#rem note that's important to change the drive 'permanently'
cd d:\home
zsh.exe
And then specify this cmd file as shell to invoke.
Open the desired directory in a file explorer, right click, then select Open Babun here.
Babun currently does not natively support a command line parameter specifying the directory to launch in.
However, there is a pull request in the Babun GitHub which solves the issue. Unfortunately, it doesn't seem to be likely to be accepted anytime soon, though.
To gain access to the feature manually, check out the pull request.

Open chrome with cygwin

I am using a cygwin shell in windows 10. I am trying to figure out how to open chrome from the command line. I have tried typing chrome, google-chrome, chromium-browser, start chrome, open chrome, and many variations. I have even tried using my python shell, and I have also tried going to the folder where chrome.exe is located and opening it from there. The main reason I want to figure it out is because I plan to write HTML documents with python and then open them in chrome. Any ideas?
Did you try ./chrome.exe while being in the directory where the file is located? The path ./ is probably needed before the file name since the executable is not in a standard system path. You can of course also specify the full path to the file as well.
Use
cygstart "C:\path\to\chrome.exe"
or to open a specific URL,
cygstart "http://my/url.htm"

Read only for open directories in vim

Then I open vim from terminal and open an directory like vim ., my starts in Read Only Mode.
I cant figure out why this happen and how I can change it.
If I start MacVim everything is fine. But then I start vim from the terminal and open a directory this screen comes. I can navigate one dir up and back again, and I have write access.
EDIT
I installed all my vim settings on Ubuntu 15.04. Now I can use
Does anybody know how to change this behaviour of vim?
Now I can use netw with the command vim . like I always used.
As you can see, there is no RO (read only) mark. How can
I have this in Mac on iTerm too?
What you see is exactly what you are supposed to see when doing $ vim .: the built-in netrw plugin displays a listing of the current directory that you can use to navigate your project.
If you don't want that listing, don't ask for it:
$ vim
or:
$ vim file
ctrl-p is not mapped by netrw; on my system, its set up by the yankring plugin. If vim is doing something other than going up one line, then you have a plugin involved. Try using :map to see what its mapped to; then do a search for that in your plugins directory.
The netrw way of opening a file in the same window is to use the <enter> key, although the g:netrw_browse_split variable may be used to change that default behavior.
Netrw opens in read-only mode, and that's not going to change. The file being opened should not be in read-only mode, however, if that's what you meant. If you're having a problem of that sort, please update your netrw; the most up-to-date version is at http://www.drchip.org/astronaut/vim/index.html#NETRW .
After I installed macvim 7.4 Every thing works!

Git bash black screen (windows)

I am trying to access git bash, but nothing happens (black screen). I used git bash many times during September and October, but when I tried today it did this. What can I do to solve this?
Thanks.
Have you had Cygwin installed? I was having this exact issue, then I found out I still had a "etc" and "bin" directories in my user folder on Windows. After removing these (As I didn't want Cygwin) GitBash worked for me again :)
Perhaps as a temporary solution you could navigate to C:\Program Files (x86)\Git\bin using the windows cmd line and execute git.exe. For me Im able to perform gitbash functions, just not with the lovely unix like syntax and interface.
Also if you include gitbash to be written to your PATH during install, the win cmd line still works.

Resources