Giter Club home page Giter Club logo

agit.vim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agit.vim's Issues

set filetype after defining buffer-local mappings

filetypeをセットするのは、マッピングを設定したあとにしなくてはいけません。なぜかというと、

autocmd FileType agit nunmap <buffer> <C-k>

のような設定をできるようにするべきだからです。

cat-file のコマンドを変更できるオプションが欲しい

超レアケースなのはわかっているのですが、、、 AgitFile での diff 表示時に、内部で発行されているのは現状 cat-file かと思います。
が、cat-file だとutf8以外のファイルを扱う際、--textconv を扱えないので文字化けが発生します。(set encoding や LANG を変更すればもちろん解決する話ですが。。。)
そこで、 --textconv を処理できる show-file --textconv [rev]:file に変更できるようなオプションを追加 or catfile 実行する際のコマンドラインを設定できるようなオプションを追加頂きたいです。

参考:http://qiita.com/mather314/items/a6b4bad59e2edd659dd4

Suggestion: mapping <C-g>

これは問題ではなくて提案です。
<C-g> を押すと、コミットメッセージをechoしてくれると嬉しいと思います。
(特に、下の画像みたいに...になってしまうことがあるので)
screen shot 2014-11-07 at 3 45 06 pm

(vimfilerだとカーソル位置のパスを表示してくれます。)

(too many logs)にカーソルがあるときのagit_diff

(too many logs)にカーソルがあるとき、一番上のコミットのagit_diffが表示されているようです。一番下に表示されているコミットのdiffを表示するか、何も表示しないほうがいいと思います。

Sometimes :Agit says "Not a git repository" unexpectedly

I use agit.vim in Windows.
And it sometimes says "Not a git repository" unexpectedly.

In get_git_dir(), agit calls git by vimproc#system() instead of system() if vimproc is available, and refers v:shell_error to get result.

But vimproc#system() does not set v:shell_error.
I guess it should be vimproc#get_last_status() when vimproc is available.

use -C instead of --git-dir/--work-tree

gitに渡すオプションとして、--git-dirと--work-treeの代わりに-Cを代わりに使った方がいいのではないかと思うのですが、いかがでしょうか?

例えば、作業ツリーのパスが$ROOTだとして、agitのリポジトリで autoload/agit.vim の履歴を表示しようとした場合、git 1.9.4 では以下のような動作になるようです

# カレントディレクトリがリポジトリルートなら何の問題もない
cd $ROOT
git --git-dir=$ROOT/.git --work-tree=$ROOT log -- autoload/agit.vim  # OK
# カレントディレクトリがサブディレクトリの場合、相対パスでファイルを
# 指定する必要がある
cd $ROOT/autoload
git --git-dir=$ROOT/.git --work-tree=$ROOT log -- autoload/agit.vim  # NG
git --git-dir=$ROOT/.git --work-tree=$ROOT log -- agit.vim  # OK
# カレントディレクトリがリポジトリ外の場合、相対パスではダメで、
# リポジトリルートからのパスを指定する必要がある
cd $ROOT/..
git --git-dir=$ROOT/.git --work-tree=$ROOT log -- agit.vim/autoload/agit.vim  # NG
git --git-dir=$ROOT/.git --work-tree=$ROOT log -- autoload/agit.vim  # OK

そのため、カレントディレクトリの場所によって渡すパスを変えるか、常に絶対パスで指定する必要が(多分)あります。
これに対して、-Cでの指定であれば、カレントディレクトリの位置にかかわらず同じパスで処理できます。

cd $ROOT
git -C $ROOT log -- autoload/agit.vim  # OK
cd $ROOT/autoload
git -C $ROOT log -- autoload/agit.vim  # OK
cd $ROOT/..
git -C $ROOT log -- autoload/agit.vim  # OK

Cannot use on Ubuntu: "Not a git repository."

We cannot use agit.vim on Ubuntu because s:get_git_dir() throws an error.
The command git --no-pager rev-parse --prefix / --git-dir warns that:

fatal: bad flag '--git-dir' used after filename
--prefix
/
--git-dir

Cannot use agit in a directory.

To produce:

git clone https://github.com/cohama/agit.vim
cd ./agit.vim/plugin
vim
:Agit

Error

=  Local uncommitted changes, not checked in to index
+  Local changes checked in to index but not committed
fatal: Not a git repository: '/Users/itchyny/agit.vim//Users/itchyny/agit.vim/.git'

E684 on AgitFile

AgitFileで次のエラーが出ます。 ( agit#launch のtry catchをコメントアウトしています )

Error detected while processing function agit#launch..agit#bufwin#agit_tabnew..132..141..127..agit#aligner#align:
line    1:
E684: list index out of range: 0
E116: Invalid arguments for function len(a:table[0]) " sampling head's column number
E15: Invalid expression: len(a:table[0]) " sampling head's column number
line    4:
E121: Undefined variable: column_number
E116: Invalid arguments for function range(column_number)
E15: Invalid expression: range(column_number)
line   14:
E684: list index out of range: 0
E15: Invalid expression: s:sum(maxs) - maxs[0]
line   16:
E121: Undefined variable: width_without_commit_msg
E15: Invalid expression: a:max_col == 0 ? maxs[0] : a:max_col - width_without_commit_msg - seps_width

再現方法

  1. lcd でどこかのリポジトリーのディレクトリーに移動
  2. enew (あるいはVimFiler)
  3. AgitFile

思わずvimfilerの画面でAgitFileしてしまって見つけました。
gitで管理されていないファイルなのですぐに落とすのがいいのか、それともフォールバックで普通にAgitを開くかですかね。

A second Agit terminal shows nothing on a same repository

To reproduce

  1. open terminal
  2. change directory to git repogitory directory (ex. "/develop/hoge" )
  3. type :Agit
  4. open next termimal
  5. change directory to git repogitory directory (ex. "/develop/hoge" )
  6. type :Agit
    The second terminal shows only "[Agit log]". No log.

OS X 10.9.5
vim 7.4.52

Changing b:git_dir to use custom --git-dir name before running :Agit

What I'm trying to achieve is, having two separate git histories for the same work tree, one with properly named commits and another for auto-committing work-in-progress every now and then. I achieved this behavior with --git-dir, but now I want to be able to run :Agit for each of the trees.

This is what I do (this should only work when fugitive is on):

nnoremap <F11> :let b:git_dir = substitute(b:git_dir, ".git$", ".wip", "")<CR>:Agit<CR>

The git.git_dir property does get initialized properly, but all three default views have the message

fatal: The empty string is not a valid path

which probably means some calls to git don't respect the git_dir parameter. There are such calls in the code but I couldn't find the relevant ones. I'll be working on understanding the codebase, just reporting here to ask for help. This issue might be related to #48 or #19

agitfile: git-dir should be resolved by specified file

今の実装では、リポジトリの場所はバッファに開かれているファイルのパスから検索されますが、
AgitFileで明示的にファイルを指定して起動した場合はそのパスから検索する必要があるのではないでしょうか。

gittree can contain characters `-` and `.`, which are not highlighted correctly

In some (presumably rare -- I found this while browsing a repository called MetroGit) cases where more than two branches are merged in a commit, - and . appear in the git graph. Currently they are not properly highlighted:

agitbug

A script for reproduction (please execute in an empty directory if you do):

#!/bin/bash
# execute in an empty directory 
git init
touch "i"
git add .
git commit -m "initial"

git checkout -b a
echo "a" > a
git add .
git commit -m "a"

git checkout master; git checkout -b b
echo "b" > b
git add .
git commit -m "b"

git checkout master; git checkout -b c
echo "c" > c
git add .
git commit -m "c"

git checkout master

git merge master a b c -m "merge"

Adding \- and \. to the syn match agitTree seems to solve the problem, but not quite sure if this breaks anything.

git.log: head_indexが正しく取得できていない

/autoload/agit/git.vim の s:git.log() 内で、以下のようなコードでHEADの行を取得しようとしていますが、まちがっているように見えます。(これだとhead_hash内のいずれかの文字がひとつでもあればmatchするのでほとんどの場合0が返る)

let head_hash = agit#git#exec('rev-parse --short HEAD', self.git_dir)
let head_index = s:find_index(aligned_log, 'match(v:val, "[' . head_hash . ']") >= 0')

意図した動作とするためには、head_hashにString.chompをかけた上で、[]をエスケープする必要があると思います。
ただ、個人的にはLocal Changesの行は常に一番上に表示されている方が使いやすい気がします。

Git 2.11 abbreviated-hash length is variable

git 2.11 から短縮ハッシュ長が可変になったため、ハッシュ長を7で決め打ちしている箇所が問題になります。
(https://github.com/cohama/agit.vim/blob/fdcd655/autoload/agit.vim#L222 など)

例えば vim 本体のリポジトリの場合、8.0.0123 の時点で git log --oneline してみると短縮ハッシュ長は9文字でした。
そのため、:Agit のログ表示でハッシュ部分が conceal されない上、j でカーソルを下に動かすと一気に最下段まで移動してしまいます。

【機能要望】マッピング一覧をトグル表示できてほしい

様々なプラグインでお世話になっております。今回は機能要望という事でIssueを立てさせていただきました。

概要はタイトルのとおりです。
例えば Tagbar の場合ですが ? を入力することで下図のようなマッピングリストが表示されます

通常時
ヘルプ表示時

Agitのようなビュワーは編集用プラグインのように頻繁に利用するわけではないため、どんな機能があるのかを完全に把握するのにかなりの時間がかかります。その状態でマッピングを探すのは結構な手間がかかるため、Agitに関するマッピングと簡易説明がさっと表示できる機能のようなものがあると助かります。

お時間があるときにご検討いただけると幸いです。

agt file can not get the correct path after run tabnew and lcd

ref: https://github.com/SpaceVim/SpaceVim/issues/1045

@cohama in this issue

  1. we are in ~/SpaceVim/SpaceVim, and this is a root of a git repo
  2. we use tabnew ~/.SpaceVim.d/init to open the custom file this is a link to ~/Dotfiles/SpaceVim.d/init.vim. and ~/Dotfiles also is a root of git repo.
  3. and we use vim-rooter to auto set root dir
  4. when we use AgitFile, it cause some error, and when we use Agit, it show log of old path

maybe This plugin should handle the local path instead.

`vimproc#get_command_name: File "cd" is not found` occured on some linux envs

477d49a の変更にてvimproc#get_command_nameからcdを呼び出していますが、一部のLinuxディストリビューションでは $PATH/cd が存在しない為、エラーが出ます。

[vimproc] vimproc#get_command_name: File "cd" is not found.
Error detected while processing function agit#launch[29]..agit#bufwin#agit_tabnew[6]..316[2]..318[1]..319[8]..304[10]..agit#aligner#align:
line    1:
E684: list index out of range: 0
E116: Invalid arguments for function len
E15: Invalid expression: len(a:table[0]) " sampling head's column number

確認したところMacOSやRHEL(確認したものはCent7, Fedora29)系には/usr/bin/cdがありそうでしたが、Ubuntu18.04とArch Linuxには存在しませんでした(shellのビルトインコマンドを使っているようです)。

ワークアラウンドとして動くディストロと同様の下記のようなものを$PATH/cdとして保存しchmod +xすることで動きます。

#!/usr/bin/sh
builtin cd "$@"

windows環境での修正PR(#77)を適用してもこの問題は解決しません。

:AgitDiff not working when file path is very long

Hello!

When file paths in the stats buffer are more than around 70 characters long, they become abbreviated like this: .../subdirectory/file

Using :AgitDiff on such a line causes the error File not tracked.

One way to create a repository to test this:

 mkdir longnames
 cd longnames/
 git init
 mkdir -p 000000000/111111111/222222222/333333333/444444444/555555555/666666666/777777777
 echo "test"> 000000000/111111111/222222222/333333333/444444444/555555555/666666666/777777777/file
 echo "test"> 000000000/111111111/222222222/333333333/444444444/555555555/666666666/file
 echo "test"> 000000000/111111111/222222222/333333333/444444444/555555555/file
 echo "test"> 000000000/file
 git add -A
 git commit -m "xyz"
 echo "test 2">> 000000000/111111111/222222222/333333333/444444444/555555555/666666666/777777777/file
 echo "test 2">> 000000000/111111111/222222222/333333333/444444444/555555555/666666666/file
 echo "test 2">> 000000000/111111111/222222222/333333333/444444444/555555555/file
 echo "test 2">> 000000000/file
 git add -A
 git commit -m "zzz"

Remap locally without autocommands

I know that the default mappings are defined locally, so how can I remap them?

Example, I want to use D for <Plug>(agit-diff) and nnoremap D <Plug>(agit-diff) is of course not the way to do it.

I can use autocommands (FileType agit,agit_diff.....), but is there not a better way?

e.g.

let g:agit_no_default_mappings = 1
augroup Agit
    autocmd!
    autocmd Filetype agit,agit_stat,agit_diff nmap <buffer> D <Plug>(agit-diff)
    autocmd Filetype agit,agit_stat,agit_diff nmap <buffer> q <Plug>(agit-exit)
    autocmd Filetype agit,agit_stat,agit_diff nmap <buffer> R <Plug>(agit-reload)
augroup END

Thanks in advance.

Cannot exit Agit when it is the only tab

Problem: When the Agit is the only tab, I cannot exit Agit.

  1. Open a file.
  2. Execute :Agit.
  3. Go back to the file (with :tabfirst)
  4. Close that tab (with :tabclose), we have the only one tab of Agit.
  5. I cannot close the Agit tab (with pressing q)

It's preferable to open a new tab and delete the Agit tab.

AgitDiff is broken since 1056d84 (with fugitive)

1056d84の変更によって、staged/unstagedに対するAgitDiffが動かなくなりました。

fugitiveが入っていると、index上のファイルを表示するのにfugitiveを使いますが、

fugitive://リポジトリのフルパス///0/リポジトリ内でのファイルの相対パス となるはずのパスが
fugitive://リポジトリのフルパス///0/ファイルのフルパス となっています。

もしかするとWindows特有の問題かもしれません。

Afterimage

The afterimage is caused by moving the cursor up and down.

afterimage

Execution environment:
Vim 7.4, the plain vim (unlike the gif animation)

diffが長い時、agitDiffRemoveなどが適用されない

シンタックスagitDiffAdd/agitDiffRemoveは、agitDiffにcontainedされているため、diffが長いと適用されません。
確認方法

mkdir foobar
cd foobar/
git init
seq 10000 > README
git add README
vim
:Agit
:wincmd l
:wincmd j
G

※ diffが長いことはよくあることです

Abbreviated commit hash is not displayed in left window.

%h means abbreviated commit hash and not displayed in left window.

source file agit.vim/autoload/agit/git.vim

let gitlog = agit#git#exec('log --all --graph --decorate=full --no-color --date=relative --format=format:"%d %s' . s:sep . '|>%ad<|' . s:sep . '{>%an<}' . s:sep . '[%h]"', self.git_dir)

I wish that commit hash could be displayed.

agit.vim の AgitDiff コマンドについて

質問・報告の内容

表題の件で、
:help agit
には

:AgitDiff [{revisions}]
<snip>
When launched from |agit-stat| buffer, AgitDiff trys to pick target file
from cursor position. (see ##|<cfile>|)

とありますが、agit-stat でどこにカーソルが有っても、:Agit 呼び出し元のファイルとの差分になります
ステータス・ラインやタブ・バーの表示は、カーソル位置のファイル名になっているのですが???
私は何か勘違いしているでしょうか?
#998 の状況なので、vim-fugitive は未インストールです

Vimのバージョン

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 22:32:42)
適用済パッチ: 1-1829
追加拡張パッチ: 8.0.0056

OSの種類/ディストリ/バージョン

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety

使用している or 関係していそうなプラグイン

agit.vim

その他

Respect .vimrc in catfile buffer

各バッファの生成時にnonumber, norelativenumber, nowrapなどが指定されていますが、catfileバッファについてはこの辺の設定は変更せず、.vimrcなどで指定したままになっていて欲しいです。

Existence of variable b:git_dir shadows agit’s behaviour, thus affected by git-vim's bug

Agit uses b:git_dir when available for fugitive compatibility, but it's not the only plugin that uses b:git_dir. motemen/git-vim also uses (defines) b:git_dir, and what's tragic, its implementation has apparently a bug.

This is more of a issue of git-vim than agit, but this kind of thing will prevent from non-fugitive-related b:git_dir from affecting:

autoload/agit.vim
@@ -127,7 +127,7 @@ endfunction

 function! s:get_git_dir()
   " if fugitive exists
-  if exists('b:git_dir')
+  if s:fugitive_enabled && exists('b:git_dir')
     return b:git_dir
   endif
   let cdcmd = haslocaldir() ? 'lcd ' : 'cd '

(I'm not sure if there's any side effects in this.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.