Skip to content

Furkanzmc/sekme.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sekme.nvim

sekme.nvim is a chain-completion plugin that complements Neovim's own completion functions. (See :help ins-completion)

sekme.nvim uses a list of :help ins-completion keys to rotate the completion source. If one source doesn't provide any completion items, it switches to the next one until a completion is found. It also leverages :help completefunc, but it's just a source in the chain instead of a new one.

I initially copied this idea from completion-nvim and later found out that there's also supertab.vim.

Please note that this is not a completion plugin. It only allows you to make use of all the :help ins-completion sources with just one key map.

asciicast

Why?

Common choices for completion is nvim-cmp and coq_nvim. They are perfectly good plugins with thousands of users and development hours. Feel free to check them out.

The reason for this plugin is my personal preferences. I could never get a smooth experience from those completion plugins, and I prefer to use Vim built-in features wherever I can. I've been using this plugin for as long as I can remember and every time I try to switch to any completion plugin I find myself coming back to this.

This plugin will not blow out in size, or add unnecessary features. It's meant to be very bare bones. All it does is rotate the current :help ins-completion sources. It also exposes a function to add a custom completion source that will be invoked when :help completefunc is the current source.

I also prefer to use :help completefunc and add sources using a general purpose language server (See null-ls and efm-langserver). See here if you are interested in seeing how I use it.

Dependencies

It has no required dependencies. Optionally, you can install options.nvim for configuration. If you don't want to install it, you can still use Vim variables for configuration.

Configuration

Always check out :help sekme.nvim for up to date information. Currently, you can only configure the timeout duration for each completion source.

function complete_work_days(lines, base)
    -- lines is a list of lines in the current buffer. You
    -- don't have to use it.
    return {
        { word = "Monday", kind = "Days" },
        { word = "Tuesday", kind = "Days" },
        { word = "Wednesday", kind = "Days" },
        { word = "Thursday", kind = "Days" },
        { word = "Friday", kind = "Days" },
    }
end

require("sekme").setup({
    completion_key = "<Tab>",
    completion_rkey = "<S-Tab>",
    custom_sources = {
        {
            complete = complete_work_days,
            filetypes = { "markdown" },
        },
    },
})

Installation

Use your favorite plugin manager to install.

Related Projects

TODO

  • Ability to re-use the last completion method the first time after the completion is dismissed. Useful for when <C-x><C-f> was the last completion source used.
  • Add debug logs.

About

Simplistic chain completion plugin for Neovim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published