My setup is:
Windows7 SP1 (Enterprise)
gVim 7.3
Whenever I open a file, Gvim will create 2 folders in the same folder as the file is located. The folders' names are Files and (x86). This only started happening recently. Any idea what could be causing this?
My _vimrc files is as follows
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
behave xterm
set ic
set nu
set ai
set noswapfile
set nobackup
source $VIMRUNTIME/colors/darkblue.vim
set expandtab " expand tabs
set shiftwidth=3
set softtabstop=3
set ruler " show the cursor position all the time
source $VIMRUNTIME/plugin/linuxsty.vim
Do you have any plugins installed? Then try running without them (--noplugin argument), also try a plain Vim gvim -N -u NONE.
It looks like some plugin doesn't do proper quoting of an argument.
You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for suspect commands.
Related
I am on windows 10. I set up my files like this.
~/.vimrc
set nocp
source ~/vimfiles/autoload/pathogen.vim "location of my pathogen.vim
call pathogen#infect()
call pathogen#helptags()
autocmd vimenter * NERDTree
syntax on
filetype plugin indent on
~/vimfiles/autoload/pathogen.vim
~/vimfiles/bundle/nerdtree
When I open via the desktop application Vim I can use the :NerdTree command okay, I can also use other pluings, but when I open the vim editor from git bash or cmd.
One thing to note is that I do not need the autocmd vimenter command to run :NERDTree in Vim application, but it errors when I try to open :NerdTree from the vim editor.
Any ideas for what I can check?
On Windows, Vim expects your vimrc to be in either of these two locations:
%UserProfile%\_vimrc (note that it's a _, not a .),
%UserProfile%\vimfiles\vimrc (note that there's no _ or . anymore).
The latter is generally recommended because it allows you to keep all your Vim stuff under a single, easy to move around, directory.
Once you have moved your vimrc to a correct location you can remove the first line which is completely useless as Vim sets the nocompatible option itself when it finds a vimrc at an expected location.
See :help vimrc and :help 'nocompatible'.
The second line is also useless because lines 3 and 4 use a feature called "autoloading" through which Vim already knows where to find those functions.
See :help autoload.
I just did a clean (re)install of Vim (Downloaded from vim.org/download.php, used the gvim73_46.exe installer. Version is 7.3 (patches 1-46)
The only changes to my _vimrc are to set line numbers, lines, columns, and enable syntax.
Everytime I edit a file with vim, save it and close it (:wq), a new _viminfo file is created in that files directory.
Also, the backup *.*~ files and .swp files persist, and arn't cleared upon saving. Running Windows 7 enterprise.
This really clutters everything - and is a pain trying to open a file for which a .swp file exists..
Help?
disable viminfo file:
set viminfo="NONE"
disable swap file:
set noswf
disable backup :
set nobk
set nowb
more details:
:h 'swf'
:h 'bk'
:h 'wb'
:h 'viminfo'
That's strange; the viminfo file should be written in your home directory, nowhere else:
The default name of the viminfo file is "$HOME/.viminfo" for Unix and OS/2,
"s:.viminfo" for Amiga, "$HOME_viminfo" for MS-DOS and Win32. For the last
two, when $HOME is not set, "$VIM_viminfo" is used. When $VIM is also not
set, "c:_viminfo" is used. For OS/2 "$VIM/.viminfo" is used when $HOME is
not set and $VIM is set.
It appears as if your %HOME% variable (or the %HOMEDRIVE%%HOMEPATH%) isn't properly set.
I'm using Emacs 24.3 on Windows 8. I want to be able to right-click a file and select "Edit with Emacs" and have the file open in an existing emacs frame. All steps I have done so far are listed below. Most of it was taken direction from the Emacs documentation page for Windows.
The following are the registry keys I used to add "Edit with Emacs" to my context menu:
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
#="&Edit with Emacs"
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
#="C:\\Portable Software\\emacs-24.3\\bin\\emacsclientw.exe -n \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
#="Edit &with Emacs"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
#="C:\\Portable Software\\emacs-24.3\\bin\\emacsclientw.exe --alternate-editor=\"C:\\Portable Software\\emacs-24.3\\bin\\runemacs.exe\" -n \"%1\""
I also set the ALTERNATE_EDITOR environment variable to C:\\path\\to\\runemacs.exe
At the beginning of my .emacs I have added the following code per this answer.
(require 'server)
(or (server-running-p)
(server-start))
Adding that got rid of the "server already running" error when opening a second file, but it still opens in a new frame.
So what am I missing to get emacs to open new files in the existing frame?
I accidentally figured this out while trying to fix synctex with SumatraPDF. It would appear that in addition to the ALTERNATE_EDITOR environment variable pointing to runemacs.exe, you must also create an EMACS_SERVER_FILE environment variable that points to the server file (mine was stored in the .emacs.d\server directory). Once I did that, files that I tell to Open with Emacs opened in the existing frame rather than creating their own.
This worked for me.
Create C:\Program Files\runemacs.bat with the following contents:
#echo off
:: Set the path to where the Emacs binaries are
set binpath=C:\Program Files\emacs-26.1-x86_64\bin
:: If no arg is given edit this file
if "%~1"=="" (
set filename="C:\Program Files\runemacs.bat"
) else (
set filename="%~1"
)
:: Run Emacsclient
"%binpath%\emacsclientw.exe" --no-wait --alternate-editor="%binpath%\runemacs.exe" %filename%
And open all files via C:\Program Files\runemacs.bat instead of C:\Program Files\emacs-26.1-x86_64\bin\runemacs.exe.
It seems that emacsclient is failing to connect with the server and starting a new instance of emacs each time. You may need to unblock something in any software firewall you have installed.
When I open a file with vim or gvim from console on windows that is located in a sub directory (e.g. gvim subdir/file), it creates a new file at subdir\subdir\file saying "subdir\file" [New DIRECTORY] instead of simply opening the existing file at subdir\file.
This happens since I added the following line to my vimrc:
set enc=utf-8
Is there a possibility to open and create files in UTF-8 mode on Windows without this issue?
You may also look at my vimrc file.
Thank you for any help.
Change the order of the autochdir and encoding options in your vimrc. First set the encoding then autochdir
set enc=utf-8
set autochdir
An explanation can be found here
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