No description
  • Lua 78.5%
  • Vim Script 21.5%
Find a file
2026-10-14 12:08:31 -05:00
autoload/mocha fix job callbacks: err_io, out_cb collection 2026-10-14 09:59:57 -05:00
lua/mocha/source fix .clang/.clang_complete discovery (lua ==# trap), drop trailing empty argv 2026-10-14 12:08:31 -05:00
plugin mocha-clangx: initial import 2026-10-14 09:12:09 -05:00
LICENSE mocha-clangx: initial import 2026-10-14 09:12:09 -05:00
README.md mocha-clangx: initial import 2026-10-14 09:12:09 -05:00

mocha-clangx

clang command-line completion source for mocha, classic Vim 9.1 (+lua, Lua 5.1, +job).

Ports the behavior of the clangx source: runs clang -fsyntax-only -Xclang -code-completion-at over the whole buffer, parses COMPLETION: lines, strips placeholder tokens, and emits {word, menu, info} candidates. 10s timeout, include flags cached per buffer and rebuilt per insert session.

Contract

  • name clangx, mark [clangx], rank 500
  • filetypes c, cpp, objc, objcpp
  • complete position: start of trailing [a-zA-Z0-9_]*

Variables (via mocha#complete#custom#var)

  • clang_binary ('clang')
  • default_c_options (''), default_cpp_options ('')
  • clang_file_path (['.clang', '.clang_complete'], searched from cwd upward; absolute entries used as-is, args shlex-split + ~/$VAR expanded, run dir set to the file's dir)

Include -I flags come from the mocha include source path resolution (b:neoinclude_paths > g:neoinclude#paths > buffer &path + cpp defaults), falling back to clang_file_path, then the default options var.

Job glue

mocha#clangx#complete({id, argv, cwd, stdin_lines}) starts a raw-mode job_start, pipes the buffer on stdin, drains the channel on exit and calls require('mocha.source.clangx')._on_result(id, json_lines).

License

MIT — see LICENSE.