config.example.lua 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. --[[
  2. lvim is the global options object
  3. Linters should be
  4. filled in as strings with either
  5. a global executable or a path to
  6. an executable
  7. ]]
  8. -- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
  9. -- general
  10. lvim.log.level = "warn"
  11. lvim.format_on_save = true
  12. lvim.colorscheme = "tokyonight"
  13. -- to disable icons and use a minimalist setup, uncomment the following
  14. -- lvim.use_icons = false
  15. -- keymappings [view all the defaults by pressing <leader>Lk]
  16. lvim.leader = "space"
  17. -- add your own keymapping
  18. lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
  19. -- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
  20. -- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
  21. -- unmap a default keymapping
  22. -- vim.keymap.del("n", "<C-Up>")
  23. -- override a default keymapping
  24. -- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )
  25. -- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
  26. -- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
  27. -- local _, actions = pcall(require, "telescope.actions")
  28. -- lvim.builtin.telescope.defaults.mappings = {
  29. -- -- for input mode
  30. -- i = {
  31. -- ["<C-j>"] = actions.move_selection_next,
  32. -- ["<C-k>"] = actions.move_selection_previous,
  33. -- ["<C-n>"] = actions.cycle_history_next,
  34. -- ["<C-p>"] = actions.cycle_history_prev,
  35. -- },
  36. -- -- for normal mode
  37. -- n = {
  38. -- ["<C-j>"] = actions.move_selection_next,
  39. -- ["<C-k>"] = actions.move_selection_previous,
  40. -- },
  41. -- }
  42. -- Change theme settings
  43. -- lvim.builtin.theme.options.dim_inactive = true
  44. -- lvim.builtin.theme.options.style = "storm"
  45. -- Use which-key to add extra bindings with the leader-key prefix
  46. -- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
  47. -- lvim.builtin.which_key.mappings["t"] = {
  48. -- name = "+Trouble",
  49. -- r = { "<cmd>Trouble lsp_references<cr>", "References" },
  50. -- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
  51. -- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
  52. -- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
  53. -- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
  54. -- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" },
  55. -- }
  56. -- TODO: User Config for predefined plugins
  57. -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
  58. lvim.builtin.alpha.active = true
  59. lvim.builtin.alpha.mode = "dashboard"
  60. lvim.builtin.notify.active = true
  61. lvim.builtin.terminal.active = true
  62. lvim.builtin.nvimtree.setup.view.side = "left"
  63. lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
  64. -- if you don't want all the parsers change this to a table of the ones you want
  65. lvim.builtin.treesitter.ensure_installed = {
  66. "bash",
  67. "c",
  68. "javascript",
  69. "json",
  70. "lua",
  71. "python",
  72. "typescript",
  73. "tsx",
  74. "css",
  75. "rust",
  76. "java",
  77. "yaml",
  78. }
  79. lvim.builtin.treesitter.ignore_install = { "haskell" }
  80. lvim.builtin.treesitter.highlight.enable = true
  81. -- generic LSP settings
  82. -- -- make sure server will always be installed even if the server is in skipped_servers list
  83. -- lvim.lsp.installer.setup.ensure_installed = {
  84. -- "sumeko_lua",
  85. -- "jsonls",
  86. -- }
  87. -- -- change UI setting of `LspInstallInfo`
  88. -- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
  89. -- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
  90. -- lvim.lsp.installer.setup.ui.border = "rounded"
  91. -- lvim.lsp.installer.setup.ui.keymaps = {
  92. -- uninstall_server = "d",
  93. -- toggle_server_expand = "o",
  94. -- }
  95. -- ---@usage disable automatic installation of servers
  96. -- lvim.lsp.installer.setup.automatic_installation = false
  97. -- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
  98. -- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
  99. -- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
  100. -- local opts = {} -- check the lspconfig documentation for a list of all possible options
  101. -- require("lvim.lsp.manager").setup("pyright", opts)
  102. -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
  103. -- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
  104. -- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
  105. -- return server ~= "emmet_ls"
  106. -- end, lvim.lsp.automatic_configuration.skipped_servers)
  107. -- -- you can set a custom on_attach function that will be used for all the language servers
  108. -- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
  109. -- lvim.lsp.on_attach_callback = function(client, bufnr)
  110. -- local function buf_set_option(...)
  111. -- vim.api.nvim_buf_set_option(bufnr, ...)
  112. -- end
  113. -- --Enable completion triggered by <c-x><c-o>
  114. -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
  115. -- end
  116. -- -- set a formatter, this will override the language server formatting capabilities (if it exists)
  117. -- local formatters = require "lvim.lsp.null-ls.formatters"
  118. -- formatters.setup {
  119. -- { command = "black", filetypes = { "python" } },
  120. -- { command = "isort", filetypes = { "python" } },
  121. -- {
  122. -- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
  123. -- command = "prettier",
  124. -- ---@usage arguments to pass to the formatter
  125. -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
  126. -- extra_args = { "--print-with", "100" },
  127. -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
  128. -- filetypes = { "typescript", "typescriptreact" },
  129. -- },
  130. -- }
  131. -- -- set additional linters
  132. -- local linters = require "lvim.lsp.null-ls.linters"
  133. -- linters.setup {
  134. -- { command = "flake8", filetypes = { "python" } },
  135. -- {
  136. -- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
  137. -- command = "shellcheck",
  138. -- ---@usage arguments to pass to the formatter
  139. -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
  140. -- extra_args = { "--severity", "warning" },
  141. -- },
  142. -- {
  143. -- command = "codespell",
  144. -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
  145. -- filetypes = { "javascript", "python" },
  146. -- },
  147. -- }
  148. -- Additional Plugins
  149. -- lvim.plugins = {
  150. -- {
  151. -- "folke/trouble.nvim",
  152. -- cmd = "TroubleToggle",
  153. -- },
  154. -- }
  155. -- Autocommands (https://neovim.io/doc/user/autocmd.html)
  156. -- vim.api.nvim_create_autocmd("BufEnter", {
  157. -- pattern = { "*.json", "*.jsonc" },
  158. -- -- enable wrap mode for json files only
  159. -- command = "setlocal wrap",
  160. -- })
  161. -- vim.api.nvim_create_autocmd("FileType", {
  162. -- pattern = "zsh",
  163. -- callback = function()
  164. -- -- let treesitter use bash highlight for zsh files as well
  165. -- require("nvim-treesitter.highlight").attach(0, "bash")
  166. -- end,
  167. -- })