Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.14k stars 180 forks source link

关于Leaderf git的一个小建议 #1058

Closed fzhzhen1987 closed 5 months ago

fzhzhen1987 commented 6 months ago

看你一直在维护这个插件,辛苦了。

看到已经可以支持git的命令。 如果 git diff的执行结果可以用颜色区分 “添加行”和“删除行”就完美了。

Yggdroot commented 6 months ago

不是很明白,能具体一点吗?方便的话可以上个图。 是哪个命令? 我觉得已经有了吧。如果是side-by-side模式,就是vimdiff本身的语法高亮,应该已经区分了。如果是普通模式,也是vim的diff文件语法高亮。

fzhzhen1987 commented 6 months ago

两个测试例:一个没有颜色,一个报错(平台为window powershell nvim)

Snipaste_2024-03-06_11-35-03

Snipaste_2024-03-06_11-36-52

Snipaste_2024-03-06_11-38-44

Yggdroot commented 6 months ago

正常是有颜色的,不知道是不是你的环境的问题。 你在normal模式下,focus到previewbuffer,echom &ft 看看输出是什么。 在这个buffer里设值set ft=diff, 看看有没有颜色。

至于报错,我看是E97,

                        *E810* *E97*
Vim will do a test if the diff output looks alright.  If it doesn't, you will
get an error message.  Possible causes:
-  The "diff" program cannot be executed.
-  The "diff" program doesn't produce normal "ed" style diffs (see above).
-  The 'shell' and associated options are not set correctly.  Try if filtering
   works with a command like ":!sort".
-  You are using 'diffexpr' and it doesn't work.
If it's not clear what the problem is set the 'verbose' option to one or more
to see more messages.

The self-installing Vim for MS-Windows includes a diff program.  If you don't
have it you might want to download a diff.exe.  For example from
http://gnuwin32.sourceforge.net/packages/diffutils.htm.

看看是不是上面提到的某个原因。

fzhzhen1987 commented 6 months ago

回头我试试其他设备。

又有个问题 一打开文件,报错,不过不影响使用.不知道是不是我的环境问题。

nvim xxx.c 文件是 sjis编码可能有关系

就报下面的错

BufEnter Autocommands for "*"..function lfMru#record の処理中にエラーが検出されました:
line   10:
E684: List index out of range: 2
Yggdroot commented 6 months ago

回头我试试其他设备。

又有个问题 一打开文件,报错,不过不影响使用.不知道是不是我的环境问题。

nvim xxx.c

就报下面的错

BufEnter Autocommands for "*"..function lfMru#record の処理中にエラーが検出されました:
line   10:
E684: List index out of range: 2

这个是最基本功能了,是Leaderf mru用到的。感觉不会有错。你的nvim版本是多少,是不是太旧了。 为什么你的报错都是日文的。

fzhzhen1987 commented 6 months ago

version: NVIM v0.10.0-dev-2051+gee3d4f6b9 因为用的系统是日语编码的格式... 文件打开我试了用utf-8就没事。 傻逼日语编码sjis文件打开就报上面那个错

fzhzhen1987 commented 6 months ago

正常是有颜色的,不知道是不是你的环境的问题。 你在normal模式下,focus到previewbuffer,echom &ft 看看输出是什么。 在这个buffer里设值set ft=diff, 看看有没有颜色。

至于报错,我看是E97,

                      *E810* *E97*
Vim will do a test if the diff output looks alright.  If it doesn't, you will
get an error message.  Possible causes:
-  The "diff" program cannot be executed.
-  The "diff" program doesn't produce normal "ed" style diffs (see above).
-  The 'shell' and associated options are not set correctly.  Try if filtering
   works with a command like ":!sort".
-  You are using 'diffexpr' and it doesn't work.
If it's not clear what the problem is set the 'verbose' option to one or more
to see more messages.

The self-installing Vim for MS-Windows includes a diff program.  If you don't
have it you might want to download a diff.exe.  For example from
http://gnuwin32.sourceforge.net/packages/diffutils.htm.

看看是不是上面提到的某个原因。

echom &ft 显示c 改成diff后 还是没有颜色.

也试了在看代码的buffer里设置成diff后原来的语法高亮都没了,变成普通黑白文本的样子. 但是在diff preview窗口还是黑白不能diff显示有些奇怪

Yggdroot commented 5 months ago

我认为这不是LeaderF的问题,而是你的环境的问题,你直接打开一个diff文件应该也没有颜色。

fzhzhen1987 commented 5 months ago

回头我试试其他设备。 又有个问题 一打开文件,报错,不过不影响使用.不知道是不是我的环境问题。 nvim xxx.c 就报下面的错

BufEnter Autocommands for "*"..function lfMru#record の処理中にエラーが検出されました:
line   10:
E684: List index out of range: 2

这个是最基本功能了,是Leaderf mru用到的。感觉不会有错。你的nvim版本是多少,是不是太旧了。 为什么你的报错都是日文的。

发现在v1.25中就是有这个错误,在v1.24就没有报错。 具体哪个commit修改导致的问题没有具体找。

Yggdroot commented 5 months ago

如果你那里是必现的话,帮忙调试一下这个函数:

https://github.com/Yggdroot/LeaderF/blob/735a2f36d3a25e320182bf3f385f5530d674600e/autoload/lfMru.vim#L30-L54

看看具体为什么。