Code Monkey home page Code Monkey logo

cmp-vimtex's Introduction

cmp-vimtex

nvim-cmp source providing bespoke support for Vimtex's omnifunc.

Check out the tutorial for an in-depth explanation of the plugin's functionality.

Table of contents

Features

Provides support for:

  • Fuzzy matching against all info provided by Vimtex (including bibliographic details, useful for citations):
  • Perform websearches of bibliographic completion items on research databases and search engines (check out the tutorial);
  • Parse and display all details contained in bibtex files:
  • Trimming long strings in the completion menu (adds space for the documenation window):
  • Trigger the completion menu automatically after typing \cite{ (normally, it has to be done manually).
  • Conveniently toggling symbols and additional information shown in the completion menu:
  • Granuarly configuring the menus, and more (check out the tutorial).

Installation

Install the plugin through your plugin manager:

lazy.nvim:

require("lazy").setup({
  "micangl/cmp-vimtex",
})

Setup

Add cmp-vimtex as a completion source:

require('cmp').setup({
  sources = {
    { name = 'vimtex', },
  },
})

If you're manually specifying a custom format function (this doesn't apply to lspkind.nvim), make sure not to overwrite cmp-vimtex's additional information:

format = function(entry, vim_item)
  vim_item.menu = ({
    -- Use this line if you wish to add a specific kind for cmp-vimtex:
    --vimtex = "[Vimtex]" .. (vim_item.menu ~= nil and vim_item.menu or ""),
    vimtex = vim_item.menu,
    buffer = "[Buffer]",
    nvim_lsp = "[LSP]",
  })[entry.source.name]

  return vim_item
end

Eventually, apply your configuration (note:this is not necessary unless you want to apply a custom configuration):

require('cmp_vimtex').setup({
    -- Eventual options can be specified here.
    -- Check out the tutorial for further details.
})

Advanced setup

This is covered in the tutorial.

Acknowledgments

This plugin is based on @hrsh7th's cmp-omni. The timer implementation has been taken from cmp-buffer. The bibtex parser is a lua rewrite of Vimtex's integrated parser, which has also been adapted for asynchronous execution.

I'd like to thank @lervag for all the help provided when developing this plugin.

cmp-vimtex's People

Contributors

micangl avatar lervag avatar jdujava avatar

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.