Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux-complete 0.1.0 not working with neocomplete #63

wikimatze opened this issue Nov 11, 2015 · 16 comments

tmux-complete 0.1.0 not working with neocomplete #63

wikimatze opened this issue Nov 11, 2015 · 16 comments


Copy link

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 = {}
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 = {}

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

" 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.

Copy link

wellle commented Nov 11, 2015

@wikimatze: I can't reproduce. I installed vim with lua via homebrew:

brew install vim --with-lua

I updated my .vimrc to have the contents you posted above (replacing Plug with NeoBundle):

set runtimepath+=~/.vim/bundle/neobundle.vim/
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'Shougo/neocomplete.vim'
NeoBundle 'wellle/tmux-complete.vim'

call neobundle#end()

let g:neocomplete#enable_at_startup = 1
" ...

Then I ran it like this:


I started typing and it started completing:
screen shot 2015-11-11 at 10 39 39

A couple of things to check:

  1. Are you running inside tmux? Are there any other sessions, windows or panes? Do they contain any text you want to complete?
  2. Can you show me the output of vim --version? It should contain +lua.
  3. Inside Vim, does neocomplete work at all?
  4. Inside Vim, does tmux-complete work at all? Try removing the g:tmuxcomplete#trigger line (unrelated to neocomplete integration) and then in insert mode type C-XC-U
  5. What's the output when you run these in Vim?
    • :set runtimepath?
    • :echo exists("g:tmuxcomplete#loaded")
    • :function neocomplete#sources#tmuxcomplete#define (try after using neocomplete)
    • :echo neocomplete#sources#tmuxcomplete#define() (try after the one above)

Copy link
Contributor Author

Thanks for the fast response and the further reproduction steps.

  1. Yup, have a only one tmux session running and vim is running there
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 12 2015 06:16:07)
Included patches: 1-922
Compiled by wm@wm
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    -netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -fstack-protector -rdynamic -Wl,-export-dynamic  -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm  -lselinux  -lncurses -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2  -L/usr/lib/python2.7/config-i386-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions   -Wl,-R/home/wm/.rvm/rubies/ruby-2.2.1/lib -L/home/wm/.rvm/rubies/ruby-2.2.1/lib -lruby -lpthread -lgmp -ldl -lcrypt -lm  -L/home/wm/.rvm/rubies/ruby-2.2.1/lib
  1. Yeah, C-X CI gives me the following menu:
  2. I think here is the error: It prints me "No tmux found!"

Checking your plugin sh/tmuxcomplete brought me to the line:

if ! tmux info &> /dev/null; then
    echo "[tmux-complete.vim]"
    echo "No tmux found!"
    exit 0

And tmux version has the following output:

started Thu Nov 12 06:22:53 2015
socket path /tmp/tmux-1000/default
debug level 0
protocol version 8

Terminal 0: screen-256color [references=1, flags=0x1]:
   0: AX: (flag) true
   1: acsc: (string) ++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~
   2: bce: (flag) false
   3: bel: (string) \007
   4: blink: (string) \033[5m
   5: bold: (string) \033[1m
   6: civis: (string) \033[?25l
   7: clear: (string) \033[H\033[J
   8: cnorm: (string) \033[34h\033[?25h
   9: colors: (number) 256
  10: Cr: [missing]
  11: Cs: [missing]
  12: csr: (string) \033[%i%p1%d;%p2%dr
  13: cub: (string) \033[%p1%dD
  14: cub1: (string) \010
  15: cud: (string) \033[%p1%dB
  16: cud1: (string) \012
  17: cuf: (string) \033[%p1%dC
  18: cuf1: (string) \033[C
  19: cup: (string) \033[%i%p1%d;%p2%dH
  20: cuu: (string) \033[%p1%dA
  21: cuu1: (string) \033M
  22: cvvis: (string) \033[34l
  23: dch: (string) \033[%p1%dP
  24: dch1: (string) \033[P
  25: dim: [missing]
  26: dl: (string) \033[%p1%dM
  27: dl1: (string) \033[M
  28: E3: [missing]
  29: ech: [missing]
  30: el: (string) \033[K
  31: el1: (string) \033[1K
  32: enacs: (string) \033(B\033)0
  33: fsl: (string) \007
  34: home: (string) \033[H
  35: hpa: [missing]
  36: ich: (string) \033[%p1%d@
  37: ich1: [missing]
  38: il: (string) \033[%p1%dL
  39: il1: (string) \033[L
  40: invis: [missing]
  41: is1: [missing]
  42: is2: (string) \033)0
  43: is3: [missing]
  44: kcbt: (string) \033[Z
  45: kcub1: (string) \033OD
  46: kcud1: (string) \033OB
  47: kcuf1: (string) \033OC
  48: kcuu1: (string) \033OA
  49: kDC: [missing]
  50: kDC3: [missing]
  51: kDC4: [missing]
  52: kDC5: [missing]
  53: kDC6: [missing]
  54: kDC7: [missing]
  55: kdch1: (string) \033[3~
  56: kDN: [missing]
  57: kDN3: [missing]
  58: kDN4: [missing]
  59: kDN5: [missing]
  60: kDN6: [missing]
  61: kDN7: [missing]
  62: kend: (string) \033[4~
  63: kEND: [missing]
  64: kEND3: [missing]
  65: kEND4: [missing]
  66: kEND5: [missing]
  67: kEND6: [missing]
  68: kEND7: [missing]
  69: kf1: (string) \033OP
  70: kf10: (string) \033[21~
  71: kf11: (string) \033[23~
  72: kf12: (string) \033[24~
  73: kf13: [missing]
  74: kf14: [missing]
  75: kf15: [missing]
  76: kf16: [missing]
  77: kf17: [missing]
  78: kf18: [missing]
  79: kf19: [missing]
  80: kf2: (string) \033OQ
  81: kf20: [missing]
  82: kf21: [missing]
  83: kf22: [missing]
  84: kf23: [missing]
  85: kf24: [missing]
  86: kf25: [missing]
  87: kf26: [missing]
  88: kf27: [missing]
  89: kf28: [missing]
  90: kf29: [missing]
  91: kf3: (string) \033OR
  92: kf30: [missing]
  93: kf31: [missing]
  94: kf32: [missing]
  95: kf33: [missing]
  96: kf34: [missing]
  97: kf35: [missing]
  98: kf36: [missing]
  99: kf37: [missing]
 100: kf38: [missing]
 101: kf39: [missing]
 102: kf4: (string) \033OS
 103: kf40: [missing]
 104: kf41: [missing]
 105: kf42: [missing]
 106: kf43: [missing]
 107: kf44: [missing]
 108: kf45: [missing]
 109: kf46: [missing]
 110: kf47: [missing]
 111: kf48: [missing]
 112: kf49: [missing]
 113: kf5: (string) \033[15~
 114: kf50: [missing]
 115: kf51: [missing]
 116: kf52: [missing]
 117: kf53: [missing]
 118: kf54: [missing]
 119: kf55: [missing]
 120: kf56: [missing]
 121: kf57: [missing]
 122: kf58: [missing]
 123: kf59: [missing]
 124: kf6: (string) \033[17~
 125: kf60: [missing]
 126: kf61: [missing]
 127: kf62: [missing]
 128: kf63: [missing]
 129: kf7: (string) \033[18~
 130: kf8: (string) \033[19~
 131: kf9: (string) \033[20~
 132: kHOM: [missing]
 133: kHOM3: [missing]
 134: kHOM4: [missing]
 135: kHOM5: [missing]
 136: kHOM6: [missing]
 137: kHOM7: [missing]
 138: khome: (string) \033[1~
 139: kIC: [missing]
 140: kIC3: [missing]
 141: kIC4: [missing]
 142: kIC5: [missing]
 143: kIC6: [missing]
 144: kIC7: [missing]
 145: kich1: (string) \033[2~
 146: kLFT: [missing]
 147: kLFT3: [missing]
 148: kLFT4: [missing]
 149: kLFT5: [missing]
 150: kLFT6: [missing]
 151: kLFT7: [missing]
 152: kmous: (string) \033[M
 153: knp: (string) \033[6~
 154: kNXT: [missing]
 155: kNXT3: [missing]
 156: kNXT4: [missing]
 157: kNXT5: [missing]
 158: kNXT6: [missing]
 159: kNXT7: [missing]
 160: kpp: (string) \033[5~
 161: kPRV: [missing]
 162: kPRV3: [missing]
 163: kPRV4: [missing]
 164: kPRV5: [missing]
 165: kPRV6: [missing]
 166: kPRV7: [missing]
 167: kRIT: [missing]
 168: kRIT3: [missing]
 169: kRIT4: [missing]
 170: kRIT5: [missing]
 171: kRIT6: [missing]
 172: kRIT7: [missing]
 173: kUP: [missing]
 174: kUP3: [missing]
 175: kUP4: [missing]
 176: kUP5: [missing]
 177: kUP6: [missing]
 178: kUP7: [missing]
 179: Ms: [missing]
 180: op: (string) \033[39;49m
 181: rev: (string) \033[7m
 182: ri: (string) \033M
 183: rmacs: (string) \017
 184: rmcup: (string) \033[?1049l
 185: rmkx: (string) \033[?1l\033>
 186: Se: [missing]
 187: setab: (string) \033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m
 188: setaf: (string) \033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m
 189: sgr0: (string) \033[m\017
 190: sitm: [missing]
 191: smacs: (string) \016
 192: smcup: (string) \033[?1049h
 193: smkx: (string) \033[?1h\033=
 194: smso: (string) \033[3m
 195: smul: (string) \033[4m
 196: Ss: [missing]
 197: tsl: (string) \033]0;
 198: vpa: [missing]
 199: xenl: (flag) true
 200: XT: (flag) true

So I think I have tmux in my shell. I'm using the zsh instead of bash. I checked your commit 753db29 and that's the exactly the line of code you changed from

-if [ -z "$TMUX_PANE" ]; then
+if ! tmux info &> /dev/null; then
-    echo "Not running inside tmux!" 1>&2
+    echo "[tmux-complete.vim]"
-    exit 1
+    echo "No tmux found!"
+    exit 0

If I remove that newline, than your plugin is working. Im using the latest tmux 2.1.

  1. I will report these information too:
  • :set runtimepath?:
  • echo exists("g:tmuxcomplete#loaded"): 1 - that's fine
  • :function neocomplete#sources#tmuxcomplete#define - nothing special
  • :echo neocomplete#sources#tmuxcomplete#define() gives me
{'rank': 4, 'name': 'tmux-complete', 'mark': '[tmux]', 'kind': 'keyword', 'gather_candidates': 

Hope, we can find a solution for this problem. As mentioned the solution lies in my eyes in step 4 with the c-x c-u. I will try now tmux 1.9 and see if it happens as well.

Copy link
Contributor Author

I tried tmux 1.9 and tmux 2.0 and got the same errors. I think you should use to check if tmux is running if [ -z "$TMUX_PANE" ]; instead of ! tmux info &> /dev/null;. At least, this work on my zsh.

Copy link
Contributor Author

I tried bash instead of zsh in tmux and got the same error. I'm pretty sure that I found the error with the line above 😄 .

Copy link

wellle commented Nov 12, 2015

I'm using zsh as well. The script is running /bin/sh though. Can you tell me your versions of sh and zsh?

Also can you check the exit code of tmux info by running echo $? afterwards?

That was changed in #61 for #58.

Copy link
Contributor Author

zsh --version
zsh 5.0.2 (i686-pc-linux-gnu)

And tmux info then echo $? gives me 0. Very interesting.

Copy link

wellle commented Nov 12, 2015

  1. What's /bin/sh --version?

  2. Can you try changing the first line in sh/tmuxcomplete to #!/bin/bash and see if that makes a difference (on clean v0.1.0 still using tmux info)?

  3. What happens if you use this check instead (again from clean v0.1.0 using sh)?

    tmux info &> /dev/null
    if [ "$?" -ne "0" ]; then
        echo "[tmux-complete.vim]"
        echo "No tmux found!"
        exit 0

Copy link
Contributor Author

bash --version
GNU bash, version 4.3.11(1)-release (i686-pc-linux-gnu)
  1. Still got the same error

  2. Wow, it is actually working in sh as well as in zsh - I'm more than happy.

Is this the solution? Doesn't it "destroy" gvim and/or MacVim as mentioned in #61 or #58?

Bests Matthias

Copy link

Hello @wellle! First, I wanted to write to thank you for developing this plugin. I use it on a very regular basis and find that it is an important component of my workflow when editing files in vim.

Although my time is very constrained today, I also wanted to let you know that I am seeing exactly the behavior that is outlined in this issue. I noticed that the tmux-complete plugin stopped worked exactly at the point when you changed the code mentioned earlier in this issue.

Like the other people who have reported concerns, I am also using tmux 1.9 and zsh 5.0.7, with the oh-my-zsh enhancement. The only way in which my configuration seems different than that of the others is that I am using youcompleteme instead of the other completion programs.

For the record, I am also running vim in a terminal window with the Ubuntu 15.04 LTS operating system. As needed, I can provide additional details to help you to debug the plugin and ultimately find and commit a fix. Please let us know how you would like us all to further assist you!

Copy link

wellle commented Nov 12, 2015

@wikimatze: It seems like my initial implementation using if ! tmux info is not portable. According to your success with approach (3) I opened PR #64 which implements this change. Please try using that branch

Plug 'wellle/tmux-complete.vim', { 'branch': '63-compatibility' }

and report if that works. In that case I'll merge and release it as v0.1.1.

This doesn't break support for gvim/MacVim, because the important change there was not to rely on the environment variable $TMUX_PANE (which is not set in gvim) but by calling a tmux command like tmux info to see if a tmux is running (which works from gvim). We still do the latter, but in a more portable way.

And for the record: I'd still like to know what version of sh is installed on your machine (not bash). 😉

@gkapfham: Thank you for your kind words! I hope this resolves the issue and allows you to get back into your workflow! Feel free to open follow up issues if you run into problems again or feel like something is missing. 👍

If you want to help, you could also try running tmux-complete from the branch 63-compatibility and let me know if that works for you.

Copy link
Contributor Author

/bin/sh --version
/bin/sh: 0: Illegal option --

According to!topic/gnu.bash/hmPVGXDApL8 this should be okay. But I still wonder about the output.

The code from your branch is working. Thanks for the fix.

Copy link

wellle commented Nov 13, 2015

@wikimatze: Thanks for confirming. I went for a slightly different fix in #64. It's merged and I just released v0.1.1. Could you check that once again?

Copy link
Contributor Author

It's working like a charm, thanks for the POSIX fix.

Copy link

Helllo again @wellle and others. I am also writing to confirm that this fix has now resolved all of the problems that I was facing with this plugin. Everything is now once again working as it was before. Again, thanks for this great vim plugin --- I use it on a very regular basis!

Copy link

wellle commented Nov 19, 2015

@gkapfham: Thanks for confirming 👍

Copy link
Contributor Author

Glad that everyone is happy now with this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

3 participants