Code Monkey home page Code Monkey logo

cmp-tmux's People

Contributors

andersevenrud avatar joshniec avatar lljbash avatar pbnj avatar terrortylor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cmp-tmux's Issues

[BUG] Error when using Neovim within TMUX popup and nvim-cmp

When editing a buffer within Neovim that was started in a TMUX popup an error pops up, see screenshot below. Seems like it has trouble populating a table tbl_map when ran from within a TMUX popup.

I'm using Neovim 0.5.1-stable with nvim-cmp and am experiencing this issue both on MacOS Big Sur as well as Ubuntu 20.04. I have the cmp branch checked out. See below for my nvim-cmp configuration snippet.

A potential workaround is to specify unset TMUX in the shell that is running within the TMUX popup, prior to starting Neovim. However i'll be missing TMUX based completion in that case, which is not too bad considering i'm using TMUX popup's for short-lived and isolated actions.

require('cmp').setup {
  formatting = {
    format = require('lspkind').cmp_format({
      maxwidth = 80,
      menu = ({
        buffer = "[Buffer]",
        calc = "[calc]",
        nvim_lsp = "[LSP]",
        path = "[path]",
        tmux = "[TMUX]",
        spell = "[spell]",
        vsnip = "[vsnip]"
      }),
      with_text = true
    })
  },
  mapping = {
    ['<ESC>'] = function(fallback)
      require('cmp').close()
      fallback()
    end,
    ['<CR>'] = require('cmp').mapping.confirm({
      behavior = require('cmp').ConfirmBehavior.Insert,
      select = true
    }),
    ['<M-i>'] = require('cmp').mapping.scroll_docs(-4),
    ['<M-o>'] = require('cmp').mapping.scroll_docs(4),
    ['<M-n>'] = require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select }),
    ['<M-p>'] = require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })
  },
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end
  },
  sources = {
    { name = 'buffer' },
    { name = 'calc' },
    { name = 'nvim_lsp' },
    { name = 'path' },
    { name = 'tmux',
      opts = {
        all_panes = true,
        trigger_characters = { '.' }
      }
    },
    { name = 'spell' },
    { name = 'vsnip' }
  }
}

image

This plugin must be loaded after cmp to make options work

AFAIK a lot of people use cmp-tmux as a dependency of cmp for convenience. As a result, option set during cmp setup won't effect the source.config which have already been created during cmp-tmux setup.

Please consider using lazy-initialization instead or at least mention this unexpected behaviour in README.

keyword_pattern didn't work

my configuration (the whole file is here):

cmp.setup({
    ...
    sources = {
        { name = "nvim_lsp" },
        { name = "ultisnips" },
        { name = "calc" },
        { name = "emoji" },
        { name = "tmux", option = { keyword_pattern = [[\w\w\w\+]] } },
    },
})

and . triggered:

image

attempt to index field 'tmux' (a nil value)

I'm experiencing an error when starting Neovim having both compe-tmux and nvim-compe loaded using Packer. See error message that pops up during startup of Neovim below and additionally nvim --version output.

Error detected while processing /Users/lcrockett/.local/share/nvim/site/pack/packer/start/compe-tmux/after/plugin/compe_tmux.vim:
line    7:
E5108: Error executing lua ...vim/site/pack/packer/start/compe-tmux/lua/compe_tmux.lua:127: attempt to index field 'tmux' (a nil value)
Press ENTER or type command to continue
NVIM v0.5.0-dev+1328-gc40de6e5f
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210518-19547-8u4dwk/build/config -I/tmp/neovim-20210518-19547-8u4dwk/src -I/usr/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210518-19547-8u4dwk/build/src/nvim/auto -I/tmp/neovim-20210518-19547-8u4dwk/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-c40de6e_2/share/nvim"

Run :checkhealth for more info

Support user-defined custom `kind` label

Builtin compe sources allow changing the kind label, for example:

require('compe').setup({
	source = {
		path = true,
		buffer = { kind = '' },
		nvim_lsp = true,
		nvim_lua = true,
		vsnip = { kind = ' ⮡  (Snippet)' },
		tmux = { kind = '', all_panes = true },
	}
}

However compe-tmux doesn't honor a user-defined kind.
It would be nice to have :)

Error on nvim start

Hi, amazing plugin, proved useful quite a few times already!

I am in the process of refactoring my nvim configuration and am no longer using packer's config keys to configure plugins. I simply have packer to install them all into …/site/pack/packer/start and using after/plugin/* to configure/initialise plugins.

I have run into an issue with compe-tmux, where it would error at nvim's start:

Error detected while processing /Users/<me>/.local/share/nvim/site/pack/packer/start/compe-tmux/after/plugin/compe_tmux.vim:
line    7:
E5108: Error executing lua ...vim/site/pack/packer/start/compe-tmux/lua/compe_tmux.lua:127: attempt to index field 'source' (a nil value)

I do have compe installed and working, configuration contains, amongst other options:

require("compe").setup {                                             
  preselect = "always",                                              
  source = {                                                         
    path = true,      
    buffer = true,                                                   
    vsnip = true,                                                    
    nvim_lsp = {true,  
    spell = { filetypes = { "mail", "gitcommit" } },                 
    tmux = true,                                                     
  },                                                                 
}                                                                    

Do you think that might but in cobpe-tmux or simply some mistake in my setup? Thanks!

Feature: Search all tabs and panes (from the current session only)

First and foremost: thanks a lot for this awesome cmp-plugin :) I just made the switch from 'the old vim' to neovim and am quite happy about this.

One idea though: currently when I activate the option all_panes = true everything works as expected, but feels kinda sluggish and slow. I usually work on a few projects at a time, all in their own tmux-session (including mutt/office stuff and my dotfiles of course).

Would it be feasible to also add an option in the likes of session_panes_only = true, as an in-between option so to say? The idea would be that I have autocompletion from the current session and its contents, but not from other sessions attached (e.g. I don't need autocompletion from my dotfiles in customer-projects). As far as I've looked into it, there is no easy flag (as the -a for all_panes) in tmux to achieve this. I hope that it would react a bit faster, if there is less content to autocomplete from, but I have no idea if that would achieve this goal.

I am quite new to neovim and lua, I can give it a shot, maybe over the holidays. Would a PR for this be welcome?

Error on last update of cmp

I just updated my plugins via packer.nvim, nvim-cmp had quite a few updates and suddenly when I enter vim I get the following error message:
image

How this should work?

i have nvim-cmp installed and also cmp-tmux.

its configured like this:

local cmp = require("cmp")
cmp.setup({
	snippet = {
		expand = function(args)
			require"luasnip".lsp_expand(args.body)
		end
	},
	-- in this order they will appear in the box
	sources = {
		{ name = 'nvim_lsp' },
		{ name = 'luasnip' },
		{ name = 'buffer' },
		{ name = 'path' },
		{ name = 'nvim_lua' },
		{
			name = 'tmux',
			  opts = {
				all_panes = false,
				label = '[tmux]',
				trigger_characters = { '.' },
				trigger_characters_ft = {} -- { filetype = { '.' } }
			  }
		}
	},
	mapping = {
	  -- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
	  -- ['<C-f>'] = cmp.mapping.scroll_docs(4),
	  ['<C-Space>'] = cmp.mapping.complete(),
	  ['<C-e>'] = cmp.mapping.close(),
	  -- ['<CR>'] = cmp.mapping.confirm({
	  --   select = true,
	  --   behavior = cmp.ConfirmBehavior.Replace,
	  -- }),
	  ['<CR>'] = cmp.mapping.abort(),
	  ['<tab>'] = cmp.mapping.confirm({
		select = true,
		behavior = cmp.ConfirmBehavior.Replace,
	  }),
	},
	formatting = {
	  format = function(entry, vim_item)
		-- fancy icons and a name of kind
		vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. " " .. vim_item.kind

		-- set a name for each source
		vim_item.menu = ({
		  buffer = "[Buffer]",
		  nvim_lsp = "[LSP]",
		  luasnip = "[LuaSnip]",
		  nvim_lua = "[Lua]",
		  latex_symbols = "[Latex]",
		  -- https://github.com/andersevenrud/compe-tmux/issues/6
		  tmux = "[tmux]"
		})[entry.source.name]
		return vim_item
	  end,
	},

})

everything is fine.

but i dont understand where should i get completion from this plugin.

i was editing a tmux.conf file and there where no "tmux completion".

a better question is: what do you mean by tmux completion? tmux symbols completion? completion for commands?

Packer error

If using packer the following error pops up if there isn't a packer_compiled.lua file present.

Error detected while processing $HOME/.local/share/nvim/site/pack/packer/start/compe-tmux/after/plugin/compe_tmux.vim:
line    6:
E5108: Error executing lua vim/shared.lua:225: after the second argument: expected table, got nil
stack traceback:
        vim/shared.lua:225: in function 'create_compe_config'
        ...e/pack/packer/start/compe-tmux/lua/compe_tmux/source.lua:15: in function <...e/pack/packer/start/compe-tmux/lua/compe_tmux/source.lua:13>
        [C]: in function 'require'
        [string ":lua"]:1: in main chunk

Support multibye charactor / unicode

Hi,

It seems this plugin doesn't support multibyte charactor, for example 图片。I tried modifying

function source:get_keyword_pattern()
  return [[\w\+]]
end

to [[\k\+]], but failed.

Currently, multibyte charactor is support in buffer source using

sources = cmp.config.sources({
  {name = 'snippy'}, {name = 'nvim_lsp'},
  {name = 'buffer', option = { keyword_pattern = [[\k\+]]}},
  {name = 'path'},
  {name = 'tmux'},
}),

Disable trigger chars

For the cmp branch is there a way to disable the trigger chars per filetype? When typing markdown I don't want a period at the end of a sentence to trigger completion. Thanks.

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.