Command in Vim to know where it's installed - windows

I just wondering if is there a command in vim that shows you the folder where it's installed? I want something to useful for windows.
Thanks in advance.

$VIMRUNTIME points to a directory where most of the files needed by Vim are kept.
Try in vim :echo $VIMRUNTIME.
Thanks #romainl $VIM variable more to the point.

Related

How to set the $EDITOR to Brackets

I am trying to set my default editor to Brackets in the Terminal. I tried with
export EDITOR="/Applications/Brackets.app"
and when I try to edit a function from the MongoDB Shell it complains that the editor is a directory. I tried giving different paths, but I cannot find the right combination. Please help, I don't want to edit in the Terminal :) :) :)
I'm not on a mac, but I was able to download and examine the contents of the Brackets installer and Brackets.app is indeed a directory. Have you tried
export EDITOR=/Applications/Brackets.app/Contents/MacOS/Brackets
or something similar?

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.

Cygwin terminal prompt missing

Previously, when launching the Cygwin terminal, a console will popup and the line will say:
username#PCName ~ then a blinking cursor after $.
Now a blank console appears and nothing is on the console screen but a blinking cursor...
The shortcut seem to be directing to the right path "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -" so I don't know what's going on.
How do I go about fixing this issue? Do I have to look into the Environment variables? If so what do I have to look for?
I'm running Windows XP Professional x86.
Try changing the shorcut to this:
C:\cygwin\bin\mintty /bin/env CHERE_INVOKING=1 /bin/bash -l
Since you say it starts up successfully using cmd, it could a problem starting up you mintty environment. Try going into your home directory and deleting (back it up somewhere else if you want to be able to bring it back) the .minttyrc file and then try to start up again.
If that doesn't do the trick, try to go a little bigger and do the same with the bash environment files. Back up .bashrc, .bash_profile, .bash_aliases (if you have it) and .inputrc and replace them with the default sample files that are in the /etc/skel folder, then try to restart again.

Vim: Change start up directory?

When I start GVim and start writing my little program I'd like to save the file to the Desktop but it seems that Vim is starting the command line in:
C:\Windows\System32
How would I go about changing that to:
C:\Users\Casey
so then I could just:
:w Desktop\my_program.py
Assuming you're starting gvim from an icon/shortcut in Windows (from the kind of paths you supply), you can change the starting directory (completely independent from the fact that it IS gvim: it would be the same from any other app!) by editing the "starting directory" property of that Windows icon/shortcut.
Within vim, you can change the current directory with the :cd command:
:cd c:\users\casey
I found this way to be better:
Open gVim
:cd $vim
:e _gvimrc
Add the following line:
:cd c:\users\user\desktop\
I found that :Ex is slow on large directories like c:\windows\system32\ (where gVim usually starts).
Also, here is my full _gvimrc in case anyone is interested. I prefer Consolas for coding. The tabstop setting helps when coding especially in Python, and Ctrl+Tab/Ctrl+Shift+Tab is great for switching between buffers:
set guifont=Consolas:h12:cANSI
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
map <C-Tab> :bnext<cr>
map <C-S-Tab> :bprevious<cr>
:cd c:\users\user\desktop\
How about changing your starting position?
vim icon -> right click -> property -> shortcut -> Start in -> your path you want to change.
but it works perfectly.
I think :cd yourpath also works. but it will change when you don't want to change.
Use :cd c:\users\casey,
after that save into session (in gVim there is button up and down in red, click on it and save as mySessionProject.vim). Next time you need to go to that directory, open that session (you can also use :source mySessionProject.vim)
for command line:
:mksession! yourdir/yourVimConfName.vim
to load
:source yourDir/yourVimConfName.vim
I found the following to be very useful. I am on Windows 7 and vim 7.3.46, and am using gVim.
I edited startup settings, which wound up altering the _vimrc in c:\Users\me\.
I also tried using :version and editing the _vimrc files I found at $VIM, as well as the _vimrc I found at c:\windows\system32.
Editing those files to include :cd c:\Users\me did not result in my default startup directory changing after starting vim. I wanted my default directory to be c:\Users\me\, and editing c:\Users\me\_vimrc achieved that. That is I entered
:e $MYVIMRC
and added
cd c:\Users\cnorton.Arlington1\
to that file.
Just to to put this up incase anyone needs it:
vimrc accepts enironmental parameters. you can put cd $USERPROFILE in your vimrc
Use this mapping in your .vimrc file
:cd $USERPROFILE\Desktop<cr>
or the same shorter
cd ~\Desktop<cr>
A mapping that also displays afterwards the path instead of the command
nmap <leader>d :cd ~\Desktop<cr>:pwd<cr>
Inside init.vim, I use:
lcd $HOME/Projects

Resources