Unknown function error when opening Vim with 'git commit' command but not with 'vim' command
When I open Vim from the command line with vim
, my _vimrc file runs without an error. When git commit
opens vim as its editor, the following error occurs:
C:devsettings>git commit
hint: Waiting for your editor to close the file...
Error detected while processing /c/Users/me/_vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue
Why does pathogen#infect()
cause an error when git opens vim? How do we fix this?
git vim command-line
add a comment |
When I open Vim from the command line with vim
, my _vimrc file runs without an error. When git commit
opens vim as its editor, the following error occurs:
C:devsettings>git commit
hint: Waiting for your editor to close the file...
Error detected while processing /c/Users/me/_vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue
Why does pathogen#infect()
cause an error when git opens vim? How do we fix this?
git vim command-line
add a comment |
When I open Vim from the command line with vim
, my _vimrc file runs without an error. When git commit
opens vim as its editor, the following error occurs:
C:devsettings>git commit
hint: Waiting for your editor to close the file...
Error detected while processing /c/Users/me/_vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue
Why does pathogen#infect()
cause an error when git opens vim? How do we fix this?
git vim command-line
When I open Vim from the command line with vim
, my _vimrc file runs without an error. When git commit
opens vim as its editor, the following error occurs:
C:devsettings>git commit
hint: Waiting for your editor to close the file...
Error detected while processing /c/Users/me/_vimrc:
line 1:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue
Why does pathogen#infect()
cause an error when git opens vim? How do we fix this?
git vim command-line
git vim command-line
asked Nov 18 '18 at 1:58
Shaun LuttinShaun Luttin
59.1k33227287
59.1k33227287
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Git ships with its own copy of Vim, and that one is built with Unix-style paths, so it looks for your plugins (like Pathogen) in ~/.vim/
instead of ~/vimfiles
.
Duplicating your configuration is one way to solve it, but then you'll have to maintain both in parallel. I think a better approach is to make all Vim versions use the same configuration, by adapting the 'runtimepath'
inside your ~/.vimrc
. The following fragment (to be put at the top of your ~/.vimrc
) will make Windows use the Unix-style paths:
" On Windows, also use ~/.vim instead of ~/vimfiles; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
let &runtimepath = substitute(&runtimepath, 'CV' . escape($HOME.'/vimfiles', ''), escape($HOME.'/.vim', '&'), 'g')
if exists('&packpath')
let &packpath = &runtimepath
endif
endif
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
add a comment |
As illustrated in issue 687, that means vim, as executed in a git bash context, does not recognize pathogen.
vim-pathogen
might help- but another alternative on Windows is to configure your editor to anything else but vim.
add a comment |
Based on VonC's suggestion, my initial fix was to have both ~/.vim
and ~/vimfiles
.
PS> Copy-Item ~vimfiles ~.vim -Recurse
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357254%2funknown-function-error-when-opening-vim-with-git-commit-command-but-not-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Git ships with its own copy of Vim, and that one is built with Unix-style paths, so it looks for your plugins (like Pathogen) in ~/.vim/
instead of ~/vimfiles
.
Duplicating your configuration is one way to solve it, but then you'll have to maintain both in parallel. I think a better approach is to make all Vim versions use the same configuration, by adapting the 'runtimepath'
inside your ~/.vimrc
. The following fragment (to be put at the top of your ~/.vimrc
) will make Windows use the Unix-style paths:
" On Windows, also use ~/.vim instead of ~/vimfiles; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
let &runtimepath = substitute(&runtimepath, 'CV' . escape($HOME.'/vimfiles', ''), escape($HOME.'/.vim', '&'), 'g')
if exists('&packpath')
let &packpath = &runtimepath
endif
endif
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
add a comment |
Git ships with its own copy of Vim, and that one is built with Unix-style paths, so it looks for your plugins (like Pathogen) in ~/.vim/
instead of ~/vimfiles
.
Duplicating your configuration is one way to solve it, but then you'll have to maintain both in parallel. I think a better approach is to make all Vim versions use the same configuration, by adapting the 'runtimepath'
inside your ~/.vimrc
. The following fragment (to be put at the top of your ~/.vimrc
) will make Windows use the Unix-style paths:
" On Windows, also use ~/.vim instead of ~/vimfiles; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
let &runtimepath = substitute(&runtimepath, 'CV' . escape($HOME.'/vimfiles', ''), escape($HOME.'/.vim', '&'), 'g')
if exists('&packpath')
let &packpath = &runtimepath
endif
endif
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
add a comment |
Git ships with its own copy of Vim, and that one is built with Unix-style paths, so it looks for your plugins (like Pathogen) in ~/.vim/
instead of ~/vimfiles
.
Duplicating your configuration is one way to solve it, but then you'll have to maintain both in parallel. I think a better approach is to make all Vim versions use the same configuration, by adapting the 'runtimepath'
inside your ~/.vimrc
. The following fragment (to be put at the top of your ~/.vimrc
) will make Windows use the Unix-style paths:
" On Windows, also use ~/.vim instead of ~/vimfiles; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
let &runtimepath = substitute(&runtimepath, 'CV' . escape($HOME.'/vimfiles', ''), escape($HOME.'/.vim', '&'), 'g')
if exists('&packpath')
let &packpath = &runtimepath
endif
endif
Git ships with its own copy of Vim, and that one is built with Unix-style paths, so it looks for your plugins (like Pathogen) in ~/.vim/
instead of ~/vimfiles
.
Duplicating your configuration is one way to solve it, but then you'll have to maintain both in parallel. I think a better approach is to make all Vim versions use the same configuration, by adapting the 'runtimepath'
inside your ~/.vimrc
. The following fragment (to be put at the top of your ~/.vimrc
) will make Windows use the Unix-style paths:
" On Windows, also use ~/.vim instead of ~/vimfiles; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
let &runtimepath = substitute(&runtimepath, 'CV' . escape($HOME.'/vimfiles', ''), escape($HOME.'/.vim', '&'), 'g')
if exists('&packpath')
let &packpath = &runtimepath
endif
endif
answered Nov 19 '18 at 8:16
Ingo KarkatIngo Karkat
132k14148198
132k14148198
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
add a comment |
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
That seems more precise than my answer. +1
– VonC
Nov 19 '18 at 8:33
add a comment |
As illustrated in issue 687, that means vim, as executed in a git bash context, does not recognize pathogen.
vim-pathogen
might help- but another alternative on Windows is to configure your editor to anything else but vim.
add a comment |
As illustrated in issue 687, that means vim, as executed in a git bash context, does not recognize pathogen.
vim-pathogen
might help- but another alternative on Windows is to configure your editor to anything else but vim.
add a comment |
As illustrated in issue 687, that means vim, as executed in a git bash context, does not recognize pathogen.
vim-pathogen
might help- but another alternative on Windows is to configure your editor to anything else but vim.
As illustrated in issue 687, that means vim, as executed in a git bash context, does not recognize pathogen.
vim-pathogen
might help- but another alternative on Windows is to configure your editor to anything else but vim.
answered Nov 18 '18 at 2:04
VonCVonC
839k29426543196
839k29426543196
add a comment |
add a comment |
Based on VonC's suggestion, my initial fix was to have both ~/.vim
and ~/vimfiles
.
PS> Copy-Item ~vimfiles ~.vim -Recurse
add a comment |
Based on VonC's suggestion, my initial fix was to have both ~/.vim
and ~/vimfiles
.
PS> Copy-Item ~vimfiles ~.vim -Recurse
add a comment |
Based on VonC's suggestion, my initial fix was to have both ~/.vim
and ~/vimfiles
.
PS> Copy-Item ~vimfiles ~.vim -Recurse
Based on VonC's suggestion, my initial fix was to have both ~/.vim
and ~/vimfiles
.
PS> Copy-Item ~vimfiles ~.vim -Recurse
edited Nov 19 '18 at 17:45
answered Nov 18 '18 at 2:14
Shaun LuttinShaun Luttin
59.1k33227287
59.1k33227287
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357254%2funknown-function-error-when-opening-vim-with-git-commit-command-but-not-with%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown