Compare commits
No commits in common. "c2cb7bf1f6cf94c350712e26a8febb8a0dd4e577" and "70984e2a9ab28d524412e6ef88fb60d25cdd1e13" have entirely different histories.
c2cb7bf1f6
...
70984e2a9a
|
@ -5,12 +5,6 @@ local on_attach = function(client, bufnr)
|
||||||
vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr })
|
vim.keymap.set("n", key, command, { noremap = true, silent = true, buffer = bufnr })
|
||||||
end
|
end
|
||||||
|
|
||||||
local function format_buffer()
|
|
||||||
vim.lsp.buf.format({ timeout_ms = 3000, async = false, filter = function(formatter)
|
|
||||||
return formatter.name ~= "tsserver" and formatter.name ~= "volar"
|
|
||||||
end })
|
|
||||||
end
|
|
||||||
|
|
||||||
local telescope = require("telescope.builtin")
|
local telescope = require("telescope.builtin")
|
||||||
|
|
||||||
nnoremap("gD", vim.lsp.buf.declaration)
|
nnoremap("gD", vim.lsp.buf.declaration)
|
||||||
|
@ -21,18 +15,25 @@ local on_attach = function(client, bufnr)
|
||||||
nnoremap("K", vim.lsp.buf.hover)
|
nnoremap("K", vim.lsp.buf.hover)
|
||||||
nnoremap("<leader>rn", vim.lsp.buf.rename)
|
nnoremap("<leader>rn", vim.lsp.buf.rename)
|
||||||
nnoremap("<leader>ca", vim.lsp.buf.code_action)
|
nnoremap("<leader>ca", vim.lsp.buf.code_action)
|
||||||
nnoremap("<leader>f", format_buffer)
|
nnoremap("<leader>f", vim.lsp.buf.format)
|
||||||
nnoremap("<leader>d", telescope.diagnostics)
|
nnoremap("<leader>d", telescope.diagnostics)
|
||||||
nnoremap("<leader>D", require("lsp_lines").toggle)
|
nnoremap("<leader>D", require("lsp_lines").toggle)
|
||||||
nnoremap("<C-p>", vim.diagnostic.goto_prev)
|
nnoremap("<C-p>", vim.diagnostic.goto_prev)
|
||||||
nnoremap("<C-n>", vim.diagnostic.goto_next)
|
nnoremap("<C-n>", vim.diagnostic.goto_next)
|
||||||
|
|
||||||
|
-- disable tsserver formatting
|
||||||
|
if client.name == "tsserver" then
|
||||||
|
client.server_capabilities.document_formatting = false
|
||||||
|
end
|
||||||
|
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = format_buffer,
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ timeout_ms = 3000, async = false })
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -154,11 +155,3 @@ lspconfig["html"].setup({
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- setup volar
|
|
||||||
lspconfig["volar"].setup({
|
|
||||||
cmd = { "./node_modules/.bin/vue-language-server", "--stdio" },
|
|
||||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' },
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require('nvim-treesitter.configs').setup({
|
||||||
additional_vim_regex_highlighting = false
|
additional_vim_regex_highlighting = false
|
||||||
},
|
},
|
||||||
indent = {
|
indent = {
|
||||||
enable = false,
|
enable = true,
|
||||||
},
|
},
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
Loading…
Reference in New Issue