Neovim configs for 2023. Hopefully they last.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. -- Learn the keybindings, see :help lsp-zero-keybindings
  2. -- Learn to configure LSP servers, see :help lsp-zero-api-showcase
  3. local lsp = require('lsp-zero')
  4. lsp.preset('recommended')
  5. lsp.setup_nvim_cmp({
  6. experimental = {
  7. ghost_text = true,
  8. },
  9. })
  10. -- (Optional) Configure lua language server for neovim
  11. lsp.nvim_workspace()
  12. local platform = require("mason-core.platform");
  13. local servers = {
  14. 'tailwindcss',
  15. 'tsserver',
  16. 'texlab',
  17. 'pyright',
  18. 'efm',
  19. 'ltex',
  20. 'jsonls'
  21. }
  22. if not (platform.is.linux_x64_musl or
  23. platform.is.linux_arm64_musl)
  24. then
  25. table.insert(servers, "sumneko_lua");
  26. end
  27. lsp.ensure_installed(servers)
  28. lsp.configure("efm", {
  29. settings = {
  30. languages = {
  31. sh = "shellcheck -x",
  32. bash = "shellcheck -x",
  33. zsh = "shellcheck -x",
  34. }
  35. },
  36. filetypes = { "sh", "bash", "zsh" }
  37. })
  38. lsp.on_attach(function(client, bufnr)
  39. local opts = { buffer = bufnr, remap = false }
  40. vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
  41. vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
  42. end)
  43. lsp.setup()
  44. vim.diagnostic.config({
  45. virtual_text = true,
  46. underline = true,
  47. float = true,
  48. })