janus icon indicating copy to clipboard operation
janus copied to clipboard

Fugitive commands are not available..

Open RobertAudi opened this issue 12 years ago • 31 comments

When I try to do a :Gstatus I get an error: E492: Not an editor command: Gstatus.

In fact when I do a :G<tab> none of fugitive's commands are listed.

I am using the latest version of Janus

RobertAudi avatar Mar 28 '12 17:03 RobertAudi

Are you typing :Gstatus?

adrianrego avatar Mar 28 '12 17:03 adrianrego

Yes :Gstatus sorry.

RobertAudi avatar Mar 28 '12 17:03 RobertAudi

It works well on my system, please verify that Janus is installed correctly (running rake in the ~/.vim folder usually does it) if not, verify that you did not disable fugitive in your ~/.vimrc.before file

kalbasit avatar Mar 28 '12 19:03 kalbasit

@eMxyzptlk I did that already and it still doesn't work...

RobertAudi avatar Mar 28 '12 19:03 RobertAudi

Could you paste the output of :echo g:janus_disabled_plugins ?

kalbasit avatar Mar 28 '12 19:03 kalbasit

@eMxyzptlk {'pep8': {'reason': 'I don''t use python so I don''t need pep8', 'group': 0, 'path': '/Users/aziz/.vim/janus/vim/tools/pep8'}}

RobertAudi avatar Mar 28 '12 19:03 RobertAudi

Hmmm seems fugitive is not disabled, that's very weird.. do you happen to have it somewhere in your RUNTIME_PATH ? like from your os package manager ?

kalbasit avatar Mar 28 '12 19:03 kalbasit

I'm on OS X Lion and when I echo $RUNTIME_PATH from the terminal I get a blank line as output. I don't know if that's good or not. Anyway, I didn't edit my RUNTIME_PATH, ever.

RobertAudi avatar Mar 28 '12 19:03 RobertAudi

Well if you're on osx lion, unless you messed with your installation, you won't have another copy of the fugitive plugin, does :echo g:pathogen_disabled includes fugitive ?

kalbasit avatar Mar 28 '12 19:03 kalbasit

Nope...

RobertAudi avatar Mar 28 '12 19:03 RobertAudi

Okay well last resort

Backup ~/.janus, ~/.vimrc.before, ~/.gvimrc.before, ~/.vimrc.after and ~/.gvimrc.after (don't worry if you do not have any of these files, once backed up, execute the following:

rm -rf ~/.vim* ~/.gvim* ~/.janus
curl -Lo- http://bit.ly/janus-bootstrap | bash
cd ~/.vim
rake

This will reinstall janus for you, do not put the files you backed up now instead check if vim loaded fugitive or not.. if it did, then bring the files you backed up one by one until you isolate the problem

kalbasit avatar Mar 28 '12 19:03 kalbasit

I just tried twice on a vanilla janus distribution and it doesn't work...

The weird thing that I manage to spot is that, first of all, :help fugitive works, and second of all, if I run :help fugitive followed by any fugitive command, it kind of works, but not so much; let me explain: the command is found and run but it says that the repo is clean even though it isn't (for :Gstatus that is)...

RobertAudi avatar Mar 28 '12 20:03 RobertAudi

I just tried to install vim-fugitive on a vanilla vim and it works fine. The problems definitely comes from janus...

RobertAudi avatar Mar 28 '12 21:03 RobertAudi

Last update of the day: if I run vim it works. If I run vim . it doesn't!!!

RobertAudi avatar Mar 28 '12 21:03 RobertAudi

Seems to be related to NERDTree. Ran into the same issue with just NERDTree and vim-fugitive on a vanilla vim install.

If you don't use NERDTree, you can disable it and vim-fugitive should work fine. Add call janus#disable_plugin('nerdtree') to ~/.vimrc.before

/cc @scrooloose

adrianrego avatar Mar 28 '12 23:03 adrianrego

I can't stop using NERDTree, it's part of my workflow, but using vim instead of vim . works for me, for now...

But I won't close this issue because there is clearly something wrong there.

RobertAudi avatar Mar 29 '12 20:03 RobertAudi

@AzizLight My advise is to change your workflow, navigating through NERDTree is a lot slower than Ctrlp (or good old :edit) because you have to look for something, instead of a couple of keystrokes.. The only and I mean the only use case I have for NERDTree is when I am browsing a codebase that I do not know, NERDTree is better than Finder/Terminal but it is far worse than CtrlP..

As @garybernhardt puts it in his SOME VIM TIPS screencast "The slowest thing you can do, is have to read something, the faster thing you can do, is scan the shape of something but the best thing you could do is to just do it" (Excellent screencast BTW) and that's exactly what CtrlP (although he talk about CommandT but it's basically the same) is, using at least three keystrokes you can get to a file (like <D-t>amcom<CR> will open app/modela/company.rb how cool is that right?)

P.S: If you'd like to continue discussing or arguing this topic, please do so on the mailing list

kalbasit avatar Mar 29 '12 22:03 kalbasit

Hey guys,

I have made a change to the nerdtree and sent @tpope a pull request for fugitive that will add fugitive commands to nerdtree buffers.

scrooloose avatar Apr 02 '12 14:04 scrooloose

Not sure if this has been solved for @AzizLight but I'll write my experience since the issue is still officially open.

I thought I had the same problem but then I went through the fugitive docs and it clearly states that you need to have a file that is already in the repo open in the buffer to have access to any of the commands. What fooled me was that after I staged or added a file to the repo, I still had no access to the commands. This is because fugitive doesn't recognize the file automatically (as testified by the lack of repo name in the status line from fugitive#statusline()). If you close the buffer and reload it then the commands are available (and the repo shows up in the status line).

This is an annoying but bearable issue, and I think it's with fugitive rather than Janus.

ergelo avatar May 02 '12 14:05 ergelo

I am experiencing this same issue using Fugitive and NERDtree

christian-oudard avatar Sep 17 '12 00:09 christian-oudard

This is still a problem now.

MarioRicalde avatar Oct 15 '12 14:10 MarioRicalde

I just ran into this problem as well. I love fugitive, but it's much less practical if I have to Google around, find a workaround, and figure out how to implement it before I can use the plugin. I suspect that many would be put off and just decide "it doesn't work."

monotasker avatar Feb 01 '13 21:02 monotasker

Relates to Issue #298. Starting vim with -f parameter also disables all G commands. Ubuntu's default gvim.desktop launcher executes: gvim -f %F to handle dropped files. This somehow disables all fugitive commands. Workaround by changing the launcher command. Hope this helps.

alxarch avatar Feb 09 '13 13:02 alxarch

This is still an issue if running vim . Fugitive seems to work from the NerdTree buffer, but not from any other buffer, however, it splitting into the narrow NerdTree buffer is not very user friendly :)

randomm avatar Nov 25 '14 06:11 randomm

Solution: Fugitive commands available in all buffers

Fix: Removed -buffer in fugitive.vim

https://github.com/tpope/vim-fugitive/pull/652

John-Appleseed avatar Jun 07 '15 13:06 John-Appleseed

I still have this issue using NerdTree at the same time with fugitive.

jagajaga avatar Oct 09 '15 16:10 jagajaga

I have noticed that there are problems when you vim files that have been soft linked (i.e. ln -s). I have my dotfiles on github and link them to ~ so that I can easily modify them. It's not a big problem because I can just go to the git folder they are stored in and do stuff, but I thought I would bring it up.

An interesting thought would be to make my home dir a git repo and then ignore almost everything in it. :) But it would be nice to Gdiff soft-linked files.

archmint avatar Oct 23 '15 14:10 archmint

Agree with @archmint I face the same problem. I choose to map !git add %. I refuse to have a git repo at ~. Too messy

tricktux avatar Apr 21 '16 18:04 tricktux

Strangely enough... What I ended up doing was making an alias for editing all of my most used dot files. So, like... alias vz='f=$(readlink -f $HOME/.bashrc); cd ${f:h}; vim $f; cd - > /dev/null will go to the homefolder of my bashrc dot file. NOTE THAT IS IN MY ZSHRC HENCE THE ${f: h} (can't do in bash). In my bashrc, I have alias vb=' f=$(readlink -f $HOME/.bashrc); cd $(dirname $f); vim $f; cd - > /dev/null. I know it's pretty strange, but it suits my needs the best, since I am always adding random things to a lot of different dot files.

dylnmc avatar Apr 21 '16 19:04 dylnmc

Ah yes... I am archmint. Sorry for the confusion. And you can check out my dot files on my repo if ya want. Idk they're kind of useful maybe.

dylnmc avatar Apr 21 '16 19:04 dylnmc

Opened an issue for soft links https://github.com/tpope/vim-fugitive/issues/989

Using the FollowSymlink autocmd causes autocmd fugitive to not load the buffer commands and b:git_dir

" Follow symlink to open actual file
autocmd BufReadPost * call FollowSymlink(expand('<afile>'))

Symlink Issue 1

  1. start vim
  2. open symlink file
  3. :Gwrite E492: Not an editor command: Gwrite

Nonsymlink Success

  1. start vim
  2. open non-symlink file
  3. :Gwrite :Works!

Symlink Issue 2

Opening a nonsymlink file will load the :Gwrite function, which will then work on the symlink file. However the b:git_dir isn't loaded so :Gwrite throws an error

Error detected while processing function <SNR>115_Write[5]..<SNR>115_buffer[6]..<SNR>115_throw:
line    2:
E605: Exception not caught: fugitive: not a git repository: /Volumes/Work/.do/Dotfiles/vimrc
Error detected while processing function <SNR>115_Write:
line    5:
E171: Missing :endif

Workaround is to reload the file after FollowSymlink was executed.

:e
:Gwrite

John-Appleseed avatar Jan 16 '18 23:01 John-Appleseed