Git Product home page Git Product logo

tmux-complete.vim's Issues

Integrate with nvim-cmp

Something like that:

local source = {}

source.complete = function(self, params, callback)
  vim.fn["tmuxcomplete#async#gather_candidates"](function (raw_items)
    local items = {}
    for _, word in ipairs(raw_items) do
      table.insert(items, {
        label = word,
        dup = 0,
      })
    end

    callback({ items = items })
  end)
end

source.new = function()
  return setmetatable({}, { __index = source })
end
require('cmp').register_source('tmux', source.new())

deoplete source: use async functionality

deoplete has async support for sources by now, which could be used probably with the async work that has been done here lately.

Haven't investigated, but wanted to open this for ideas/discussion already.

deoplete source: expose relevant asynccomplete configuration options

Here's a draft mapping from the asyncomplete option set to deoplete:

deoplete#custom#var('tmux-complete', 'splitmode', 'words')
" (Currently a default of v:false for deoplete)
deoplete#custom#var('tmux-complete', 'filter-prefix', v:true)
deoplete#custom#var('tmux-complete', 'show_incomplete', v:true)
" It seems like this could be better named,
" as it removes duplicate matches more than it sorts.
deoplete#custom#var('tmux-complete', 'sort_candidates', v:false)
deoplete#custom#var('tmux-complete', 'scrollback', 0)
deoplete#custom#var('tmux-complete', 'truncate', 0)

It doesn't look like anything is subsumed by deoplete functionality.

Only Completion for adjacent tmux panes

Hi,
tmux-complete is a great vim-plugin.

I'm using neovim + coc.nvim.
I found it try to complete the words from all panes( I have a lot of sessions. So it becomes very slow)

Can I make it only complete words based on only adjacent tmux panes?

Thanks so much!

expose function that returns a list

Plugins like unite.vim and ctrlp can consume arbitrary lists. It would be great if tmux-complete had a function that returned its results as a list.

Improve performance by calling sh/tmuxwords.sh three times

Instead of calling it once to get all words, call it three times for smaller subtasks and add completion word iteratively:

  1. Get completion words for current window.
  2. Get completion words for current session.
  3. Get completion words for all sessions.

That way the local results should show up immediately and the results from different windows and sessions get added shortly after.

echomsg in autoload/tmuxcomplete.vim?

There was an echomsg command added on line 24 in this commit: 2c44325. Was that intentional or left in after debugging? It's noticeable when typing and seems to leave characters on the command line sometimes.

Strange behaviour

He

I really like your plug-in and want to use it. But since I installed it I have some strange behaviour now and then the cursor seems to hang a bit and then something is inserted but I do not where it comes from. I know that this is not a really helpful description of the problem yet as it does not come with details or a description how to reproduce. However I just wanted to open this to let you know and then try to pin the thing down and add the information here. Or maybe you already have an idea what could cause that or can help me to pin down the problem so we can find a fix.

EDIT:

I use the plugin with neocomplete:

Thus my configuration is just adding this to my vim configuration as you write in your readme.

let g:tmuxcomplete#trigger = ''

CoC specify suggest.completionItemKindLabels for Tmux source

CoC has an option suggest.completionItemKindLabels from here that allows labels to be shown next to completion items like this:
Screen Shot 2021-03-14 at 5 42 55 pm

As you can see in the screenshot though, it seems the Tmux complete plugin doesn't specify a label. For some reason it doesn't even match the catch-all default label icon that I have set (see first result in the following screenshot which comes from coc-tabnine source):
Screen Shot 2021-03-14 at 5 45 44 pm

Happy to provide further clarification if this doesn't make sense

Cannot leave insert mode

This is a really strange behaviour, maybe you have an idea what could cause this. I use the same setup on another mac (both macOS Sierra, Vim 8.0.3) and there's everything woking without any problem.

I use this plugin in combination with neocomplete. The package manager is dein.vim.
If I enter insert mode, I'm not able to leave it again. The only way to exit vim is to close the tmux session/window or to quite the whole terminal (same behaviour in terminal, iTerm, MacVim, it doesn't matter if I started a tmux session before or not).
If I enter "escape", ^[ gets typed.

test

If I uninstall wellle/tmux-complete.vim everything works as expected.

tmux-complete cannot play with YouCompleteMe

Installing the latest YouCompleteMe and tmux-complete.vim plugins respectively. Add let g:tmuxcomplete#trigger = 'omnifunc' to ~/.vimrc.

Pressing <c-space> doesn't trigger tmux completion in vim.

gvim support

I use gvim in one window and tmux in another. In this configuration, tmuxcomplete silently fails.

After some digging, I discovered that the tmuxcomplete shell script is complaining that it is not being run from within tmux.

if [ -z "$TMUX_PANE" ]; then
    echo "Not running inside tmux!" 1>&2
    exit 1
fi

However, it turns out that it is not necessary to run within tmux in order to interact with a running tmux. If I remove that check from the tmuxcomplete shell script, then the script works fine.

Flickering with deoplete

When used in conjunction with deoplete I get constant cursor flickering. This flickering disables when I disable tmux-complete so I'm pretty certain this plugin is the cause of it. I'm wondering why tmux-complete causes this however, is it because gathering candidates is slow?

complete strings from all windows

Great plugin! Currently only panes in the current window are scraped. But it's possible to get strings from all windows with something like this:

tmux select-window -t :2 && tmux capture-pane -J -p -t 0

That captures strings from pane 0 of window 2 in the current session. Windows in the current session can be iterated with tmux list-windows.

tmux-complete 0.1.0 not working with neocomplete

I've updated from tmux-complete 0.0.7 on 0.1.0 and the completion is not working anymore. Here is my minimal vimrc:

set nocompatible " Be iMproved

let g:neosnippet#expand_word_boundary = 1
let g:plug_threads = 40

call plug#begin('~/.vim/plugged/') 

Plug 'Shougo/neocomplete.vim'
Plug 'wellle/tmux-complete.vim', 'v0.1.0'

call plug#end()

let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
" Fixing an autocomplete bug with vim-notes
let g:neocomplete#force_overwrite_completefunc=1

" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
    let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'

" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()

" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags

" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
    let g:neocomplete#sources#omni#input_patterns = {}
endif

if !exists('g:neocomplete#force_omni_input_patterns')
    let g:neocomplete#force_omni_input_patterns = {}
endif

" Prevent from pressing <C-x><C-o> for file aware autocompletion in ruby
let g:neocomplete#force_omni_input_patterns.ruby = '[^.  *\t]\.\w*\|\h\w*::' 

let g:tmuxcomplete#trigger = ''

I tried different things in the g:tmuxcomplete#trigger but that didn't work. If I switch back to tmux-complete 0.0.7 everything works. I have tmux 2.1 on my xubuntu 14.10 machine.

Provide an async api to work with other plugin like asyncomplete.vim

I want to make tmux-complete.vim work with asyncomplete.vim, but there is no document about it. Thanks to @prabirshrestha, he mentioned that it would be better for tmux-complete.vim to have an an async api so that tmux-complete.vim could work asynchronously. So I am wondering wether you could offer an async api in tmux-complete.vim as mentioned here. Thanks a lot.

Complete from all windows and all panes?

Do you know if this will be possible / do you think there is interest in implementing this feature? Currently, it appears it only completes from adjacent panes, is that correct? Perhaps a feature where it completes from all panes and all windows could be added as an optional feature.

Integrate w/ deoplete?

I was wondering if you knew how to use tmux-complete w/ deoplete

I tried omnifunc=tmuxcomplete#completions

tmux 1.6 "unknown option"

tmux 1.6 appears to have capture-pane, but when I use tmuxcomplete#words(0):

tmux: unknown option -- J
usage: capture-pane [-b buffer-index] [-E end-line] [-S start-line] [-t target-pane]

Is it possible for tmuxcomplete to avoid the -J option on tmux 1.6? Sadly, 1.6 is still very common (eg, ubuntu 12.10). I don't have a newer tmux within reach right now so I haven't investigated further.

<sfile> doesn't work on my vim-Configuration

Is this only a problem, I have? Wenn I try to do a completion with this plugin I get the errormessage ./sh/tmuxwords.sh not found. It seems doesn't get converted to the name of the autoload-File so it can't execute the sh-Skript.

I installed the plugin via vundle. Could this be a problem with other plugins? vim is 7.4 including patches 1-183.

tmux-complete conflicts with neocomplete

As both neocomplete and tmux complete use completefunc, a conflict arises.

Changing plugin/tmuxcomplete.vim to use omnifunc allows me to at least use tmux-complete in those filetypes that don't set a specific omnifunc value.

License?

Thanks for a great plugin, I'd like to vendor the shell script into my dotfiles to remove the dependency on github but I noticed that you haven't put any license on it? Can you please consider doing it so we know how we can use it?

Add option to complete scrolled off words

As mentioned in #11.

Add option to complete words that are scrolled off in buffers.

Open questions:

  1. For all panes or only the panes of the current window/session?
  2. Settable number of lines into scrollback or all lines available?

@justinmk: Feel free to weigh in.

Manual completion key?

I'm using neocomplete currently and tmux-complete is unfortunately a little bit too noisy for me.

Is it possible to have tmux completion be triggered through some manual key combination. E.g., <c-x><c-t>?

Feature suggestion: copy all visible lines in specified tmux pane to buffer (I included a working implemention as example)

I really like this plugin!

I ended up taking the tmuxcomplete script and modifying it to allow me to copy all the visible lines in a specified tmux pane to it's own buffer. Then I can edit/copy lines I want and paste them into other buffers using all of vim's power. I wonder if this would be useful to others? I haven't got much experience with writing vim plugins so I'm not sure I could create a useful pull request (but I'd be up for trying). In any case I'll include the changes here so anyone can make use of them and give feedback. Thanks.

Demo of what I've done

A vim session, with a couple of tmux panes on the side

before

Calling my command

pane_selection

After specifying pane 1

pane_1

Doing the above but specifying pane 2

pane_2

.vimrc functions to achieve the above (using altered tmuxcomplete script - see below)

When I want to pull in the contents of a tmux pane, I call a function that asks which pane I want, opens a split, and calls tmuxcomplete with instructions for which pane to target, and to give me a list of lines, and not to sort them:

function! TmuxPaneToBuffer()
    call DisplayTmuxPaneIndices("350")
    " get the input from user
    let targetpane = input("target_pane:")
    if targetpane =~ '\d\+'
        silent execute 'split .tmux_pane_'.targetpane
        silent execute '%!sh /path/to/tmuxcomplete -t '.targetpane.' -s lines -n'
        set filetype=bash
        setlocal buftype=nofile
        setlocal bufhidden=hide
        setlocal noswapfile
        setlocal nobuflisted
    endif
endfunction                             

To make it easier to know the indices of each pane, at the beginning of the function above, I issue a command to tmux to flash the pane indices on screen:

function! DisplayTmuxPaneIndices(duration)
    " bring up the pane numbers as a background job
    call job_start(["tmux", "display-pane", "-d", a:duration])
endfunction                             

Changes to tmuxcomplete script

First I created a new option to specify a particular pane (by it's index) to grab the contents from (I just show the lines that I changed/added in tmuxcomplete):

# Words visible in specified pane in current window
# (can't be used alongside the -e option)
#     sh tmuxcomplete -t <pane_idex>

TARGET='-1'
while getopts enp:s:t:l:c:g: name
    t) TARGET="$OPTARG";;
    *) echo "Usage: $0 [-t <pane_index>] [-p pattern] [-s splitmode] [-l listargs] [-c captureargs] [-g grepargs]\n"

I changed the 'excludecurrent()' function to 'targetpanes()' and added the case when a -t <pane_index> argument is made:

targetpanes() {
    if [ "$EXCLUDE" = "1" ]; then
        currentpane=$(tmux display-message -p '11-#{session_id} ')
        # echo 1>&2 'current' "$currentpane"
        # use -F to match $ in session id
        grep -v -F "$currentpane"
    elif ! [ "$TARGET" = "-1" ]; then
        targetpane=$(tmux display-message -p '01-#{session_id} ')$TARGET
        grep -F "$targetpane"
    else
        cat
    fi
}

Since I wanted the lines of the tmux pane transferred to a vim buffer exactly as they appeared (i.e. unsorted and retaining any line duplicates), I changed the existing 'sortu()' function to keep duplicate lines when not sorting:

# modified
sortu() {
    if [ "$NOSORT" = "1" ]; then
        cat
    else
        sort -u
    fi
}

Here I of course changed the 'excludecurrent' to 'targetpanes':

# list all panes
listpanes |
# filter out current pane
targetpanes |
# take the pane id
paneids |
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.