mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2025-06-24 22:28:36 +02:00
Add files via upload
This commit is contained in:
parent
b98a370a30
commit
af21c78d94
4 changed files with 36 additions and 26 deletions
43
init.lua
43
init.lua
|
@ -477,15 +477,6 @@ require('lazy').setup({
|
||||||
local servers = {
|
local servers = {
|
||||||
clangd = {},
|
clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
ruff = {
|
|
||||||
trace = 'messages',
|
|
||||||
on_attach = on_attach,
|
|
||||||
init_options = {
|
|
||||||
settings = {
|
|
||||||
logLevel = 'info',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
--
|
--
|
||||||
|
@ -493,7 +484,7 @@ require('lazy').setup({
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
--
|
--
|
||||||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||||
tsserver = {
|
ts_ls = {
|
||||||
init_options = {
|
init_options = {
|
||||||
plugins = {
|
plugins = {
|
||||||
{
|
{
|
||||||
|
@ -511,8 +502,15 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
--
|
pylsp = {
|
||||||
pylsp = {},
|
plugins = {
|
||||||
|
ruff = {
|
||||||
|
enabled = true,
|
||||||
|
formatEnabled = true,
|
||||||
|
},
|
||||||
|
autopep8 = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
cmake = {},
|
cmake = {},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = {...},
|
-- cmd = {...},
|
||||||
|
@ -567,31 +565,29 @@ require('lazy').setup({
|
||||||
cmd = { 'ConformInfo' },
|
cmd = { 'ConformInfo' },
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>ff',
|
||||||
function()
|
function()
|
||||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||||
end,
|
end,
|
||||||
mode = '',
|
mode = '',
|
||||||
desc = '[F]ormat buffer',
|
desc = '[F]ormat [F]ile buffer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = true,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
-- have a well standardized coding style. You can add additional
|
-- have a well standardized coding style. You can add additional
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- languages here or re-enable it for the disabled ones.
|
||||||
local disable_filetypes = { c = true, cpp = true, py = true, ts = true, vue = true }
|
local disable_filetypes = { c = true, cpp = true, py = true, ts = true, vue = true }
|
||||||
local lsp_format_opt
|
if disable_filetypes[vim.bo[bufnr].filetype] or vim.g.disable_autoformat then
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
return
|
||||||
lsp_format_opt = 'never'
|
|
||||||
else
|
else
|
||||||
lsp_format_opt = 'fallback'
|
|
||||||
end
|
|
||||||
return {
|
return {
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
lsp_format = lsp_format_opt,
|
lsp_format = 'fallback',
|
||||||
}
|
}
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
cmake = { 'cmakelang' },
|
cmake = { 'cmakelang' },
|
||||||
|
@ -599,7 +595,8 @@ require('lazy').setup({
|
||||||
json = { 'clang-format-15' },
|
json = { 'clang-format-15' },
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
python = { 'ruff_format', 'ruff_fix' },
|
python = { 'ruff_format', 'ruff_fix', 'ruff_organize_imports' },
|
||||||
|
['*'] = { 'codespell' },
|
||||||
--
|
--
|
||||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
-- You can use a sub-list to tell conform to run *until* a formatter
|
||||||
-- is found.
|
-- is found.
|
||||||
|
@ -818,7 +815,7 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted thefals
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
-- place them in the correct locations.
|
-- place them in the correct locations.
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,13 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
vim.api.nvim_create_user_command('FormatDisable', function()
|
||||||
|
vim.g.disable_autoformat = true
|
||||||
|
end, {
|
||||||
|
desc = 'Disable autoformat-on-save',
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_user_command('FormatEnable', function()
|
||||||
|
vim.g.disable_autoformat = false
|
||||||
|
end, {
|
||||||
|
desc = 'Re-enable autoformat-on-save',
|
||||||
|
})
|
||||||
|
|
|
@ -12,6 +12,9 @@ vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagn
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||||
vim.keymap.set('n', '<leader>z', require('telescope').extensions.zoxide.list, { desc = '[Z]oxide to different dir' })
|
vim.keymap.set('n', '<leader>z', require('telescope').extensions.zoxide.list, { desc = '[Z]oxide to different dir' })
|
||||||
vim.keymap.set('n', '<leader>jl', require('telescope.builtin').jumplist, { desc = '[J]ump [L]ist' })
|
vim.keymap.set('n', '<leader>jl', require('telescope.builtin').jumplist, { desc = '[J]ump [L]ist' })
|
||||||
|
vim.keymap.set('n', '<leader>ft', function()
|
||||||
|
vim.g.disable_format = not vim.g.disable_autoformat
|
||||||
|
end, { desc = 'Auto[F]ormat [T]oggle ' })
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||||
-- is not what someone will guess without a bit more experience.
|
-- is not what someone will guess without a bit more experience.
|
||||||
|
|
|
@ -6,7 +6,7 @@ return {
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require 'lint'
|
local lint = require 'lint'
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {
|
||||||
python = { 'pylint' },
|
python = { 'ruff' },
|
||||||
markdown = { 'markdownlint' },
|
markdown = { 'markdownlint' },
|
||||||
}
|
}
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue