]> git.wincent.com - command-t.git/log
3 months agodocs: add notes on release process main master
Greg Hurrell [Fri, 16 Dec 2022 18:40:17 +0000 (19:40 +0100)] 
docs: add notes on release process

So I can mindless follow the steps here without having to think.

Sure, this could all be much more automated, but I'd rather deal with a
short manual checklist than a fragile automation.

3 months agodocs: start new section in HISTORY post-release
Greg Hurrell [Fri, 16 Dec 2022 18:36:15 +0000 (19:36 +0100)] 
docs: start new section in HISTORY post-release

3 months agochore: prepare for 6.0.0-b.1 release 6.0.0-b.1
Greg Hurrell [Fri, 16 Dec 2022 15:07:48 +0000 (16:07 +0100)] 
chore: prepare for 6.0.0-b.1 release

3 months agochore: freshen Gemfile.lock
Greg Hurrell [Wed, 14 Dec 2022 23:07:50 +0000 (00:07 +0100)] 
chore: freshen Gemfile.lock

    brew install chruby
    brew install ruby-install
    ruby-install --latest ruby
    source /usr/local/opt/chruby/share/chruby/chruby.sh
    chruby 3.1.3
    rm Gemfile.lock

To see if that fixes new CI failures caused by changes in GitHub Actions
as seen here:

- https://github.com/wincent/command-t/actions/runs/3689296487/jobs/6245086655

    Bundler 2.3.5 is running, but your lockfile was generated with 2.0.2. Installing Bundler 2.0.2 and restarting using that version.


    Using bundler 2.0.2
    Following files may not be writable, so sudo is needed:
    Fetching diff-lcs 1.3
    /var/lib/gems/3.0.0/gems/bundler-2.0.2/lib/bundler/shared_helpers.rb:36: warning: Pathname#untaint is deprecated and will be removed in Ruby 3.2.
    ArgumentError: wrong number of arguments (given 2, expected 1)
    An error occurred while installing diff-lcs (1.3), and Bundler cannot continue.
    Make sure that `gem install diff-lcs -v '1.3' --source 'https://rubygems.org/'`
    succeeds before bundling.

    In Gemfile:
      rspec was resolved to 3.9.0, which depends on
        rspec-expectations was resolved to 3.9.0, which depends on

3 months agochore: update actions config to avoid deprecation warnings
Greg Hurrell [Tue, 13 Dec 2022 20:02:36 +0000 (21:02 +0100)] 
chore: update actions config to avoid deprecation warnings

    Node.js 12 actions are deprecated. For more information see:
    Please update the following actions to use Node.js 16:

    ubuntu-latest workflows will use ubuntu-22.04 soon. For more details,
    see https://github.com/actions/runner-images/issues/6399

No new release of `actionsx/prettier` action yet, but I updated the

3 months agodocs: update HISTORY
Greg Hurrell [Tue, 13 Dec 2022 19:01:41 +0000 (20:01 +0100)] 
docs: update HISTORY

3 months agofix: avoid `invalid option '%-100' to 'format'` and similar
Greg Hurrell [Tue, 13 Dec 2022 18:44:34 +0000 (19:44 +0100)] 
fix: avoid `invalid option '%-100' to 'format'` and similar

As described in the related issue, I didn't have a reliable repro, but I
have seen this error message on occasion:

> Error executing lua callback:
> ...command-t/lua/wincent/commandt/private/match_listing.lua:65:
> invalid option '%-100' to 'format'

I first suspected a bad cached value, and that may be the case, but
either way, the arithmetic here seems off, as it will allow a bad format
to occur whenever `width` is, say, 103 (`width` usually comes from
a `Window` instance, with `vim.o.columns` used as a fallback).

I was finally able to repro by setting `margin` to `1` and then
adjusting my window size until `'columns'` was (I think) 107.

Closes: https://github.com/wincent/command-t/issues/415
3 months agoMerge branch 'pull/414'
Greg Hurrell [Thu, 1 Dec 2022 21:26:22 +0000 (22:26 +0100)] 
Merge branch 'pull/414'

Closes: https://github.com/wincent/command-t/pull/414
* pull/414:
  docs: update AUTHORS and HISTORY sections
  fix: correct git scanner options location

3 months agodocs: update AUTHORS and HISTORY sections
Greg Hurrell [Thu, 1 Dec 2022 21:26:09 +0000 (22:26 +0100)] 
docs: update AUTHORS and HISTORY sections

3 months agofix: correct git scanner options location
codybuell [Thu, 1 Dec 2022 12:43:49 +0000 (07:43 -0500)] 
fix: correct git scanner options location

4 months agotest: add tests for `is_table()` and `is_list()`
Greg Hurrell [Fri, 21 Oct 2022 17:30:21 +0000 (19:30 +0200)] 
test: add tests for `is_table()` and `is_list()`

4 months agodoc: start new section in HISTORY post-release
Greg Hurrell [Fri, 21 Oct 2022 17:21:54 +0000 (19:21 +0200)] 
doc: start new section in HISTORY post-release

4 months agochore: prepare for 6.0.0-b.0 release 6.0.0-b.0
Greg Hurrell [Fri, 21 Oct 2022 17:13:31 +0000 (19:13 +0200)] 
chore: prepare for 6.0.0-b.0 release

4 months agodoc: flesh out installation instructions
Greg Hurrell [Fri, 21 Oct 2022 17:07:06 +0000 (19:07 +0200)] 
doc: flesh out installation instructions

This is in response to:

- https://github.com/wincent/command-t/issues/412

4 months agorefactor: improve config validation wincent/validation
Greg Hurrell [Sun, 18 Sep 2022 21:20:06 +0000 (23:20 +0200)] 
refactor: improve config validation

Replace hacked-together config validation with something a little more
robust. This is like `vim.validate()` but "more". Currently only lightly

5 months agochore: avoid duplicate actions runs wincent/actions-dupes
Greg Hurrell [Fri, 7 Oct 2022 09:51:39 +0000 (11:51 +0200)] 
chore: avoid duplicate actions runs

As explained here:

- https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/


- If I pushed to a branch, without making a PR, actions would run once.
- If I pushed to a branch, then opened a PR, actions would run twice.
- If somebody else opened a PR (from a fork), actions would run once.


- If I push to a branch, without making a PR, actions will run once.
- If I push to a branch, then open a PR, actions will run once (ie. due
  to the push, not the PR).
- If somebody else opens a PR (from a fork), actions will run once.

6 months agodocs: update HISTORY section wincent/list-finder
Greg Hurrell [Sun, 18 Sep 2022 09:39:20 +0000 (11:39 +0200)] 
docs: update HISTORY section

6 months agorefactor: reduce duplication in scanner benchmarks
Greg Hurrell [Sun, 18 Sep 2022 09:38:29 +0000 (11:38 +0200)] 
refactor: reduce duplication in scanner benchmarks

More duplication in the stubbing (which is fine), and less duplication
in the scanner set-up (which is good to reduce, because we don't want
this drifting out of sync).

6 months agoperf: make scanner benchmarks work again
Greg Hurrell [Sun, 18 Sep 2022 09:19:47 +0000 (11:19 +0200)] 
perf: make scanner benchmarks work again

These are obviously fragile because they repeat a fair chunk of the
implementation of each scanner. I wanted to avoid requiring the main
`init.lua` file, but I might try that out anyway in the next commit as I
suspect it will be the lesser of two evils.

6 months agorefactor: use list/command finders/scanners
Greg Hurrell [Sat, 17 Sep 2022 22:37:20 +0000 (00:37 +0200)] 
refactor: use list/command finders/scanners

Replaces 5 custom finders/scanners with default config that just calls
the list and command scanners. Primary motivation here is to dogfood the
extension mechanisms, but the obvious secondary benefit is that it DRYs
up a lot of duplication.

This breaks the scanner benchmarks so I've commented them out. I will
fix them in the next commit (or soon after).

6 months agorefactor: rationalize option propagation
Greg Hurrell [Fri, 16 Sep 2022 21:52:53 +0000 (23:52 +0200)] 
refactor: rationalize option propagation

Sorry for the uselessly abstract subject line. What's actually happening
here is this:

- Move `fnameescape()` call into `commandt.open()`. The only finder that
  won't use this is the `help` one, which provides its own. Everything
  else can assume it is working with files.
- Hoist `commandt.open()` up into a local `open` variable so it can be
  declared before `default_option` ans assigned there; note that we're
  getting rid of one layer of indirection here.
- Simplify most finders, now that they don't need to call
  `fnameescape()` themselves.

6 months agorefactor: pass in `open` via options
Greg Hurrell [Fri, 16 Sep 2022 21:13:53 +0000 (23:13 +0200)] 
refactor: pass in `open` via options

This is desirable for two reasons:

1. Consistency with how we call the `command` scanner.
2. It allows a `command` scanner to implement custom `open` logic too.

6 months agofeat: add "list" finder
Greg Hurrell [Tue, 13 Sep 2022 21:25:27 +0000 (23:25 +0200)] 
feat: add "list" finder

This probably isn't the final API, but wanted to show how you could add
an arbitrary scanner + finder that lets you supply a list of candidates
and then implement a pretty novel "open"-ing scheme.

    local has_commandt, commandt = pcall(require, 'wincent.commandt')
    if has_commandt then

        -- Demo: mimic the old CommandTLine scanner + finder.
        finders = {
          line = {
            candidates = function()
              local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
              local result = {}
              for i, line in ipairs(lines) do
                -- Skip blank/empty lines.
                if not line:match('^%s*$') then
                  table.insert(result, vim.trim(line) .. ':' .. tostring(i))
              return result
            open = function(item, _kind)
              -- Extract line number from (eg) "some line contents:100".
              local suffix = string.find(item, "%d+$")
              local index = tonumber(item:sub(suffix))
              vim.api.nvim_win_set_cursor(0, {index, 0})

      -- :CommandTLines (named so as not to clash with :CommandTLine).
      vim.api.nvim_create_user_command('CommandTLines', function(command)
        require('wincent.commandt').finder('line', command.args)
      end, {
        nargs = 0,

6 months agodoc: remove reference to missing fallback from KNOWN ISSUES
Greg Hurrell [Mon, 5 Sep 2022 20:46:37 +0000 (22:46 +0200)] 
doc: remove reference to missing fallback from KNOWN ISSUES

Fallback was added in v6.0.0-a.3 (see commit 005b695).

6 months agodocs: start new section in HISTORY post-release
Greg Hurrell [Mon, 5 Sep 2022 20:39:33 +0000 (22:39 +0200)] 
docs: start new section in HISTORY post-release

6 months agochore: prepare for 6.0.0-a.4 release 6.0.0-a.4
Greg Hurrell [Mon, 5 Sep 2022 20:36:43 +0000 (22:36 +0200)] 
chore: prepare for 6.0.0-a.4 release

6 months agodocs: update README
Greg Hurrell [Mon, 5 Sep 2022 18:17:46 +0000 (20:17 +0200)] 
docs: update README

- Point at new demo GIF.
- Mention Neovim.
- Wordsmith "a minimal number of keystrokes" → "a minimum of
- Remove a hardwrap.

6 months agodocs: update HISTORY section
Greg Hurrell [Mon, 5 Sep 2022 17:31:44 +0000 (19:31 +0200)] 
docs: update HISTORY section

6 months agofeat: show "fallback" in prompt title if, er, falling back
Greg Hurrell [Mon, 5 Sep 2022 17:23:01 +0000 (19:23 +0200)] 
feat: show "fallback" in prompt title if, er, falling back

As discussed here:

- https://github.com/wincent/command-t/issues/393#issuecomment-1236835197

That comment suggested being a bit more verbose:

    CommandT [ find (fall-backed from git) ]

but here I'm going with something a little less descriptive:

    CommandT [fallback]

seeing as the extra detail in the title doesn't tell you _what_ went
wrong; really, all we can do here is show a hint that _something_ went
wrong, so we might as well be brief about it.

Two things to note about implementation:

- One is that I am playing around here trying to figure out how much
  metatable magic I want in here without making it all too "clever". So
  here I have a `__newindex` implementation that allows us to write
  `prompt.name = 'fallback'` instead of `prompt:set_name('fallback')`.
  The former is visually cleaner, but I don't necessarily like that it
  hides the fact that an imperative side-effect is going to take place.
  I will probably "dumb this down" as opposed to trying to use the
  pattern in other places in a uniform way.

- The other is that my earlier claims about top-down React-style
  dataflow are pretty much not true any more. It _was_ true at the
  start, when each component rendered using data passed into it; now we
  have muddied the waters considerably with imperative methods. I will
  almost certainly want to revisit this topic in the future.

6 months agorefactor: rename {un,}stub_candidates to `{un,}stub`
Greg Hurrell [Mon, 5 Sep 2022 16:52:21 +0000 (18:52 +0200)] 
refactor: rename {un,}stub_candidates to `{un,}stub`

Because these are really for general stubbing (including things like
stubbing the global `vim` table) and not just "candidates".

6 months agofix: make watchman scanner work with path argument
Greg Hurrell [Mon, 5 Sep 2022 16:49:10 +0000 (18:49 +0200)] 
fix: make watchman scanner work with path argument

Although the wisdom of making heavy use of this functionality is dubious
(because as you add more watches to Watchman, the slower it gets,
especially in the case of nested projects under a shared root, if my
experience with running the benchmarks is anything to be believed).

6 months agorefactor: DRY up fallback finders
Greg Hurrell [Mon, 5 Sep 2022 16:29:44 +0000 (18:29 +0200)] 
refactor: DRY up fallback finders

Because we might be wanting to change the behavior soon, it would be
nice to be able to change in in _one_ place instead of three.

Specifically, as per:

- https://github.com/wincent/command-t/issues/393#issuecomment-1236835197

we might be putting something in the prompt window title to indicate
what happened.

6 months agoMerge branch 'pull/405'
Greg Hurrell [Mon, 5 Sep 2022 09:28:51 +0000 (11:28 +0200)] 
Merge branch 'pull/405'

Closes: https://github.com/wincent/command-t/pull/405
* pull/405:
  docs: update HISTORY section
  fix: use the right git-ls flag for untracked

6 months agodocs: update HISTORY section
Greg Hurrell [Mon, 5 Sep 2022 09:28:44 +0000 (11:28 +0200)] 
docs: update HISTORY section

6 months agofix: use the right git-ls flag for untracked
Andrea Cedraro [Sun, 4 Sep 2022 22:51:04 +0000 (00:51 +0200)] 
fix: use the right git-ls flag for untracked

According to the documentation [git ls-files help][1] the proper flag for untracked files is `--others` and not `--untracked`.

[1]: https://git-scm.com/docs/git-ls-files#Documentation/git-ls-files.txt--o

Signed-off-by: Greg Hurrell <wincent@github.com>
6 months agofeat: fail fast if bin/format encounters a problem
Greg Hurrell [Fri, 2 Sep 2022 18:10:55 +0000 (20:10 +0200)] 
feat: fail fast if bin/format encounters a problem

6 months agofeat: make bin/check-format return an exit status
Greg Hurrell [Fri, 2 Sep 2022 18:10:23 +0000 (20:10 +0200)] 
feat: make bin/check-format return an exit status

6 months agofeat: add workflow to run Prettier in GitHub actions
Greg Hurrell [Fri, 2 Sep 2022 13:21:58 +0000 (15:21 +0200)] 
feat: add workflow to run Prettier in GitHub actions

This one:

- https://github.com/actionsx/prettier

Seems simpler than this (more popular) alternative which does rather
more than I need it to:

- https://github.com/creyD/prettier_action

You can also just use a Node-based action as described here:

- https://til.simonwillison.net/github-actions/prettier-github-actions

but that `npx` won't cache the installed package, and I don't really
want to add a `package.json` to this project just for that.

6 months agostyle: remove whitespace from CONTRIBUTING
Greg Hurrell [Fri, 2 Sep 2022 13:08:37 +0000 (15:08 +0200)] 
style: remove whitespace from CONTRIBUTING

6 months agodocs: update HISTORY post-release
Greg Hurrell [Wed, 31 Aug 2022 20:33:24 +0000 (22:33 +0200)] 
docs: update HISTORY post-release

And note in `CONTRIBUTING.md` that this is a matter of routine.

6 months agochore: prepare for 6.0.0-a.3 release 6.0.0-a.3
Greg Hurrell [Wed, 31 Aug 2022 20:22:22 +0000 (22:22 +0200)] 
chore: prepare for 6.0.0-a.3 release

6 months agoMerge branch 'wincent/control-characters'
Greg Hurrell [Wed, 31 Aug 2022 20:20:19 +0000 (22:20 +0200)] 
Merge branch 'wincent/control-characters'

* wincent/control-characters:
  docs: update HISTORY section
  fix: don't let control characters mess up the display

6 months agodocs: update HISTORY section
Greg Hurrell [Wed, 31 Aug 2022 20:20:06 +0000 (22:20 +0200)] 
docs: update HISTORY section

6 months agofix: don't let control characters mess up the display
Greg Hurrell [Wed, 31 Aug 2022 19:58:42 +0000 (21:58 +0200)] 
fix: don't let control characters mess up the display


    ╭─ CommandT [file] ────────────────────────────────────────────╮
    │>                                                             │
    │>                                                             │
    │↳ Icon^M                                                      │
    │↳                                                             │
    │  brew.rb                                                     │
    │  ...etc                                                      │


    ╭─ CommandT [file] ────────────────────────────────────────────╮
    │>                                                             │
    │> Icon\r                                                      │
    │  brew.rb                                                     │
    │  ...etc                                                      │

Note that this is a display-only thing, to stop undesired wrapping and
other visual distortions. You can't actually type "Icr" and expect it to
match the file (these is no "r" in the name), although you can open it
by accepting the selection.

Closes: https://github.com/wincent/command-t/issues/402
6 months agoMerge branch 'wincent/fallbacks'
Greg Hurrell [Wed, 31 Aug 2022 19:29:47 +0000 (21:29 +0200)] 
Merge branch 'wincent/fallbacks'

* wincent/fallbacks:
  docs: update HISTORY
  feat: implement fallback for some finders
  refactor: hide stderr from Neovim

6 months agodocs: update HISTORY
Greg Hurrell [Wed, 31 Aug 2022 19:29:34 +0000 (21:29 +0200)] 
docs: update HISTORY

6 months agofeat: implement fallback for some finders
Greg Hurrell [Wed, 31 Aug 2022 19:19:45 +0000 (21:19 +0200)] 
feat: implement fallback for some finders

This implements idea "2" from here:

- https://github.com/wincent/command-t/issues/393#issuecomment-1233200581

> We teach the callers to interpret an empty result list as a cue to
> try again using a fallback mechanism; in an empty directory this would
> give a false negative but a relatively harmless one (ie. you might run
> `:CommandTRipgrep` in an empty folder, and Command-T would take that as
> a cue to try again with the standard scanner, which would of course
> also return an empty list).

Specifically, we do this whenever `git`, `rg`, or `find` returns no

There is a bit of duplication here because we need thunks at each site;
otherwise as soon as we `require`-d the fallback finder it would do a
redundant scan. I'm not going to factor that out yet because I am still
not convinced that this is an optimal strategy. Want to let it bake for
a while and see what happens.

6 months agorefactor: hide stderr from Neovim
Greg Hurrell [Wed, 31 Aug 2022 18:09:32 +0000 (20:09 +0200)] 
refactor: hide stderr from Neovim

This implements idea "3" from here:

- https://github.com/wincent/command-t/issues/393#issuecomment-1233200581

> we may also want to swallow `stderr` so it doesn't leak back in any
> visible way (ie. that would mean changing a call to `git ...` into
> `git ... 2> /dev/null` etc). The only catch is that this may make
> trouble-shooting harder (users could edit out or change the redirect,
> I guess).

So, yeah. This is a double-edged sword, but in the next commit I am
planning on dulling at least one of those edges by implementing a
fallback behavior for each of these scanners.

6 months agoMerge branch 'pull/401'
Greg Hurrell [Wed, 31 Aug 2022 16:54:19 +0000 (18:54 +0200)] 
Merge branch 'pull/401'

Closes: https://github.com/wincent/command-t/pull/401
* pull/401:
  docs: update HISTORY and AUTHORS sections
  docs: update Lua mappings documentation

6 months agodocs: update HISTORY and AUTHORS sections
Greg Hurrell [Wed, 31 Aug 2022 16:54:10 +0000 (18:54 +0200)] 
docs: update HISTORY and AUTHORS sections

6 months agodocs: update Lua mappings documentation
Andrea Cedraro [Wed, 31 Aug 2022 14:07:39 +0000 (16:07 +0200)] 
docs: update Lua mappings documentation


- https://github.com/neovim/neovim/pull/16969

(which is included in neovim 0.7) Neovim always disables the `nore` flag
in mappings, so there is no need to be explicit.

Signed-off-by: Greg Hurrell <greg@hurrell.net>
6 months agoMerge branch 'wincent/fix-32-bit'
Greg Hurrell [Tue, 30 Aug 2022 06:53:48 +0000 (08:53 +0200)] 
Merge branch 'wincent/fix-32-bit'

* wincent/fix-32-bit:
  docs: update HISTORY section
  fix: add missing `-D` prefixes when building on 32-bit architectures
  docs: start new heading for next release under HISTORY

6 months agodocs: update HISTORY section
Greg Hurrell [Tue, 30 Aug 2022 06:53:34 +0000 (08:53 +0200)] 
docs: update HISTORY section

6 months agofix: add missing `-D` prefixes when building on 32-bit architectures
Greg Hurrell [Tue, 30 Aug 2022 06:51:18 +0000 (08:51 +0200)] 
fix: add missing `-D` prefixes when building on 32-bit architectures

As reported here:

- https://github.com/wincent/command-t/issues/399#issuecomment-1231189157

6 months agodocs: start new heading for next release under HISTORY
Greg Hurrell [Tue, 30 Aug 2022 06:50:42 +0000 (08:50 +0200)] 
docs: start new heading for next release under HISTORY

6 months agochore: prepare for 6.0.0-a.2 release 6.0.0-a.2
Greg Hurrell [Mon, 29 Aug 2022 20:21:13 +0000 (22:21 +0200)] 
chore: prepare for 6.0.0-a.2 release

6 months agoMerge branch 'wincent/32-bit'
Greg Hurrell [Mon, 29 Aug 2022 20:16:30 +0000 (22:16 +0200)] 
Merge branch 'wincent/32-bit'

* wincent/32-bit:
  docs: update HISTORY
  style: use uniform indents in Makefile
  fix: use smaller memory allocation values on 32-bit systems

6 months agodocs: update HISTORY
Greg Hurrell [Mon, 29 Aug 2022 20:15:39 +0000 (22:15 +0200)] 
docs: update HISTORY

6 months agostyle: use uniform indents in Makefile
Greg Hurrell [Mon, 29 Aug 2022 20:07:44 +0000 (22:07 +0200)] 
style: use uniform indents in Makefile

As it says here:


the only place tabs matter is in the rules, but we may as well use tabs
everywhere. We could also use spaces; it would work just the same.
Indenting does make it more readable, although it does bust the syntax
highlighting in Vim a little bit, so I guess _somebody_ out there thinks
you should not be using indents for non-rule parts of the Makefile.

I would use something like git.git's Makefile as a guide, but it uses
both indented and unindented conditional bodies. 🤷

6 months agofix: use smaller memory allocation values on 32-bit systems
Greg Hurrell [Mon, 29 Aug 2022 19:42:12 +0000 (21:42 +0200)] 
fix: use smaller memory allocation values on 32-bit systems

To deal with the aborts reported in:


My theory was that on a 32-bit machine an allocation was failing due to
the rather generous sizes involved, given that the DEBUG build showed
the tests passing, and some allocations were recorded in the

We tried with smaller sizes (1/4 of the previous sizes) and the aborts
went away. These sizes are still ridiculously large. The smaller sizes
correspond up to 32 million candidate strings (the largest projects I've
ever worked with or even heard of had anywhere between 1.5 M and 4 M
strings; I expect that anybody working on anything larger than that is
very, very likely running on a 64-bit architecture), and a string
storage slab of 32 G (the way the math works out here is if you had 32 M
strings of length 1K you'd fill up all the space).

So, in this commit, we do some basic autodetection based on `getconf
LONG_BIT` (which is POSIX, so should be relatively portable, even if it
isn't super informative) and use that to decide how big the numbers
should be.

We may still want to make this overridable by users, or otherwise more
sophisticated, but until I see a demand for that, I'll hold off.

The `compile_flags.txt` file is so that `clangd` can know what the
preprocessor options are going to resemble (obviously, these are
hard-coded, so really are just intended to keep the LSP from complaining
about undeclared identifiers).

6 months agoMerge branch 'wincent/delete-words'
Greg Hurrell [Mon, 29 Aug 2022 15:04:42 +0000 (17:04 +0200)] 
Merge branch 'wincent/delete-words'

* wincent/delete-words:
  docs: update HISTORY
  feat: teach prompt window to delete words with `<C-w>`

6 months agodocs: update HISTORY
Greg Hurrell [Mon, 29 Aug 2022 15:04:31 +0000 (17:04 +0200)] 
docs: update HISTORY

6 months agofeat: teach prompt window to delete words with `<C-w>`
Greg Hurrell [Mon, 29 Aug 2022 15:02:03 +0000 (17:02 +0200)] 
feat: teach prompt window to delete words with `<C-w>`

As discussed here:

- https://github.com/wincent/command-t/issues/393#issuecomment-1230075453

6 months agodocs: add some more notes on testing with Vagrant
Greg Hurrell [Sun, 28 Aug 2022 20:58:15 +0000 (22:58 +0200)] 
docs: add some more notes on testing with Vagrant

6 months agodocs: fix typo ("Watcman" -> "Watchman")
Greg Hurrell [Sun, 28 Aug 2022 16:32:27 +0000 (18:32 +0200)] 
docs: fix typo ("Watcman" -> "Watchman")

6 months agodocs: update HISTORY section
Greg Hurrell [Sun, 28 Aug 2022 15:55:32 +0000 (17:55 +0200)] 
docs: update HISTORY section

6 months agofix: fix rendering glitches due to interaction with vim-dirvish
Greg Hurrell [Sun, 28 Aug 2022 15:42:03 +0000 (17:42 +0200)] 
fix: fix rendering glitches due to interaction with vim-dirvish

This isn't a bug in vim-dirvish, but there is something about the way it
operates that triggers this undesired behavior in Command-T. The repro
isn't 100% reliable but it almost is:

1. Create a tmux split in order to have a narrow window to test inside.
2. Open vim-dirvish with `nvim .`.
3. Split the buffer vertically to make it even thinner (strictly
   speaking, you don't have to do this, but it makes it more likely to
4. Open Command-T; see that the match listing is acting as though it
   were scrolled to the right (ie. you can't see the text on the left,
   or you can only see the tail end of it).

Now, what vim-dirvish is doing is having potentially very long absolute
paths in its buffer that are very wide, and hiding the bit that
corresponds to the current working directory using Vim's "conceal"
feature. So, you only see relative paths (relative to the current
working directory), but each line in the buffer may be much longer.

So, given a `'textwidth'` of, say, 80, it's easily possibly for you to
have lines longer than that, even if they don't look that long. This
becomes more obvious if you set `'colorcolumn'` to "+0,+1" etc; you
might have a path that looks like "README.md" in the visible spectrum,
but the line is actually prefixed by something way longer, and you can
see the colorcolumn columns not in column 80 (assuming `'textwidth'` is
80) like you would expect, but in something way farther to the left,
like "column" 15 or 20.

If you jump the cursor all the way to the start of the line (with `^`)
then you see the colorcolumn highlighting move to the right, and
Command-T works without the rendering glitch. If you jump to the end
(with `$`), the colorcolumn highlighting moves back to the left and the
bug returns.

I tried various settings of `'sidescroll'` and `'sidescrolloff'` but the
only way I could get the problem to go away was to turn `'wrap'` _on_,
and then trim my lines to avoid the unwanted wrapping. Moving the cursor
to column 0 with `nvim_win_set_cursor` does not solve this problem, even
thought he docs say it will scroll the window if necessary (note: we
were already doing this).

I tried to repro this without vim-dirvish, and didn't succeed. For
example I got a big Markdown file with long lines and tried various
values of all the settings without reproducing the bug. I turned off
various bells and whistles. I updated vim-dirvish. In the end, I don't
have a smoking gun, but I have a correlation. It's a mystery how the
state of the vim-dirvish window could/would affect an independent buffer
(the match listing); that does feel like a bug, in Neovim most likely.
But it seem so edge-casey and speculative that I don't think I can even
formulate a bug report.

6 months agofix: correct two more stale references to `test.sh`
Greg Hurrell [Sun, 28 Aug 2022 13:23:05 +0000 (15:23 +0200)] 
fix: correct two more stale references to `test.sh`

Overlooked these in c690d3aef7f39070 ("fix: correct broken path in
GitHub action", Aug 28 2022).

6 months agodocs: prepare HISTORY section for subsequent development
Greg Hurrell [Sun, 28 Aug 2022 13:21:39 +0000 (15:21 +0200)] 
docs: prepare HISTORY section for subsequent development

6 months agofix: correct broken path in GitHub action
Greg Hurrell [Sun, 28 Aug 2022 13:20:08 +0000 (15:20 +0200)] 
fix: correct broken path in GitHub action

Broken in 756eb5a277e1b64f ("refactor: get rid of Rake", Aug 28 2022).

6 months agochore: prepare for 6.0.0-a.1 release 6.0.0-a.1
Greg Hurrell [Sun, 28 Aug 2022 13:05:41 +0000 (15:05 +0200)] 
chore: prepare for 6.0.0-a.1 release

6 months agodocs: add back link to canonical upstream
Greg Hurrell [Sun, 28 Aug 2022 12:57:57 +0000 (14:57 +0200)] 
docs: add back link to canonical upstream

This walks back the change I made in 10992d821b156b6c ("Remove
references to wincent.com product pages and repo", Jan 19 2016) a little
bit. I wanted to emphasize GitHub because that's where everybody clones
from (or should clone from), but it feels like mentioning the canonical
upstream is technically the right thing to do.

6 months agodocs: add some notes on release process to CONTRIBUTING.md
Greg Hurrell [Sun, 28 Aug 2022 12:57:46 +0000 (14:57 +0200)] 
docs: add some notes on release process to CONTRIBUTING.md

6 months agorefactor: get rid of Rake
Greg Hurrell [Sun, 28 Aug 2022 12:44:57 +0000 (14:44 +0200)] 
refactor: get rid of Rake

There are bin scripts for doing most of the stuff you could do from

    bin/check-format      Check formatting of C, Lua, and Markdown files
    bin/create-archive    Create ZIP archive from tagged HEAD
    bin/format            Format C, Lua, and Markdown files
    bin/help              Show this usage information
    bin/spec              Run Ruby specs
    bin/test              Run Lua tests

And a top-level Makefile for the common operations:

    make build    compile
    make check    run prerelease checks (clean, build, run tests, check style, check tag)
    make clean    remove build artifacts
    make help     show this help
    make test     run tests

6 months agochore: remove .release-notes.txt from .gitignore
Greg Hurrell [Sun, 28 Aug 2022 08:14:19 +0000 (10:14 +0200)] 
chore: remove .release-notes.txt from .gitignore

Last used in 9c7f81208a32fe4d ("chore: battle bit-rot in gem dependency
graph", May 9 2020).

6 months agochore: add .vagrant and Vagrantfile to .gitignore
Greg Hurrell [Sun, 28 Aug 2022 08:13:59 +0000 (10:13 +0200)] 
chore: add .vagrant and Vagrantfile to .gitignore

6 months agorefactor: get rid of diagnostic message
Greg Hurrell [Sat, 27 Aug 2022 17:52:10 +0000 (19:52 +0200)] 
refactor: get rid of diagnostic message

This is in response to this feedback:


The user in question is loading Command-T like this, using packer:

    use {
      run = 'cd lua/wincent/commandt/lib && make',
      config = function()
        vim.g.CommandTPreferredImplementation = 'lua'

and they see this whenever they run `:PackerCompile`:

      `commandt.setup()` was called after Ruby plugin setup has already run

So, I'm removing this check as it doesn't add a lot of value. My advice,
then, is to move this statement:

    vim.g.CommandTPreferredImplementation = 'lua'

up into the top-level of the `~/.config/nvim/init.lua`. That way,
whenever Command-T's `plugin/command-t.vim` is sourced, it will do the
right thing, which means:

1. Skip doing anything if `command_t_loaded` is already set.
2. Do Lua-centric set-up instead of Ruby-centric set-up.

And then when `plugin/command-t.lua` is sourced (which will always
happen second, because Neovim loads Lua _after_ Vimscript), it will
again do the right thing (ie. do the Lua-centric instead of Ruby-centric

6 months agodocs: add some notes on using Vagrant to create troubleshooting envs
Greg Hurrell [Sat, 27 Aug 2022 17:17:01 +0000 (19:17 +0200)] 
docs: add some notes on using Vagrant to create troubleshooting envs

6 months agorefactor: "expose" `ui.open()` function
Greg Hurrell [Sat, 27 Aug 2022 16:50:02 +0000 (18:50 +0200)] 
refactor: "expose" `ui.open()` function

This is still a private function and I won't be adding it to the docs as
officially supported API, but I want to provide this as a temporary
workaround for the problem reported here:


In short, the:


has a bug in it because it hasn't been touched since February 2019, and
it wasn't written to account for the fact that Neovim mappings can now
map to Lua callbacks instead of Vimscript strings (ie. via the
`vim.keymap.set()` call). So, it has some code that does this:

    let info = maparg('<CR>', 'i', 0, 1)
    if empty(info)
      let old_cr = '<CR>'
      let is_expr = 0
      let old_cr = info['rhs']
      " ... etc

It sees our `<CR>` mapping and dies because it assumes that the returned
`info` has a `'rhs'` key, but it doesn't:

    E716: Key not present in Dictionary: "rhs"

This commit, then, allows us to make a workaround by replacing the Lua
callback with a string-based mapping which _will_ have a RHS:

      mappings = {
        i = {
          ['<CR>'] = "<C-o>:lua require('wincent.commandt.private.ui').open('edit')<CR>",

ie. we replace the standard mapping, which maps to the internal `open()`
callback, with one that imperatively reaches in from the outside and
calls it as seen above.

Like I said, I won't be making this an official API, but I did want to
provide a workaround, seeing as it may be a while before auto-pairs gets

6 months agofix: don't freak out when not passed a `finders` config
Greg Hurrell [Sat, 27 Aug 2022 10:46:43 +0000 (12:46 +0200)] 
fix: don't freak out when not passed a `finders` config

As reported here:


if `options.finders` is not set to (at least an empty) table, we freak
out with:

    lua/wincent/commandt/init.lua:343: bad argument #1 to 'pairs' (table expected, got nil)

6 months agodocs: document `:CommandTRipgrep` and friends
Greg Hurrell [Sat, 27 Aug 2022 08:58:50 +0000 (10:58 +0200)] 
docs: document `:CommandTRipgrep` and friends

- `:CommandTFind`
- `:CommandTGit`
- `:CommandTRipgrep`
- `:CommandTWatchman`

6 months agodocs: remove reference to `g:CommandTSuppressRubyDeprecationWarning`
Greg Hurrell [Sat, 27 Aug 2022 08:51:28 +0000 (10:51 +0200)] 
docs: remove reference to `g:CommandTSuppressRubyDeprecationWarning`

I never implemented this because I realized that if you are going to

    let g:CommandTSuppressRubyDeprecationWarning=1

you may as well just do:

    let g:CommandTPreferredImplementation='ruby'

so, the suppression setting is pointless. I also abandoned my plans of
showing the message only once (ie. by writing something to disk) as not
worth the complexity — too many edge cases.

6 months agofix: apply consistent prefix
Greg Hurrell [Sat, 27 Aug 2022 08:46:32 +0000 (10:46 +0200)] 
fix: apply consistent prefix

When Lua is _not_ the preferred implementation, use `KommandT` prefix
for everything. For some reason, probably a copy-paste error or
something, I had `CommandTRipgrep` instead of `KommandTRipgrep`, unlike
all the others.

6 months agodocs: correct two small typos
Greg Hurrell [Sat, 27 Aug 2022 08:45:14 +0000 (10:45 +0200)] 
docs: correct two small typos

- "a combination Ruby" → "a combination of Ruby"
- "a separate a match" → "a separate match"

6 months agochore: remove empty .gitmodules file
Greg Hurrell [Fri, 26 Aug 2022 22:12:32 +0000 (00:12 +0200)] 
chore: remove empty .gitmodules file

Last content was removed from it in df1471519a6bfef18 ("chore: remove
vendor/vimscriptuploader", Jul 24 2022).

6 months agochore: remove unused config file
Greg Hurrell [Fri, 26 Aug 2022 22:08:43 +0000 (00:08 +0200)] 
chore: remove unused config file

Some more cleanup following on from df1471519a6bfef1 ("chore: remove
vendor/vimscriptuploader", Jul 24 2022), which said:

> Last reference removed in 9c7f81208a32fe4d ("chore: battle bit-rot in
> gem dependency graph", May 9 2020). I've been manually uploading
> releases since then.

This config file was added all the way back in b47221fb41922260
("Rakefile: tweaks to get vimscriptuploader.rb working", Mar 26 2011)
and was never touched again, until now.

6 months agorefactor: mostly clean out Rakefile
Greg Hurrell [Fri, 26 Aug 2022 22:03:13 +0000 (00:03 +0200)] 
refactor: mostly clean out Rakefile

We're not going to be cutting Ruby releases from this branch any more
(see `5-x-release` for that), so most of this file becomes irrelevant.
As noted in the "TODO" comments, I want to remove the release-y bits out
of the Rakefile in a future commit (at which point all it will really be
for is to run the specs, and to be honest, if that just amounts to
`bundle exec spec` I may end up getting rid of the whole file).

6 months agotest: avoid another deprecation warning
Greg Hurrell [Fri, 26 Aug 2022 21:59:38 +0000 (23:59 +0200)] 
test: avoid another deprecation warning

    spec/command-t/watchman/utils_spec.rb:17: warning: constant
    ::Fixnum is deprecated

According to:


> CRuby has two Integer classes, Fixnum and Bignum.
> But it is implementation detail.
> They should be seen as a single class Integer

Unification happened in Ruby 2.4.0, which is approximately $zillion
years ago (well, 25 Dec 2016):


I doubt anybody running these tests is on such an old version at this
point, so it seems safe to switch to `Integer`.

Removed the comments because I am not certain whether we're going to hit
that first `if` branch's body any more, and I'd rather have no comments
than something inaccurate or misleading.

6 months agotest: avoid deprecation warnings
Greg Hurrell [Fri, 26 Aug 2022 21:57:05 +0000 (23:57 +0200)] 
test: avoid deprecation warnings

    WARNING: An expectation of `:number` was set on `nil`. To allow
    expectations on `nil` and suppress this message, set
    `RSpec::Mocks.configuration.allow_message_expectations_on_nil` to
    `true`. To disallow expectations on `nil`, set
    `RSpec::Mocks.configuration.allow_message_expectations_on_nil` to
    `false`. Called from spec/command-t/controller_spec.rb:87:in `stub_vim'.

Verified with either of:

    bundle exec rspec -Iruby
    rake spec

6 months agodocs: prepare HISTORY section for subsequent development
Greg Hurrell [Fri, 26 Aug 2022 20:46:42 +0000 (22:46 +0200)] 
docs: prepare HISTORY section for subsequent development

6 months agodocs: prep documentation for 6.0.0a release next 6.0.0-a.0
Greg Hurrell [Fri, 26 Aug 2022 20:20:04 +0000 (22:20 +0200)] 
docs: prep documentation for 6.0.0a release

7 months agostyle: run clang-format in CI pu
Greg Hurrell [Sat, 30 Jul 2022 12:58:13 +0000 (14:58 +0200)] 
style: run clang-format in CI



7 months agostyle: set up clang-format
Greg Hurrell [Sat, 30 Jul 2022 12:50:13 +0000 (14:50 +0200)] 
style: set up clang-format

Can't say I am in love with _all_ of the changes here, so evidently some
tweaking will be required.

7 months agorefactor(lua): prefer `directory` over `dir` abbreviation
Greg Hurrell [Sat, 30 Jul 2022 11:28:14 +0000 (13:28 +0200)] 
refactor(lua): prefer `directory` over `dir` abbreviation

7 months agodocs(lua): add some notes on Watchman scanner
Greg Hurrell [Sat, 30 Jul 2022 11:10:03 +0000 (13:10 +0200)] 
docs(lua): add some notes on Watchman scanner

And specifically, about the impact of nested watches.

7 months agofix(lua): unbreak scanner benchmarks
Greg Hurrell [Sat, 30 Jul 2022 10:48:56 +0000 (12:48 +0200)] 
fix(lua): unbreak scanner benchmarks

7 months agorefactor(lua): log in DEBUG builds if `pclose()` fails
Greg Hurrell [Sat, 30 Jul 2022 10:08:00 +0000 (12:08 +0200)] 
refactor(lua): log in DEBUG builds if `pclose()` fails

May as well do _something_ here, seeing as we have this splendid `if`,
otherwise I may as well just ignore the return status and write the
whole thing as:

        (void)pclose(file); // Ignore failures.

7 months agofix(lua): fix scanner.c compile error
Greg Hurrell [Sat, 30 Jul 2022 10:04:25 +0000 (12:04 +0200)] 
fix(lua): fix scanner.c compile error

Whatever `cc` is in the CI environment doesn't like having a label right
before a declaration:

    error: a label can only be part of a statement and a declaration is not a statement

As seen here:


I could hoist the declaration up the top, but in general I have been
keep declarations close to their usage sites, so I am just inserting a
no-op statement at the label instead.

7 months agofeat(lua): add ability to configure arbitrary finders/scanners
Greg Hurrell [Sat, 30 Jul 2022 09:20:56 +0000 (11:20 +0200)] 
feat(lua): add ability to configure arbitrary finders/scanners

Here's an example `~/.config/nvim/init.lua` that sets up a finder that
scans using `ack -f --print0`, and can be invoked with `:CommandTAck`:

    local has_commandt, commandt = pcall(require, 'wincent.commandt')
    if has_commandt then
        finders = {
          ack = {
            command = function(directory)
              local command = 'ack -f --print0'
              if directory ~= '' and directory ~= '.' and directory ~= './' then
                directory = vim.fn.shellescape(directory)
                command = command .. ' -- ' .. directory
              return command

      vim.api.nvim_create_user_command('CommandTAck', function(command)
        require('wincent.commandt').finder('ack', command.args)
      end, {
        complete = 'dir',
        nargs = '?',

Here's a simpler version that is hardcoded to allows work from the
current directory:

    local has_commandt, commandt = pcall(require, 'wincent.commandt')
    if has_commandt then
        finders = {
          ack = {
            command = 'ack -f --print0',

      vim.api.nvim_create_user_command('CommandTAck', function(command)
      end, {})

Obviously our options validation is super ugly at this point, and ripe
for a refactor, but it works.

7 months agorefactor(lua): add helpers for validating/fixing options
Greg Hurrell [Thu, 28 Jul 2022 23:08:12 +0000 (01:08 +0200)] 
refactor(lua): add helpers for validating/fixing options

The helpers are hideous, but they make writing the validation relatively