-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Lua equivalent of g:CommandTTraverseSCM
setting
#416
Comments
Good catch @niloct. This is a missing feature in the Lua version. The Ruby version used the
So we'll have to add that functionality back in. The other thing is about your set-up:
When you're running the Lua version, none of the lua << EOF
require('wincent.commandt').setup({
height = 30,
order = 'forward', -- Note: This is the default now, so you don't need it.
})
EOF or this in require('wincent.commandt').setup({
height = 30,
}) |
g:CommandTTraverseSCM
setting
Just to document the old logic here while it's still fresh in my mind, here are the relevant bits copied from various places: def pwd
::VIM::evaluate 'getcwd()'
end
def current_file_dir
::VIM::evaluate 'expand("%:p:h")'
end
def nearest_ancestor(starting_directory, markers)
path = File.expand_path(starting_directory)
while !markers.
map { |dir| File.join(path, dir) }.
map { |dir| File.exist?(dir) }.
any?
next_path = File.expand_path(File.join(path, '..'))
return nil if next_path == path
path = next_path
end
path
end
def scm_markers
markers = VIM::get_string('g:CommandTSCMDirectories')
markers = markers && markers.split(/\s*,\s*/)
markers = %w[.git .hg .svn .bzr _darcs] unless markers && markers.any?
markers
end
traverse = VIM::get_string('g:CommandTTraverseSCM') || 'file'
case traverse
when 'file'
@path = nearest_ancestor(VIM::current_file_dir, scm_markers) || VIM::pwd
when 'dir'
@path = nearest_ancestor(VIM::pwd, scm_markers) || VIM::pwd
else
@path = VIM::pwd
end More generally, but closely related to this, is the way the Lua implementation handles path arguments.
I think overall I should change the behavior of the Lua version to match the Ruby one — conceptually, it behaves as if you |
Hi wincent, Sorry for asking, but this is a much needed feature, do you estimate when it's gonna be available for the lua implementation ? Thanks. |
I already started working on it, but it's unpleasantly complicated. I need to refactor to work around some assumptions that make it hard to do the simple thing (eg. |
|
Hi,
Thanks for the continued support on this tool, it's very useful!
Nevertheless, I am facing an issue with CommandT on Neovim:
When I navigate a folder deep down the git repository, CommandT can't find files in parent directories on the same repository.
This was very useful on earlier ruby version, because I could just not care on which directory I spawned neovim, using CommandT I could find all files on the repository. My
init.vim
Could you see any wrong configuration ?
Thanks in advance for your attention,
Nilo
The text was updated successfully, but these errors were encountered: