File: isengard.vim

package info (click to toggle)
vim-command-t 5.0.2-5-g7147ba9-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 744 kB
  • sloc: ruby: 3,394; ansic: 1,177; makefile: 27; sh: 26; xml: 11
file content (25 lines) | stat: -rw-r--r-- 1,024 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
" Copyright 2010-present Greg Hurrell. All rights reserved.
" Licensed under the terms of the BSD 2-clause license.

let s:script_directory=expand('<sfile>:p:h')

" Set up the new async implementation of the Command-T engine -- successor to
" "mirkwood" -- codenamed "isengard".
function! commandt#isengard#init() abort
  let l:daemon_path=resolve(s:script_directory . '/../../ruby/command-t/bin/commandtd')

  let l:client_log_file=get(g:, 'CommandTClientLog', '')
  let l:server_log_file=get(g:, 'CommandTServerLog', '')
  if !empty(l:client_log_file)
    call ch_logfile(l:client_log_file, 'w')
  endif
  if !empty(l:server_log_file)
    let s:job=job_start([l:daemon_path, '--logfile=' . l:server_log_file, '--vim-pid=' . getpid()])
  else
    let s:job=job_start([l:daemon_path, '--vim-pid=' . getpid()])
  endif
  let s:channel=job_getchannel(s:job)

  call ch_evalraw(s:channel, json_encode({'cd': getcwd()}) . "\n")
  let g:CommandTResult=ch_evalraw(s:channel, json_encode({'match': 'commandt'}) . "\n")
endfunction