config.example.lua 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 = "onedarker"
  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. -- unmap a default keymapping
  20. -- vim.keymap.del("n", "<C-Up>")
  21. -- override a default keymapping
  22. -- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )
  23. -- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
  24. -- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
  25. -- local _, actions = pcall(require, "telescope.actions")
  26. -- lvim.builtin.telescope.defaults.mappings = {
  27. -- -- for input mode
  28. -- i = {
  29. -- ["<C-j>"] = actions.move_selection_next,
  30. -- ["<C-k>"] = actions.move_selection_previous,
  31. -- ["<C-n>"] = actions.cycle_history_next,
  32. -- ["<C-p>"] = actions.cycle_history_prev,
  33. -- },
  34. -- -- for normal mode
  35. -- n = {
  36. -- ["<C-j>"] = actions.move_selection_next,
  37. -- ["<C-k>"] = actions.move_selection_previous,
  38. -- },
  39. -- }
  40. -- Use which-key to add extra bindings with the leader-key prefix
  41. -- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
  42. -- lvim.builtin.which_key.mappings["t"] = {
  43. -- name = "+Trouble",
  44. -- r = { "<cmd>Trouble lsp_references<cr>", "References" },
  45. -- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
  46. -- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
  47. -- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
  48. -- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
  49. -- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Wordspace Diagnostics" },
  50. -- }
  51. -- TODO: User Config for predefined plugins
  52. -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
  53. lvim.builtin.alpha.active = true
  54. lvim.builtin.alpha.mode = "dashboard"
  55. lvim.builtin.notify.active = true
  56. lvim.builtin.terminal.active = true
  57. lvim.builtin.nvimtree.setup.view.side = "left"
  58. lvim.builtin.nvimtree.show_icons.git = 0
  59. -- if you don't want all the parsers change this to a table of the ones you want
  60. lvim.builtin.treesitter.ensure_installed = {
  61. "bash",
  62. "c",
  63. "javascript",
  64. "json",
  65. "lua",
  66. "python",
  67. "typescript",
  68. "tsx",
  69. "css",
  70. "rust",
  71. "java",
  72. "yaml",
  73. }
  74. lvim.builtin.treesitter.ignore_install = { "haskell" }
  75. lvim.builtin.treesitter.highlight.enabled = true
  76. -- generic LSP settings
  77. -- ---@usage disable automatic installation of servers
  78. -- lvim.lsp.automatic_servers_installation = false
  79. -- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
  80. -- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
  81. -- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
  82. -- local opts = {} -- check the lspconfig documentation for a list of all possible options
  83. -- require("lvim.lsp.manager").setup("pyright", opts)
  84. -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
  85. -- ---`:LvimInfo` lists which server(s) are skiipped for the current filetype
  86. -- vim.tbl_map(function(server)
  87. -- return server ~= "emmet_ls"
  88. -- end, lvim.lsp.automatic_configuration.skipped_servers)
  89. -- -- you can set a custom on_attach function that will be used for all the language servers
  90. -- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
  91. -- lvim.lsp.on_attach_callback = function(client, bufnr)
  92. -- local function buf_set_option(...)
  93. -- vim.api.nvim_buf_set_option(bufnr, ...)
  94. -- end
  95. -- --Enable completion triggered by <c-x><c-o>
  96. -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
  97. -- end
  98. -- -- set a formatter, this will override the language server formatting capabilities (if it exists)
  99. -- local formatters = require "lvim.lsp.null-ls.formatters"
  100. -- formatters.setup {
  101. -- { command = "black", filetypes = { "python" } },
  102. -- { command = "isort", filetypes = { "python" } },
  103. -- {
  104. -- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
  105. -- command = "prettier",
  106. -- ---@usage arguments to pass to the formatter
  107. -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
  108. -- extra_args = { "--print-with", "100" },
  109. -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
  110. -- filetypes = { "typescript", "typescriptreact" },
  111. -- },
  112. -- }
  113. -- -- set additional linters
  114. -- local linters = require "lvim.lsp.null-ls.linters"
  115. -- linters.setup {
  116. -- { command = "flake8", filetypes = { "python" } },
  117. -- {
  118. -- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
  119. -- command = "shellcheck",
  120. -- ---@usage arguments to pass to the formatter
  121. -- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
  122. -- extra_args = { "--severity", "warning" },
  123. -- },
  124. -- {
  125. -- command = "codespell",
  126. -- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
  127. -- filetypes = { "javascript", "python" },
  128. -- },
  129. -- }
  130. -- Additional Plugins
  131. -- lvim.plugins = {
  132. -- {"folke/tokyonight.nvim"},
  133. -- {
  134. -- "folke/trouble.nvim",
  135. -- cmd = "TroubleToggle",
  136. -- },
  137. -- }
  138. -- Autocommands (https://neovim.io/doc/user/autocmd.html)
  139. -- vim.api.nvim_create_autocmd("BufEnter", {
  140. -- pattern = { "*.json", "*.jsonc" },
  141. -- -- enable wrap mode for json files only
  142. -- command = "setlocal wrap",
  143. -- })
  144. -- vim.api.nvim_create_autocmd("FileType", {
  145. -- pattern = "zsh",
  146. -- callback = function()
  147. -- -- let treesitter use bash highlight for zsh files as well
  148. -- require("nvim-treesitter.highlight").attach(0, "bash")
  149. -- end,
  150. -- })