GithubHelp home page GithubHelp logo

Comments (17)

wincent avatar wincent commented on June 8, 2024

In general, I don't think you should have to mess with specific SDKs or anything. What version of Ruby are you running? The one that comes with the system? Homebrew? Something else?

from command-t.

Takuzen avatar Takuzen commented on June 8, 2024

I see.

I noticed I was using a bit old-fashioned 2.6.3p62 version Ruby, so I installed and switched to the latest 3.1.1 with rbenv.

command-t ❯ rbenv versions
  system
* 3.1.1 (set by /Users/takuzen/.config/nvim/pack/plugins/start/command-t/ruby/command-t/ext/command-t/.ruby-version)

Though then I run

 cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
 ruby extconf.rb
 make

this again, there's still the same error msg:(

Next, following your doc., I run this following command in my Nvim

 :ruby puts "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"

and it says my Neovim's still linked with the old version Ruby.

So I rebuilt with Homebrew but the link doesn't change.

Do you think the linkage matters? How I can change it even the rebuild doesn't work.

Or maybe my Xcode's version is a bit outdated, which is 12.4?

P.s.

command-t ❯ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

Even after switching to 3.1.1 and rbenv versions says it works, the above command doesn't match that, which makes me wonder. JFYI.

from command-t.

wincent avatar wincent commented on June 8, 2024

Do you think the linkage matters? How I can change it even the rebuild doesn't work.

What matters is that the version numbers must match up — Command-T will be happy with an old version, or with a recent version, as long as it's the same one that Neovim itself is using.

The specific thing about the SDK is indicative of something weird and macOS related (because the Ruby headers are embedded inside the SDK, if I recall correctly). Sorry about the hassle; Command-T itself isn't doing anything strange here — it's just using mkmf (in the Ruby standard file) and trying to compile a bit of vanilla C code with no funny stuff.

After you run ruby extconf.rb, what are the contents of the generated Makefile? You might be able to remove the offending path(s) or correct it (them). It would be interesting to look around the vicinity of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.6.Internal.sdk/usr/local/lib to see what lib directories actually are there...

from command-t.

Takuzen avatar Takuzen commented on June 8, 2024

I've made sure that Nvim and Terminal(inside command-t dir.) are using the same 2.6.3p62 version Ruby,
and this is what I get in Makefile originally. C.f. $ make clean is run before $ ruby extconf.rb

SHELL = /bin/sh

# V=0 quiet, V=1 verbose.  other values don't work.
V = 0
Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO1 = $(V:1=@ :)
ECHO = $(ECHO1:0=@ echo)
NULLCMD = :

#### Start of system configuration section. ####

srcdir = .
topdir = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
hdrdir = $(topdir)
arch_hdrdir = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20
PATH_SEPARATOR = :
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
rubyarchprefix = $(rubylibprefix)/$(arch)
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
exec_prefix = $(prefix)
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
sitehdrdir = $(rubyhdrdir)/site_ruby
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
vendorarchdir = $(vendorlibdir)/$(sitearch)
vendorlibdir = $(vendordir)/$(ruby_version)
vendordir = $(rubylibprefix)/vendor_ruby
sitearchdir = $(sitelibdir)/$(sitearch)
sitelibdir = $(sitedir)/$(ruby_version)
sitedir = $(DESTDIR)/Library/Ruby/Site
rubyarchdir = $(rubylibdir)/$(arch)
rubylibdir = $(rubylibprefix)/$(ruby_version)
sitearchincludedir = $(includedir)/$(sitearch)
archincludedir = $(includedir)/$(arch)
sitearchlibdir = $(libdir)/$(sitearch)
archlibdir = $(libdir)/$(arch)
ridir = $(datarootdir)/$(RI_BASE_NAME)
mandir = $(DESTDIR)/usr/share/man
localedir = $(datarootdir)/locale
libdir = $(exec_prefix)/lib
psdir = $(docdir)
pdfdir = $(docdir)
dvidir = $(docdir)
htmldir = $(docdir)
infodir = $(DESTDIR)/usr/share/info
docdir = $(datarootdir)/doc/$(PACKAGE)
oldincludedir = $(DESTDIR)/usr/include
includedir = $(DESTDIR)/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk$(prefix)/include
localstatedir = $(prefix)/var
sharedstatedir = $(prefix)/com
sysconfdir = $(DESTDIR)/Library/Ruby/Site
datadir = $(datarootdir)
datarootdir = $(prefix)/share
libexecdir = $(exec_prefix)/libexec
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
archdir = $(rubyarchdir)


CC_WRAPPER = 
CC = xcrun clang
CXX = xcrun clang++
LIBRUBY = $(LIBRUBY_SO)
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
empty =
OUTFLAG = -o $(empty)
COUTFLAG = -o $(empty)
CSRCFLAG = $(empty)

RUBY_EXTCONF_H = 
cflags   = $(optflags) $(debugflags) $(warnflags)
cxxflags = $(optflags) $(debugflags) $(warnflags)
optflags = 
debugflags = -g
warnflags = 
cppflags = 
CCDLFLAGS = 
CFLAGS   = $(CCDLFLAGS)  -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC $(ARCH_FLAG)
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
DEFS     =  -DWATCHMAN_BUILD
CPPFLAGS = -DHAVE_FCNTL_H -DHAVE_STDINT_H -DHAVE_SYS_ERRNO_H -DHAVE_SYS_SOCKET_H -DHAVE_RUBY_ST_H -DHAVE_ST_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
CXXFLAGS = $(CCDLFLAGS)  -g -Os -pipe  $(ARCH_FLAG)
ldflags  = -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.6.Internal.sdk/usr/local/lib
dldflags = $(ARCH_FLAG)             -undefined dynamic_lookup -multiply_defined suppress 
ARCH_FLAG = 
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
LDSHARED = $(CC) -dynamic -bundle
LDSHAREDXX = $(CXX) -dynamic -bundle
AR = libtool -static
EXEEXT = 

RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
RUBY_SO_NAME = ruby.2.6
RUBYW_INSTALL_NAME = 
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
RUBYW_BASE_NAME = rubyw
RUBY_BASE_NAME = ruby

arch = universal-darwin20
sitearch = $(arch)
ruby_version = 2.6.0
ruby = $(bindir)/$(RUBY_BASE_NAME)
RUBY = $(ruby)
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h

RM = rm -f
RM_RF = $(RUBY) -run -e rm -- -rf
RMDIRS = rmdir -p
MAKEDIRS = mkdir -p
INSTALL = /usr/bin/install -c
INSTALL_PROG = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 644
COPY = cp
TOUCH = exit >

#### End of system configuration section. ####

preload = 
libpath = . $(libdir)
LIBPATH =  -L. -L$(libdir)
DEFFILE = 

CLEANFILES = mkmf.log
DISTCLEANFILES = 
DISTCLEANDIRS = 

extout = 
extout_prefix = 
target_prefix = 
LOCAL_LIBS = 
LIBS = $(LIBRUBYARG_SHARED) -lpthread   
ORIG_SRCS = ext.c heap.c match.c matcher.c watchman.c
SRCS = $(ORIG_SRCS) 
OBJS = ext.o heap.o match.o matcher.o watchman.o
HDRS = $(srcdir)/matcher.h $(srcdir)/ruby_compat.h $(srcdir)/match.h $(srcdir)/heap.h $(srcdir)/watchman.h $(srcdir)/ext.h
LOCAL_HDRS = 
TARGET = ext
TARGET_NAME = ext
TARGET_ENTRY = Init_$(TARGET_NAME)
DLLIB = $(TARGET).bundle
EXTSTATIC = 
STATIC_LIB = 

TIMESTAMP_DIR = .
BINDIR        = $(bindir)
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
RUBYLIBDIR    = $(sitelibdir)$(target_prefix)
RUBYARCHDIR   = $(sitearchdir)$(target_prefix)
HDRDIR        = $(rubyhdrdir)/ruby$(target_prefix)
ARCHHDRDIR    = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
TARGET_SO_DIR =
TARGET_SO     = $(TARGET_SO_DIR)$(DLLIB)
CLEANLIBS     = $(TARGET_SO) 
CLEANOBJS     = *.o  *.bak

all:    $(DLLIB)
static: $(STATIC_LIB)
.PHONY: all install static install-so install-rb
.PHONY: clean clean-so clean-static clean-rb

clean-static::
clean-rb-default::
clean-rb::
clean-so::
clean: clean-so clean-static clean-rb-default clean-rb
		-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time

distclean-rb-default::
distclean-rb::
distclean-so::
distclean-static::
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
		-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
		-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
		-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true

realclean: distclean
install: install-so install-rb

install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
	$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
clean-static::
	-$(Q)$(RM) $(STATIC_LIB)
install-rb: pre-install-rb do-install-rb install-rb-default
install-rb-default: pre-install-rb-default do-install-rb-default
pre-install-rb: Makefile
pre-install-rb-default: Makefile
do-install-rb:
do-install-rb-default:
pre-install-rb-default:
	@$(NULLCMD)
$(TIMESTAMP_DIR)/.sitearchdir.time:
	$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
	$(Q) $(TOUCH) $@

site-install: site-install-so site-install-rb
site-install-so: install-so
site-install-rb: install-rb

.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S

.cc.o:
	$(ECHO) compiling $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.cc.S:
	$(ECHO) translating $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

.mm.o:
	$(ECHO) compiling $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.mm.S:
	$(ECHO) translating $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

.cxx.o:
	$(ECHO) compiling $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.cxx.S:
	$(ECHO) translating $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

.cpp.o:
	$(ECHO) compiling $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.cpp.S:
	$(ECHO) translating $(<)
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

.c.o:
	$(ECHO) compiling $(<)
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.c.S:
	$(ECHO) translating $(<)
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

.m.o:
	$(ECHO) compiling $(<)
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<

.m.S:
	$(ECHO) translating $(<)
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<

$(TARGET_SO): $(OBJS) Makefile
	$(ECHO) linking shared-object $(DLLIB)
	-$(Q)$(RM) $(@)
	$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
	$(Q) $(POSTLINK)



###
# Copyright 2010-present Greg Hurrell. All rights reserved.
# Licensed under the terms of the BSD 2-clause license.

CFLAGS += -Wall -Wextra -Wno-unused-parameter

ifdef DEBUG
CFLAGS += -DDEBUG
endif

from command-t.

Takuzen avatar Takuzen commented on June 8, 2024

I corrected l. 91 as following.

lldflags  = -L. -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib

Then I run,

command-t ❯ make                                                                                                              main ~/.config/nvim/pack/plugins/start/command-t/ruby/command-t/ext/command-t
compiling ext.c
compiling heap.c
compiling match.c
compiling matcher.c
compiling watchman.c
linking shared-object ext.bundle
command-t ❯ 

so it seemed worked.

However when I type :CommandT in Nvim command, I still got the following error msg., and I noticed which is the same one with #385 coincidentally.

Error detected while processing /Users/takuzen/.config/nvim/pack/plugins/start/command-t/autoload/commandt.vim:                                                                                            
line  230:
NameError: uninitialized constant CommandT
Error detected while processing function commandt#FileFinder:
line    2:
NoMethodError: undefined method `show_file_finder' for nil:NilClass

P.s.
As you mentioned, I went to look what's inside of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
, and I found a bunch of .tbd files, which is novel for me. Thanks.

from command-t.

wincent avatar wincent commented on June 8, 2024

However when I type :CommandT in Nvim command, I still got the following error msg., and I noticed which is the same one with #385 coincidentally.

It may be just that (a coincidence)... it's going to display something like that whenever there's a total failure to load the Ruby module. You can see the code that is doing that here. One way to try and see what's happening would be to run some of those commands by hand. For example:

:ruby require "command-t"

If that fails the first time around with LoadError: cannot load such file (which is normal), you can modify the LOAD_PATH and try again. First, take a look at what is in the LOAD_PATH:

:ruby p LOAD_PATH

and then try modifying it (obviously substituting the actual paths to your ext and lib directories):

:ruby $LOAD_PATH << "/Users/wincent/.config/nvim/pack/bundle/opt/command-t/ruby/command-t/ext"
:ruby $LOAD_PATH << "/Users/wincent/.config/nvim/pack/bundle/opt/command-t/ruby/command-t/lib"
:ruby require "command-t"

If that works, it may be that Command-T's plug-in directory isn't in your rtp... What's the value output of :set rtp?.

I found a bunch of .tbd files, which is novel for me.

Me too. 😁

from command-t.

Takuzen avatar Takuzen commented on June 8, 2024

P.S. (Pre-Script)
Following your advice I tinkered around, :CommandT worked once.
However then I dropped my guard and closed Nvim, now I'm unable to make it work again, even repeating what all I did.
I thought because I happened to run ruby require 'command-t/ext' during reading here, but there's no repeatability.

--

After adding $LOAD_PATHs, :ruby require "command-t" successfully executed.
But now there's another error msg. when run :CommandT

Error detected while processing function commandt#FileFinder:
line 2:
NoMethodError: undefined method `show_file_finder` for nil:NilClass

I also did :set rtp and even added potential paths to it. With configuring, it looks as followed.

runtimepath=~/.config/nvim,~/.config/nvim/pack/*/start/*,/etc/xdg/nvim,~/.local/share/nvim/site,/us
r/local/share/nvim/site,/usr/share/nvim/site,/usr/local/Cellar/neovim/0.6.1/share/nvim/runtime,/usr/l
ocal/Cellar/neovim/0.6.1/share/nvim/runtime/pack/dist/opt/matchit,/usr/local/Cellar/neovim/0.6.1/lib/
nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,~/.local/share/nvim/site/after,/etc/
xdg/nvim/after,~/.config/nvim/after,~/.config/nvim/pack/plugins/start/command-t/,~/.config/nvim/pack/
plugins/start/command-t/ruby/command-t/ext/,~/.config/nvim/pack/plugins/start/command-t/ruby/command-
t/lib/,~/.config/nvim/pack/plugins/start/command-t/ruby/command-t

My $LOAD_PATH is like this.

["/Library/Ruby/Gems/2.6.0/gems/did_you_mean-1.3.0/lib", "/Library/Ruby/Gems/2.6.0/gems/msgpack-1.4.5
/lib", "/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-20/2.6.0/msgpack-1.4.5", "/Library/Ruby/
Gems/2.6.0/gems/multi_json-1.15.0/lib", "/Library/Ruby/Gems/2.6.0/gems/neovim-0.9.0/lib", "/Library/R
uby/Site/2.6.0", (...omitting...) ,  "/Users/takuzen/.config/nvi
m/pack/plugins/start/command-t/ruby/command-t/ext", "/Users/takuzen/.config/nvim/pack/plugins/start/c
ommand-t/ruby/command-t/lib"]

--

In addition to this, I wonder where and how I should write these $LOAD_PATH and rtp config., so I can make it reflected permanently. (I set my config. of Nvim in .config/nvim/lua/config.lua and required from init.lua which exists in one previous dir.

from command-t.

wincent avatar wincent commented on June 8, 2024

The thing is, you shouldn't have to manually mess with your 'rtp' or $LOAD_PATH; I was just hoping that it would help us debug why Command-T can't seem to actually require any of the Ruby files even after you got the extension built.

After adding $LOAD_PATHs, :ruby require "command-t" successfully executed.
But now there's another error msg. when run :CommandT

You probably need this after the require:

$command_t = CommandT::Controller.new

But like I said, you shouldn't have to be doing any of that... the code I linked to in my previous comment is supposed to require Command-T, and if that doesn't work, update the $LOAD_PATH based on what's in your 'rtp' before trying again, and then setting up the $command_t global.

from command-t.

Takuzen avatar Takuzen commented on June 8, 2024

At last, I got how to make command-t work temporarily!

To sum up and jog it down for other users of this plugin facing the same problem, I fixed by running following commands in Nvim.

:ruby $LOAD_PATH << '/Users/takuzen/.config/nvim/pack/plugins/start/command-t/ruby/command-t/ext'
:ruby $LOAD_PATH << '/Users/takuzen/.config/nvim/pack/plugins/start/command-t/ruby/command-t/lib'
:ruby require 'command-t'
:ruby $command_t = CommandT::Controller.new

Before closing this issue, my last question is where to put these 4 lines,
so I can leave these configurations permanent?

+α:
Unexpectedly, I accepted in popup window to search through all my photos and now there's a warning says that

Warning: maximum file  limit reached

Increase it by setting a higher value in $MYVIMRC; eg:
	let g:CommandTMaxFiles=200000
Or suppress this warning by setting:
	let g:CommandTSuppressMaxFilesWarning=1
For best performance, consider using a fast scanner; 

Is there a way to set command-t not to go look into my photos?

from command-t.

wincent avatar wincent commented on June 8, 2024

Before closing this issue, my last question is where to put these 4 lines,
so I can leave these configurations permanent?

Well, as I said, you shouldn't have to do this. The question is, why isn't the code in the plug-in doing it already on your behalf? I obviously can't reproduce the problem you've reported here, but if I could, I would want to put logging statements in there to figure out exactly where it is failing...

Having said that, if you just want to dump this somewhere and move on, you could put it in your vimrc after the plugin has loaded. Given that the set-up is supposed to happen in response to autoloading, you might want to trigger that first with :call commandt#Load().

Unexpectedly, I accepted in popup window to search through all my photos and now there's a warning says that

That will happen if you run Vim in a current working directory that is or contains (directly or indirectly) your photos directory. All of the file scanners work in this way — they recursively search from the current directory and find whatever you have in there. So, the "workaround" is to not use Command-T in directories where you don't want it searching. The tip about CommandTMaxFiles is for use cases that really do involve lots of files, like large monorepos; if that's your situation, then using something like the Watchman scanner is going to be a lot faster anyway (as it maintains an always up-to-date in-memory cache of what's on the filesystem in a given directory hierarchy).

from command-t.

yujinyuz avatar yujinyuz commented on June 8, 2024

I was having the same problem and I managed to get this working by having this in my config

use {
    'wincent/command-t',
    event = 'VimEnter',
}

Previously it was just

use { 'wincent/command-t' }

I'm currently using ruby 2.7.5.

I do have some problems -- when opening a file, the cursor gets placed at the start of the file (as if pressing gg)..

I have an autocommand that jumps to the last edit position -- this does happen but after half a second, it goes back to the top when a file is opened via CommandT. Is this intentional?

Also, is it possible to use other find commands such as rg --files or fd ?

from command-t.

wincent avatar wincent commented on June 8, 2024

I have an autocommand that jumps to the last edit position -- this does happen but after half a second, it goes back to the top when a file is opened via CommandT. Is this intentional?

Nope, @yujinyuz. Unless you configure it otherwise (eg. via g:CommandTAcceptSelectionCommand) Command-T opens files as seen here:

  1. command = options[:command] || default_open_command
  2. VIM::get_string('g:CommandTAcceptSelectionCommand') || 'CommandTOpen edit'
  3. ::VIM::command "silent #{command} #{selection}"

And CommandTOpen is defined here:

command! -nargs=+ CommandTOpen call commandt#GotoOrOpen(<q-args>)

Calling commandt#GotoOrOpen, defined here:

function! commandt#GotoOrOpen(command_and_args) abort
let l:command_and_args = split(a:command_and_args, '\v^\w+ \zs')
let l:command = l:command_and_args[0]
let l:file = l:command_and_args[1]
" `bufwinnr()` doesn't see windows in other tabs, meaning we open them again
" instead of switching to the other tab; but `bufname()` sees hidden
" buffers, and if we try to open one of those, we get an unwanted split.
if s:BufVisible(l:file)
execute 'sbuffer ' . l:file
else
execute l:command . l:file
endif
endfunction

Which basically all boils down to this:

:edit {file}

So, if you see the cursor jumping around after all that, it's probably some other plugin, autocommand, or other configuration that is making it do so.

from command-t.

yujinyuz avatar yujinyuz commented on June 8, 2024

@wincent thanks for the response! It does seem to be caused by this plugin: https://github.com/luukvbaal/stabilize.nvim

Adding it to the ignore list of stabilize.nvim doesn't seem to fix the issue. It doesn't happen when using file finders such as fzf-lua or telescope, and also the normal :edit {file}

from command-t.

wincent avatar wincent commented on June 8, 2024

@yujinyuz I imagine it doesn't affect plugins like Telescope because they (probably) use floating windows whereas Command-T was written long before floating windows existed and so uses normal windows. I'll rewrite it one day to use the newer APIs, but not anytime soon, as it will be a huge undertaking (effectively equivalent to porting from Ruby to Lua).

from command-t.

yujinyuz avatar yujinyuz commented on June 8, 2024

@wincent That might be the case.

Thanks for your answers! I'll be looking forward to the lua rewrite!

from command-t.

AdeAttwood avatar AdeAttwood commented on June 8, 2024

Hi all, I was having a play and I also run into this issue. At first had the plugin in pack/bundle/start and it was autoloading, this was when I was having the issue. I first manually loaded the plugin as per the comments, that got the plugin working.

:ruby $LOAD_PATH << '~/.config/nvim/pack/bundle/start/command-t/ruby/command-t/ext'
....

I then moved it into pack/bundle/opt and added packadd! command-t to the RC, and this sorted all the issues. This leads me to think it's an issue with the loading order.

Hope this helps, and thanks for all the work 👍

from command-t.

wincent avatar wincent commented on June 8, 2024

Given the big rewrite for v6.0.x, I'm closing all older issues as there is unlikely to be anything significant happening on the 5-x-devel branch from here on1. Feedback issue for 6.0.x is here:

Footnotes

  1. Patches and PRs would be welcome, but my personal efforts are going to be directed towards main.

from command-t.

Related Issues (20)

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.