mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2025-06-22 13:23:46 +02:00
feat: latest changes
This commit is contained in:
parent
03a824311b
commit
1268c5006f
6 changed files with 1333 additions and 383 deletions
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
column_width = 160
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferSingle"
|
||||||
|
call_parentheses = "None"
|
|
@ -1,83 +1,85 @@
|
||||||
-- autoformat.lua
|
|
||||||
--
|
|
||||||
-- Use your language server to automatically format your code on save.
|
|
||||||
-- Adds additional commands as well to manage the behavior
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
'ray-x/go.nvim',
|
|
||||||
'ray-x/guihua.lua',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require("go").setup()
|
|
||||||
-- Switch for controlling whether you want autoformatting.
|
|
||||||
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
|
||||||
local format_is_enabled = true
|
|
||||||
vim.api.nvim_create_user_command('KickstartFormatToggle', function()
|
|
||||||
format_is_enabled = not format_is_enabled
|
|
||||||
print('Setting autoformatting to: ' .. tostring(format_is_enabled))
|
|
||||||
end, {})
|
|
||||||
|
|
||||||
-- Create an augroup that is used for managing our formatting autocmds.
|
|
||||||
-- We need one augroup per client to make sure that multiple clients
|
|
||||||
-- can attach to the same buffer without interfering with each other.
|
|
||||||
local _augroups = {}
|
|
||||||
local get_augroup = function(client)
|
|
||||||
if not _augroups[client.id] then
|
|
||||||
local group_name = 'kickstart-lsp-format-' .. client.name
|
|
||||||
local id = vim.api.nvim_create_augroup(group_name, { clear = true })
|
|
||||||
_augroups[client.id] = id
|
|
||||||
end
|
|
||||||
|
|
||||||
return _augroups[client.id]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Whenever an LSP attaches to a buffer, we will run this function.
|
|
||||||
--
|
|
||||||
-- See `:help LspAttach` for more information about this autocmd event.
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
|
||||||
-- This is where we attach the autoformatting for reasonable clients
|
|
||||||
callback = function(args)
|
|
||||||
local client_id = args.data.client_id
|
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
|
||||||
local bufnr = args.buf
|
|
||||||
|
|
||||||
-- Only attach to clients that support document formatting
|
|
||||||
if not client.server_capabilities.documentFormattingProvider then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Tsserver usually works poorly. Sorry you work with bad languages
|
|
||||||
-- You can remove this line if you know what you're doing :)
|
|
||||||
if client.name == 'tsserver' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create an autocmd that will run *before* we save the buffer.
|
|
||||||
-- Run the formatting command for the LSP that has just attached.
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = get_augroup(client),
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
if not format_is_enabled then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.bo.filetype == 'go' then
|
|
||||||
require('go.format').goimport()
|
|
||||||
else
|
|
||||||
vim.lsp.buf.format {
|
|
||||||
async = false,
|
|
||||||
filter = function(c)
|
|
||||||
return c.id == client.id
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
-- -- autoformat.lua
|
||||||
|
-- --
|
||||||
|
-- -- Use your language server to automatically format your code on save.
|
||||||
|
-- -- Adds additional commands as well to manage the behavior
|
||||||
|
--
|
||||||
|
-- return {
|
||||||
|
-- 'neovim/nvim-lspconfig',
|
||||||
|
-- dependencies = {
|
||||||
|
-- 'ray-x/go.nvim',
|
||||||
|
-- 'ray-x/guihua.lua',
|
||||||
|
-- },
|
||||||
|
-- config = function()
|
||||||
|
-- require("go").setup()
|
||||||
|
-- -- Switch for controlling whether you want autoformatting.
|
||||||
|
-- -- Use :KickstartFormatToggle to toggle autoformatting on or off
|
||||||
|
-- local format_is_enabled = true
|
||||||
|
-- vim.api.nvim_create_user_command('KickstartFormatToggle', function()
|
||||||
|
-- format_is_enabled = not format_is_enabled
|
||||||
|
-- print('Setting autoformatting to: ' .. tostring(format_is_enabled))
|
||||||
|
-- end, {})
|
||||||
|
--
|
||||||
|
-- -- Create an augroup that is used for managing our formatting autocmds.
|
||||||
|
-- -- We need one augroup per client to make sure that multiple clients
|
||||||
|
-- -- can attach to the same buffer without interfering with each other.
|
||||||
|
-- local _augroups = {}
|
||||||
|
-- local get_augroup = function(client)
|
||||||
|
-- if not _augroups[client.id] then
|
||||||
|
-- local group_name = 'kickstart-lsp-format-' .. client.name
|
||||||
|
-- local id = vim.api.nvim_create_augroup(group_name, { clear = true })
|
||||||
|
-- _augroups[client.id] = id
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- return _augroups[client.id]
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- Whenever an LSP attaches to a buffer, we will run this function.
|
||||||
|
-- --
|
||||||
|
-- -- See `:help LspAttach` for more information about this autocmd event.
|
||||||
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
-- group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
||||||
|
-- -- This is where we attach the autoformatting for reasonable clients
|
||||||
|
-- callback = function(args)
|
||||||
|
-- local client_id = args.data.client_id
|
||||||
|
-- local client = vim.lsp.get_client_by_id(client_id)
|
||||||
|
-- local bufnr = args.buf
|
||||||
|
--
|
||||||
|
-- -- Only attach to clients that support document formatting
|
||||||
|
-- if not client.server_capabilities.documentFormattingProvider then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- Tsserver usually works poorly. Sorry you work with bad languages
|
||||||
|
-- -- You can remove this line if you know what you're doing :)
|
||||||
|
-- if client.name == 'tsserver' then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- -- Create an autocmd that will run *before* we save the buffer.
|
||||||
|
-- -- Run the formatting command for the LSP that has just attached.
|
||||||
|
-- vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
-- group = get_augroup(client),
|
||||||
|
-- buffer = bufnr,
|
||||||
|
-- callback = function()
|
||||||
|
-- if not format_is_enabled then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if vim.bo.filetype == 'go' then
|
||||||
|
-- require('go.format').goimport()
|
||||||
|
-- else
|
||||||
|
-- vim.lsp.buf.format {
|
||||||
|
-- async = false,
|
||||||
|
-- filter = function(c)
|
||||||
|
-- return c.id == client.id
|
||||||
|
-- end,
|
||||||
|
-- }
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- }
|
||||||
|
|
|
@ -13,8 +13,8 @@ return {
|
||||||
-- NOTE: And you can specify dependencies as well
|
-- NOTE: And you can specify dependencies as well
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Creates a beautiful debugger UI
|
-- Creates a beautiful debugger UI
|
||||||
'nvim-neotest/nvim-nio',
|
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
-- Installs the debug adapters for you
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
|
@ -27,6 +27,58 @@ return {
|
||||||
'julianolf/nvim-dap-lldb',
|
'julianolf/nvim-dap-lldb',
|
||||||
'vadimcn/codelldb',
|
'vadimcn/codelldb',
|
||||||
},
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<F5>',
|
||||||
|
function()
|
||||||
|
require('dap').continue()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Start/Continue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F1>',
|
||||||
|
function()
|
||||||
|
require('dap').step_into()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Into',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F2>',
|
||||||
|
function()
|
||||||
|
require('dap').step_over()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Over',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F3>',
|
||||||
|
function()
|
||||||
|
require('dap').step_out()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Out',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>b',
|
||||||
|
function()
|
||||||
|
require('dap').toggle_breakpoint()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Toggle Breakpoint',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>B',
|
||||||
|
function()
|
||||||
|
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Set Breakpoint',
|
||||||
|
},
|
||||||
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
|
{
|
||||||
|
'<F7>',
|
||||||
|
function()
|
||||||
|
require('dapui').toggle()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: See last session result.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
|
@ -34,7 +86,7 @@ return {
|
||||||
|
|
||||||
dap.adapters.lldb = {
|
dap.adapters.lldb = {
|
||||||
type = 'server',
|
type = 'server',
|
||||||
command = vim.fn.expand('$HOME/.local/share/nvim/mason/bin/codelldb'),
|
command = vim.fn.expand '$HOME/.local/share/nvim/mason/bin/codelldb',
|
||||||
host = '127.0.0.1',
|
host = '127.0.0.1',
|
||||||
port = 13000,
|
port = 13000,
|
||||||
}
|
}
|
||||||
|
@ -66,7 +118,7 @@ return {
|
||||||
-- online, please don't ask me how to install them :)
|
-- online, please don't ask me how to install them :)
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
-- 'delve',
|
'delve',
|
||||||
'js',
|
'js',
|
||||||
'node2',
|
'node2',
|
||||||
'cppdbg',
|
'cppdbg',
|
||||||
|
@ -75,22 +127,11 @@ return {
|
||||||
'javatest',
|
'javatest',
|
||||||
},
|
},
|
||||||
handlers = {
|
handlers = {
|
||||||
function(config)
|
-- function(config)
|
||||||
require('mason-nvim-dap').default_setup(config)
|
-- require('mason-nvim-dap').default_setup(config)
|
||||||
end
|
-- end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = '[DAP] Continue' })
|
|
||||||
vim.keymap.set('n', '<F1>', dap.step_over, { desc = '[DAP] Over' })
|
|
||||||
vim.keymap.set('n', '<F2>', dap.step_into, { desc = '[DAP] Into' })
|
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = '[DAP] Out' })
|
|
||||||
vim.keymap.set('n', '<F6>', dap.toggle_breakpoint, { desc = '[DAP] Breakpoint toggle' })
|
|
||||||
vim.keymap.set('n', '<F7>', function()
|
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end, { desc = '[DAP] Conditional Breakpoint' })
|
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
dapui.setup {
|
dapui.setup {
|
||||||
|
@ -108,57 +149,61 @@ return {
|
||||||
step_back = 'b',
|
step_back = 'b',
|
||||||
run_last = '▶▶',
|
run_last = '▶▶',
|
||||||
terminate = '⏹',
|
terminate = '⏹',
|
||||||
|
disconnect = '⏏',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
-- dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
-- dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
dap.defaults.fallback.exception_breakpoints = { 'Notice', 'Warning', 'Error', 'Exception' }
|
dap.defaults.fallback.exception_breakpoints = { 'Notice', 'Warning', 'Error', 'Exception' }
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup()
|
require('dap-go').setup{
|
||||||
|
delve = {
|
||||||
-- Install javascript specific config
|
detached = vim.fn.has 'win32' == 0,
|
||||||
require("dap-vscode-js").setup {
|
},
|
||||||
debugger_path = vim.fn.stdpath("data") .. "/mason/packages/js-debug-adapter",
|
|
||||||
debugger_cmd = { "js-debug-adapter" },
|
|
||||||
adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Install javascript specific config
|
||||||
|
require('dap-vscode-js').setup {
|
||||||
|
debugger_path = vim.fn.stdpath 'data' .. '/mason/packages/js-debug-adapter',
|
||||||
|
debugger_cmd = { 'js-debug-adapter' },
|
||||||
|
adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
|
||||||
|
}
|
||||||
|
|
||||||
for _, jsLang in ipairs({ 'typescript', 'javascript' }) do
|
for _, jsLang in ipairs { 'typescript', 'javascript' } do
|
||||||
require("dap").configurations[jsLang] = {
|
require('dap').configurations[jsLang] = {
|
||||||
{
|
{
|
||||||
type = "pwa-node",
|
type = 'pwa-node',
|
||||||
request = "launch",
|
request = 'launch',
|
||||||
name = "Launch file",
|
name = 'Launch file',
|
||||||
program = "${file}",
|
program = '${file}',
|
||||||
cwd = "${workspaceFolder}",
|
cwd = '${workspaceFolder}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "pwa-node",
|
type = 'pwa-node',
|
||||||
request = "attach",
|
request = 'attach',
|
||||||
name = "Attach",
|
name = 'Attach',
|
||||||
processId = require 'dap.utils'.pick_process,
|
processId = require('dap.utils').pick_process,
|
||||||
cwd = "${workspaceFolder}",
|
cwd = '${workspaceFolder}',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "pwa-node",
|
type = 'pwa-node',
|
||||||
request = "launch",
|
request = 'launch',
|
||||||
name = "Debug Jest Tests",
|
name = 'Debug Jest Tests',
|
||||||
-- trace = true, -- include debugger info
|
-- trace = true, -- include debugger info
|
||||||
runtimeExecutable = "node",
|
runtimeExecutable = 'node',
|
||||||
runtimeArgs = {
|
runtimeArgs = {
|
||||||
"./node_modules/jest/bin/jest.js",
|
'./node_modules/jest/bin/jest.js',
|
||||||
"--runInBand",
|
'--runInBand',
|
||||||
},
|
},
|
||||||
rootPath = "${workspaceFolder}",
|
rootPath = '${workspaceFolder}',
|
||||||
cwd = "${workspaceFolder}",
|
cwd = '${workspaceFolder}',
|
||||||
console = "integratedTerminal",
|
console = 'integratedTerminal',
|
||||||
internalConsoleOptions = "neverOpen",
|
internalConsoleOptions = 'neverOpen',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = 'Debug Main Process (Electron)',
|
name = 'Debug Main Process (Electron)',
|
||||||
|
|
61
lua/kickstart/plugins/gitsigns.lua
Normal file
61
lua/kickstart/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||||
|
-- config. This will add also the recommended keymaps.
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gitsigns = require 'gitsigns'
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { ']c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'next'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to next git [c]hange' })
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { '[c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'prev'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to previous git [c]hange' })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
-- visual mode
|
||||||
|
map('v', '<leader>hs', function()
|
||||||
|
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
end, { desc = 'git [s]tage hunk' })
|
||||||
|
map('v', '<leader>hr', function()
|
||||||
|
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
end, { desc = 'git [r]eset hunk' })
|
||||||
|
-- normal mode
|
||||||
|
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||||
|
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||||
|
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||||
|
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||||
|
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||||
|
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
|
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||||
|
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||||
|
map('n', '<leader>hD', function()
|
||||||
|
gitsigns.diffthis '@'
|
||||||
|
end, { desc = 'git [D]iff against last commit' })
|
||||||
|
-- Toggles
|
||||||
|
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||||
|
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
60
lua/kickstart/plugins/lint.lua
Normal file
60
lua/kickstart/plugins/lint.lua
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
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()
|
||||||
|
-- Only run the linter in buffers that you can modify in order to
|
||||||
|
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||||
|
-- describe the hovered symbol using Markdown.
|
||||||
|
if vim.bo.modifiable then
|
||||||
|
lint.try_lint()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue