-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathnvim_ghost.vim
More file actions
64 lines (55 loc) · 2.13 KB
/
Copy pathnvim_ghost.vim
File metadata and controls
64 lines (55 loc) · 2.13 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
if !has('nvim')
finish
endif
if get(g:,'nvim_ghost_disabled', 0)
finish
endif
" Config
let g:nvim_ghost_autostart = get(g:,'nvim_ghost_autostart', 1)
let g:nvim_ghost_use_script = get(g:,'nvim_ghost_use_script', 0)
let g:nvim_ghost_super_quiet = get(g:,'nvim_ghost_super_quiet', 0)
let g:nvim_ghost_logging_enabled = get(g:,'nvim_ghost_logging_enabled', 0)
let g:nvim_ghost_server_port = get(g:,'nvim_ghost_server_port', get(environ(),'GHOSTTEXT_SERVER_PORT', 4001))
" Directories (must end with g:nvim_ghost_pathsep)
let g:nvim_ghost_pathsep = has('win32') ? '\' : '/'
let g:nvim_ghost_installation_dir = expand('<sfile>:h:h')
let g:nvim_ghost_installation_dir ..= g:nvim_ghost_pathsep
let g:nvim_ghost_scripts_dir = g:nvim_ghost_installation_dir . 'scripts'
let g:nvim_ghost_scripts_dir ..= g:nvim_ghost_pathsep
" Files
let g:nvim_ghost_script_path = g:nvim_ghost_installation_dir .. 'binary.py'
let g:nvim_ghost_binary_path = g:nvim_ghost_installation_dir .. 'nvim-ghost-binary' .. (has('win32') ? '.exe' : '')
" Setup environment
let $NVIM_LISTEN_ADDRESS = v:servername
let $NVIM_GHOST_AUTO_EXIT = !g:nvim_ghost_autostart
let $NVIM_GHOST_SUPER_QUIET = g:nvim_ghost_super_quiet
let $NVIM_GHOST_LOGGING_ENABLED = g:nvim_ghost_logging_enabled
let $GHOSTTEXT_SERVER_PORT = g:nvim_ghost_server_port
" Abort if script_mode is enabled but infeasible
if g:nvim_ghost_use_script
if !exists('g:nvim_ghost_python_executable')
echohl WarningMsg
echom 'Please set g:nvim_ghost_python_executable
\ to the location of the python executable'
echohl None
finish
endif
endif
" If autostart is disabled, add GhostTextStart command
if !g:nvim_ghost_autostart
command! GhostTextStart call s:GhostTextStart()
fun! s:GhostTextStart()
call nvim_ghost#init(0)
delcommand GhostTextStart
command GhostTextStop call s:GhostTextStop()
endfun
fun! s:GhostTextStop()
call nvim_ghost#disable()
delcommand GhostTextStop
command GhostTextStart call s:GhostTextStart()
endfun
finish
endif
" Initialize plugin
call nvim_ghost#init()
" vim: et ts=2 sts=0 sw=0 nowrap