init.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. vim.cmd [[
  2. set packpath-=~/.config/nvim
  3. set packpath-=~/.config/nvim/after
  4. set packpath-=~/.local/share/nvim/site
  5. set packpath^=~/.local/share/lunarvim/site
  6. set packpath^=~/.config/lvim
  7. set runtimepath-=~/.config/nvim
  8. set runtimepath-=~/.config/nvim/after
  9. set runtimepath+=~/.config/lvim
  10. set runtimepath^=~/.local/share/lunarvim/lvim/after
  11. ]]
  12. -- vim.opt.rtp:append() instead of vim.cmd ?
  13. local function file_exists(name)
  14. local f = io.open(name, "r")
  15. if f ~= nil then
  16. io.close(f)
  17. return true
  18. else
  19. return false
  20. end
  21. end
  22. local lvim_path = os.getenv "HOME" .. "/.config/lvim/"
  23. USER_CONFIG_PATH = lvim_path .. "config.lua"
  24. local config_exist = file_exists(USER_CONFIG_PATH)
  25. if not config_exist then
  26. USER_CONFIG_PATH = lvim_path .. "lv-config.lua"
  27. print "Rename ~/.config/lvim/lv-config.lua to config.lua"
  28. end
  29. require "default-config"
  30. local autocmds = require "core.autocmds"
  31. require("settings").load_options()
  32. local status_ok, error = pcall(vim.cmd, "luafile " .. USER_CONFIG_PATH)
  33. if not status_ok then
  34. print("something is wrong with your " .. USER_CONFIG_PATH)
  35. print(error)
  36. end
  37. require("settings").load_commands()
  38. autocmds.define_augroups(lvim.autocommands)
  39. local plugins = require "plugins"
  40. local plugin_loader = require("plugin-loader").init()
  41. plugin_loader:load { plugins, lvim.plugins }
  42. vim.g.colors_name = lvim.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.
  43. vim.cmd("colorscheme " .. lvim.colorscheme)
  44. local utils = require "utils"
  45. utils.toggle_autoformat()
  46. local commands = require "core.commands"
  47. commands.load(commands.defaults)
  48. require("lsp").config()
  49. local null_status_ok, null_ls = pcall(require, "null-ls")
  50. if null_status_ok then
  51. null_ls.config {}
  52. require("lspconfig")["null-ls"].setup {}
  53. end
  54. local lsp_settings_status_ok, lsp_settings = pcall(require, "nlspsettings")
  55. if lsp_settings_status_ok then
  56. lsp_settings.setup {
  57. config_home = os.getenv "HOME" .. "/.config/lvim/lsp-settings",
  58. }
  59. end
  60. require("keymappings").setup()
  61. -- TODO: these guys need to be in language files
  62. -- if lvim.lang.emmet.active then
  63. -- require "lsp.emmet-ls"
  64. -- end
  65. -- if lvim.lang.tailwindcss.active then
  66. -- require "lsp.tailwind