Skip to content

New function LeadfFunction! to enter normal mode directly#143

Merged
Yggdroot merged 5 commits intoYggdroot:masterfrom
skywind3000:master
Apr 29, 2018
Merged

New function LeadfFunction! to enter normal mode directly#143
Yggdroot merged 5 commits intoYggdroot:masterfrom
skywind3000:master

Conversation

@skywind3000
Copy link
Copy Markdown
Contributor

  1. Postfix a bang sign to LoadfFunction to enable entering normal mode directly
  2. Reposition cursor to the current function in the function normal mode

return

self._orig_pos = (vim.current.tabpage, vim.current.window, vim.current.buffer)
self._orig_cursor = (lfEval('line(".")'), lfEval('col(".")'))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为啥不用self._orig_cursor = vim.current.window.cursor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不知道有这个,已改

last -= 1
if last >= 0:
index = tags[last][0]
vim.command(str(index))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里最好用lfCmd()来代替vim.command(),lfCmd就是vim.command的alias

continue
filename = text[:pos]
ln = int(text[pos + 1:])
if self._pathEqual(orig_name, filename):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一句改为if self._pathEqual(lfDecode(orig_name), filename):,那个中文路径的问题就好了。

def startExplorer(self, win_pos, *args, **kwargs):
super(FunctionExplManager, self).startExplorer(win_pos, *args, **kwargs)
if (not self._launched) or (len(args) > 0):
return
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return后面有个空格


for _, item in enumerate(output):
bufname = buffer.name if vim.options["autochdir"] else lfRelpath(buffer.name)
try:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try后面有个空格

2. fixed cjk path name issues in function list
if pos < 0:
continue
filename = text[:pos]
ln = int(text[pos + 1:])
Copy link
Copy Markdown
Owner

@Yggdroot Yggdroot Apr 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面这些逻辑,可以用下面两行得到行号:

 line = line.rsplit("\t", 1)[1][1:-1]    # file:line buf_number
 line_nr = line.rsplit(":", 1)[1].split()[0]

因为格式是我定的,不存在异常情况。
即:{kind}<tab>{code}<tab>[{file}:{line} {bufnr}]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果功能正常,就先merge了?至少能跑了,看不惯的地方你一次性全改一遍?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方要不然你改一下,我看功能也没什么问题了,以后应该也不会动这一块的代码了。

@skywind3000
Copy link
Copy Markdown
Contributor Author

已修改。

@Yggdroot
Copy link
Copy Markdown
Owner

因为提交了很多次,我只能再一次进行squash merge了。

@Yggdroot Yggdroot merged commit d1c6f93 into Yggdroot:master Apr 29, 2018
Yggdroot added a commit that referenced this pull request Apr 29, 2018
some enhancements for feature #143
@skywind3000
Copy link
Copy Markdown
Contributor Author

没事,下次提交我删了再fork。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants