mirror of
https://github.com/wellle/tmux-complete.vim.git
synced 2025-12-16 12:00:09 +01:00
feat(compe): implement nvim-compe integration
This commit is contained in:
@@ -123,6 +123,14 @@ Tmux complete is automatically integrated with the following plugins:
|
||||
Unite tmuxcomplete/lines " opens a menu containing words from adjacent tmux windows and lines where they were found
|
||||
```
|
||||
|
||||
- [nvim-compe](https://github.com/hrsh7th/nvim-compe)
|
||||
|
||||
You can use tmux complete as a compe source:
|
||||
|
||||
```vim
|
||||
let g:compe.source.tmux = v:true
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Use your favorite plugin manager.
|
||||
|
||||
22
lua/compe_tmux/init.lua
Normal file
22
lua/compe_tmux/init.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local compe = require'compe'
|
||||
local Source = {}
|
||||
|
||||
function Source.get_metadata(_)
|
||||
return {
|
||||
priority = 10,
|
||||
dup = 0,
|
||||
menu = '[Tmux]'
|
||||
}
|
||||
end
|
||||
|
||||
function Source.determine(_, context)
|
||||
return compe.helper.determine(context)
|
||||
end
|
||||
|
||||
function Source.complete(_, context)
|
||||
local items = vim.fn["tmuxcomplete#complete"](0, context.input)
|
||||
|
||||
context.callback({ items = items })
|
||||
end
|
||||
|
||||
return Source
|
||||
@@ -20,6 +20,10 @@ function! s:init()
|
||||
autocmd User asyncomplete_setup call asyncomplete#sources#tmuxcomplete#register(s:options)
|
||||
|
||||
autocmd User Ncm2Plugin call ncm2#sources#tmuxcomplete#register()
|
||||
|
||||
if exists('g:loaded_compe')
|
||||
lua require'compe'.register_source('tmux', require'compe_tmux')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call s:init()
|
||||
|
||||
Reference in New Issue
Block a user