Giter Club home page Giter Club logo

corn.nvim's Introduction

Corn.nvim

Lua

LSP diagnostics at your corner.

Get your LSP feedback the helix way, denoised, uncluttered and cornered.

demo

Install

{ 'RaafatTurki/corn.nvim' }

Setup

require 'corn'.setup()

Use

require 'corn'.toggle(state?)       -- toggle visiblity
require 'corn'.scope(scope_type)    -- change scope type
require 'corn'.scope_cycle()        -- cycle scope type
require 'corn'.render()             -- manually invoke the renderer

or their vim cmds

:CornToggle [on | off]
:CornScope
:CornScopeCycle
:CornRender

Config

-- defaults
require 'corn'.setup {
  -- enables plugin auto commands
  auto_cmds = true,

  -- sorts diagnostics according to a criteria. must be one of `severity`, `severity_reverse`, `column`, `column_reverse`, `line_number` or `line_number_reverse`
  sort_method = 'severity',

  -- sets the scope to be searched for diagnostics, must be one of `line` or `file`
  scope = 'line',

  -- highlights to use for each diagnostic severity level
  highlights = {
    error = "DiagnosticFloatingError",
    warn = "DiagnosticFloatingWarn",
    info = "DiagnosticFloatingInfo",
    hint = "DiagnosticFloatingHint",
  },

  -- icons to use for each diagnostic severity level
  icons = {
    error = "E",
    warn = "W",
    hint = "H",
    info = "I",
  },

  -- a preprocessor function that takes a raw Corn.Item and returns it after modification, could be used for truncation or other purposes
  item_preprocess_func = function(item)
    -- the default truncation logic is here ...
    return item
  end,

  -- a hook that executes each time corn is toggled. the current state is provided via `is_hidden`
  on_toggle = function(is_hidden)
    -- custom logic goes here
  end,
}

Tips

virtual text diagnostics visiblity

enable virtual text diagnostics when corn is off and disable it when it's on

-- ensure virtual_text diags are disabled
vim.diagnostic.config { virtual_text = false }

-- toggle virtual_text diags when corn is toggled
require 'corn'.setup {
  on_toggle = function(is_hidden)
    vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text })
  end
}
disable truncation

disable the default truncation which is implemented inside item_preprocess_func

-- set item_preprocess_func to return the item unmodified
require 'corn'.setup {
  item_preprocess_func = function(item)
    return item
  end
}

Plans

  • Add a component based custom render function for both window opts and text rendering

corn.nvim's People

Contributors

farias-hecdin avatar raafatturki avatar z775729168 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.