Closed habamax closed 5 years ago
autocmd BufEnter * silent! lcd %:p:h
This command is evil, please do not use it.
I know, I don't use it. The main issue is with vim-rooter which essentially does (I think :) ) the same under the hood -- changes working directory whenever you open a file.
And because I use windows and gvim -- my workflow is mostly out of cmd line -- so my starting working directory is almost always the path vim is installed in. That is very inconvenient, and to make life easier you might start using autochdir, autocmd with lcd or vim-rooter.
PS I have tried the same with CtrlP and fzf -- they don't have that problem. But even with this annoying issue, your plugin is more convenient to me
I think you should change your workflow. I also work on Windows sometimes, I have never encountered this issue. So I don't need vim-rooter. My workflow is:
Vim Here
How to add the Vim Here
to right-click menu?
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\edit with vim8.0]
@="Edit with vim8.0"
"Icon"="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""
[HKEY_CLASSES_ROOT\*\Shell\edit with vim8.0\command]
@="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Shell\edit with vim8.0]
@="Edit with vim8.0"
"Icon"="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""
[HKEY_CLASSES_ROOT\Directory\Shell\edit with vim8.0\command]
@="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\Vim8.0 Here]
@="Vim8.0 Here"
"Icon"="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\Vim8.0 Here\command]
@="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""
[HKEY_CLASSES_ROOT\Drive\Shell\edit with vim8.0]
@="Edit with vim8.0"
"Icon"="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""
[HKEY_CLASSES_ROOT\Drive\Shell\edit with vim8.0\command]
@="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\" %1"
Save the text above in a file named, for example, vim.reg
. Run this file.
(Of course you can customize C:\\Program Files\\Vim\\vim80\\gvim.exe
)
I have "Vim here", but it really is inconvenient for me.
I usually <Win>gvim<Enter>
and then open files/projects needed.
Well, okay. I can see a couple ways to workaround my problem:
Anyway, thanks!
Fixed in dev branch, please have a try.
YES!
It is fixed! Thank you very much, really appreciated!
vim --version
ornvim --version
::echo g:Lf_Debug_Cmd
:echo has("python")
: 0:echo has("python3")
: 1:echo &pythondll
(only vim, not neovim): python27.dll:echo &pythonthreedll
(only vim, not neovim): python37.dll:py print(sys.version)
: error:py3 print(sys.version)
:3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
:echo g:Lf_Debug_Cmd
:git ls-files && git ls-files --others --exclude-standard -x ".svn" -x ".hg" -x "*.sw?" -x "~$*" -x "*.bak" -x "*.exe" -x "*.o" -x "*.so" -x "*.py[co]" -x "*.tmp"
Describe your question, feature request, or bug.
When you have
then second
:LeaderfFile DIR
fails to open correct file.The same happens if you have
vim-rooter
plugin installed.Steps to reproduce
with autocmd:
:LeaderfFile DIR1
:leaderfFile DIR2
with vim-rooter:
The same as with autocmd but DIR1 and DIR2 should be under git -- so vim-rooter will change cwd.
Actual behaviour
Empty file with the chosen file name is opened at incorrect path.
Expected behaviour
Choosen file should be opened.