hrsh7th/nvim-compe

Tab at the end of line is not working for default config

glyh opened this issue · 1 comments

glyh commented

Checkhealth

Put result of :checkhealth compe.

## compe:snippet
  - OK: snippet engine detected.

## compe:mapping
  - INFO: `compe#complete` is not mapped
  - INFO: `compe#confirm` is not mapped
  - INFO: `compe#close` is not mapped
  - INFO: `compe#scroll` is not mapped

Describe the bug

To Reproduce

Steps to reproduce the behavior with the minimal config:

  1. write some string, end with a none empty character( for example, "a")
  2. put cursor at the end of line in insert mode.
  3. press tab, nothing happen

Actual behavior

No '\t' appeared

Expected behavior

Add a new '\t'

Minimal vimrc

require("packer").startup({function() 
  use "wbthomason/packer.nvim"
  use "hrsh7th/nvim-compe"
end,config = {
  git = {default_url_format = "https://hub.fastgit.org/%s"}
}})

require'compe'.setup {
  enabled = true;
}
local t = function(str)
  return vim.api.nvim_replace_termcodes(str, true, true, true)
end

local check_back_space = function()
    local col = vim.fn.col('.') - 1
    return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
end

_G.tab_complete = function()
  if vim.fn.pumvisible() == 1 then
    return t "<C-n>"
  elseif check_back_space() then
    return t "<Tab>"
  else
    return vim.fn['compe#complete']()
  end
end

vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.