supoort eslint
This commit is contained in:
parent
f090ecb4ec
commit
b5f39cd226
|
@ -14,8 +14,11 @@ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
|
|||
安装依赖
|
||||
|
||||
```bash
|
||||
sudo dnf install fd-find ripgrep -y
|
||||
sudo dnf install fd-find ripgrep ShellCheck -y
|
||||
go install github.com/jesseduffield/lazygit@latest
|
||||
npm install eslint --global
|
||||
npm install -g typescript typescript-language-server
|
||||
npm install -g @volar/vue-language-server
|
||||
```
|
||||
|
||||
### 记忆项
|
||||
|
|
2
init.lua
2
init.lua
|
@ -41,7 +41,7 @@ require("lsp.go")
|
|||
require("lsp.protocol")
|
||||
require("lsp.bash")
|
||||
require("lsp.docker")
|
||||
require("lsp.html")
|
||||
require("lsp.frontend")
|
||||
require("lsp.volar")
|
||||
require("plugins.lspsaga")
|
||||
-- golang ide config
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
|
||||
"workspace.library": [
|
||||
"/home/x/.config/nvim",
|
||||
"/home/x/.local/share/nvim/site",
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
require("lspconfig").bashls.setup({})
|
||||
require("lspconfig").bashls.setup({
|
||||
|
||||
})
|
||||
|
|
|
@ -15,11 +15,11 @@ require("lspconfig").tsserver.setup({
|
|||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require("lspconfig").eslint.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
})
|
||||
-- require("lspconfig").eslint.setup({
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- buffer = bufnr,
|
||||
-- command = "EslintFixAll",
|
||||
-- })
|
||||
-- end,
|
||||
-- })
|
|
@ -1,10 +1,7 @@
|
|||
require("aerial").setup({
|
||||
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
|
||||
on_attach = function(bufnr)
|
||||
-- Jump forwards/backwards with '{' and '}'
|
||||
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
|
||||
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
|
||||
-- You probably also want to set a keymap to toggle aerial
|
||||
vim.keymap.set("n", "<leader>ol", "<cmd>AerialToggle!<CR>", { buffer = bufnr })
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
require("nvim-autopairs").setup()
|
||||
require("nvim-autopairs").setup({})
|
||||
require("nvim-ts-autotag").setup({})
|
||||
|
|
|
@ -1 +1 @@
|
|||
require("auto-save").setup({ trigger_events = { "InsertLeave" } })
|
||||
require("auto-save").setup({ })
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local null_ls = require("null-ls")
|
||||
require("null-ls").setup({
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.eslint,
|
||||
},
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "LspFormatting", function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
vim.lsp.buf.format({ bufnr = bufnr, timeout_ms = 2000 })
|
||||
end, {})
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
|
|
|
@ -4,3 +4,10 @@ require("lspsaga").setup({
|
|||
kind = require("catppuccin.groups.integrations.lsp_saga").custom_kind(),
|
||||
},
|
||||
})
|
||||
|
||||
require("lsp-colors").setup({
|
||||
Error = "#db4b4b",
|
||||
Warning = "#e0af68",
|
||||
Information = "#0db9d7",
|
||||
Hint = "#10B981"
|
||||
})
|
||||
|
|
|
@ -24,6 +24,7 @@ return require("packer").startup(function(use)
|
|||
})
|
||||
-- 标签补全
|
||||
use({ "windwp/nvim-autopairs" })
|
||||
use({ "windwp/nvim-ts-autotag" })
|
||||
-- 通知
|
||||
use({ "rcarriga/nvim-notify" })
|
||||
-- 自动保存
|
||||
|
@ -96,20 +97,28 @@ return require("packer").startup(function(use)
|
|||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"folke/lsp-colors.nvim",
|
||||
},
|
||||
})
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
requires = {
|
||||
"onsails/lspkind-nvim",
|
||||
"octaltree/cmp-look",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
})
|
||||
-- 代码大纲
|
||||
use({ "stevearc/aerial.nvim" })
|
||||
|
|
|
@ -55,4 +55,7 @@ require("nvim-treesitter.configs").setup({
|
|||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
require("trouble").setup()
|
||||
require("trouble").setup({
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue