cord, nvim-lint

This commit is contained in:
Sarjyant 2024-09-26 10:00:26 +05:45
parent b195b6271b
commit 1ea4e128bb
4 changed files with 162 additions and 17 deletions

View File

@ -455,12 +455,14 @@ require('lazy').setup({
require 'kickstart.plugins.dap', require 'kickstart.plugins.dap',
require 'kickstart.plugins.debug', require 'kickstart.plugins.debug',
require 'kickstart.plugins.fzf-telescope', require 'kickstart.plugins.fzf-telescope',
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lsp-config', require 'kickstart.plugins.lsp-config',
require 'kickstart.plugins.mini', require 'kickstart.plugins.mini',
require 'kickstart.plugins.nvim-cmp', require 'kickstart.plugins.nvim-cmp',
require 'kickstart.plugins.treesitter', require 'kickstart.plugins.treesitter',
require 'kickstart.plugins.vim-fugitive', require 'kickstart.plugins.vim-fugitive',
require 'kickstart.plugins.nvim-lint',
require 'kickstart.plugins.cord',
-- require 'kickstart.plugins.indent_line',
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`. -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`

View File

@ -0,0 +1,72 @@
return {
'vyfor/cord.nvim',
build = './build || .\\build',
event = 'VeryLazy',
-- opts = {}, -- calls require('cord').setup()
config = function()
require('cord').setup {
usercmds = true, -- Enable user commands
log_level = 'error', -- One of 'trace', 'debug', 'info', 'warn', 'error', 'off'
timer = {
interval = 1500, -- Interval between presence updates in milliseconds (min 500)
reset_on_idle = false, -- Reset start timestamp on idle
reset_on_change = false, -- Reset start timestamp on presence change
},
editor = {
image = nil, -- Image ID or URL in case a custom client id is provided
client = 'neovim', -- vim, neovim, lunarvim, nvchad, astronvim or your application's client id
tooltip = 'The Superior Text Editor', -- Text to display when hovering over the editor's image
},
display = {
show_time = true, -- Display start timestamp
show_repository = false, -- Display 'View repository' button linked to repository url, if any
show_cursor_position = false, -- Display line and column number of cursor's position
swap_fields = false, -- If enabled, workspace is displayed first
swap_icons = false, -- If enabled, editor is displayed on the main image
workspace_blacklist = {}, -- List of workspace names that will hide rich presence
},
lsp = {
show_problem_count = false, -- Display number of diagnostics problems
severity = 1, -- 1 = Error, 2 = Warning, 3 = Info, 4 = Hint
scope = 'workspace', -- buffer or workspace
},
idle = {
enable = true, -- Enable idle status
show_status = true, -- Display idle status, disable to hide the rich presence on idle
timeout = 300000, -- Timeout in milliseconds after which the idle status is set, 0 to display immediately
disable_on_focus = false, -- Do not display idle status when neovim is focused
text = 'Idle', -- Text to display when idle
tooltip = '💤', -- Text to display when hovering over the idle image
},
text = {
viewing = 'Viewing {}', -- Text to display when viewing a readonly file
editing = 'Editing {}', -- Text to display when editing a file
-- file_browser = 'Browsing files in {}', -- Text to display when browsing files (Empty string to disable)
plugin_manager = 'Managing plugins in {}', -- Text to display when managing plugins (Empty string to disable)
lsp_manager = 'Configuring LSP in {}', -- Text to display when managing LSP servers (Empty string to disable)
vcs = 'Committing changes in {}', -- Text to display when using Git or Git-related plugin (Empty string to disable)
workspace = '', -- Text to display when in a workspace (In {} | Empty string to disable)
},
buttons = {
{
label = 'View Repository', -- Text displayed on the button
url = 'git', -- URL where the button leads to ('git' = automatically fetch Git repository URL)
},
-- {
-- label = 'View Plugin',
-- url = 'https://github.com/vyfor/cord.nvim',
-- }
},
assets = nil, -- Custom file icons, see the wiki*
-- assets = {
-- lazy = { -- Vim filetype or file name or file extension = table or string
-- name = 'Lazy', -- Optional override for the icon name, redundant for language types
-- icon = 'https://example.com/lazy.png', -- Rich Presence asset name or URL
-- tooltip = 'lazy.nvim', -- Text to display when hovering over the icon
-- type = 2, -- 0 = language, 1 = file browser, 2 = plugin manager, 3 = lsp manager, 4 = vcs; defaults to language
-- },
-- ['Cargo.toml'] = 'crates',
-- },
}
end,
}

View File

@ -7,14 +7,25 @@ return {
{ {
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
build = (function() build = (function()
-- Build Step is needed for regex support in snippets -- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments -- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows -- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return return
end end
return 'make install_jsregexp' return 'make install_jsregexp'
end)(), end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
}, },
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
@ -23,18 +34,11 @@ return {
-- into multiple repos for maintenance purposes. -- into multiple repos for maintenance purposes.
'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
-- If you want to add a bunch of pre-configured snippets,
-- you can use this plugin to help you. It even has snippets
-- for various frameworks/libraries/etc. but you will have to
-- set up the ones that are useful for you.
'rafamadriz/friendly-snippets',
}, },
config = function() config = function()
-- See `:help cmp` -- See `:help cmp`
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {} luasnip.config.setup {}
cmp.setup { cmp.setup {
@ -55,11 +59,21 @@ return {
-- Select the [p]revious item -- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion. -- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it. -- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet. -- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true }, ['<C-y>'] = cmp.mapping.confirm { select = true },
-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- Manually trigger a completion from nvim-cmp. -- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display -- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available. -- completions whenever it has completion options available.
@ -83,19 +97,21 @@ return {
luasnip.jump(-1) luasnip.jump(-1)
end end
end, { 'i', 's' }), end, { 'i', 's' }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
}, },
sources = { sources = {
{
name = 'lazydev',
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'path' }, { name = 'path' },
}, },
} }
cmp.setup.filetype({ 'sql' }, {
sources = {
{ name = 'vim-dadbod-completion' },
{ name = 'buffer' },
},
})
end, end,
}, },
} }

View File

@ -0,0 +1,55 @@
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
end,
},
}