diff --git a/init.lua b/init.lua index 6c6ae02..233e6b1 100644 --- a/init.lua +++ b/init.lua @@ -189,19 +189,19 @@ require('lazy').setup({ }, }, - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - lazy = false, - config = function() - require('onedark').setup { - -- Set a style preset. 'dark' is default. - style = 'dark', -- dark, darker, cool, deep, warm, warmer, light - } - require('onedark').load() - end, - }, + -- { + -- -- Theme inspired by Atom + -- 'navarasu/onedark.nvim', + -- priority = 1000, + -- lazy = false, + -- config = function() + -- require('onedark').setup { + -- -- Set a style preset. 'dark' is default. + -- style = 'dark', -- dark, darker, cool, deep, warm, warmer, light + -- } + -- require('onedark').load() + -- end, + -- }, { -- Set lualine as statusline @@ -271,7 +271,7 @@ require('lazy').setup({ -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, {}) -- [[ Setting options ]] @@ -281,11 +281,12 @@ require('lazy').setup({ -- Set highlight on search vim.o.hlsearch = false --- Make line numbers default +-- Make relative line numbers default vim.wo.number = true +vim.wo.relativenumber = true --- Enable mouse mode -vim.o.mouse = 'a' +-- Disable mouse mode +vim.o.mouse = '' -- Sync clipboard between OS and Neovim. -- Remove this option if you want your OS clipboard to remain independent. @@ -315,6 +316,14 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +-- Set foldmethod +-- See `:help foldmethod` +vim.o.foldcolumn = '1' +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true +vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] + -- [[ Basic Keymaps ]] -- Keymaps for better default experience @@ -428,8 +437,31 @@ vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = vim.defer_fn(function() require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, - + ensure_installed = { + 'css', + 'dockerfile', + 'eex', + 'elixir', + 'erlang', + 'gitcommit', + 'go', + 'heex', + 'html', + 'http', + 'javascript', + 'json', + 'lua', + 'markdown', + 'markdown_inline', + 'python', + 'sql', + 'toml', + 'tsx', + 'typescript', + 'vim', + 'vimdoc', + 'yaml' + }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) auto_install = false, -- Install languages synchronously (only applied to `ensure_installed`) @@ -573,13 +605,16 @@ require('mason-lspconfig').setup() -- If you want to override the default filetypes that your language server will attach to you can -- define the property 'filetypes' to the map in question. local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - + elixirls = { + elixirLS = { + dialyzerEnabled = true, + dialyzerFormat = "dialyxir_long", + fetchDeps = false, + mixEnv = "test" + } + }, + gopls = {}, + html = { filetypes = { 'html', 'twig', 'hbs'} }, lua_ls = { Lua = { workspace = { checkThirdParty = false }, @@ -588,6 +623,8 @@ local servers = { -- diagnostics = { disable = { 'missing-fields' } }, }, }, + pyright = {}, + tsserver = {}, } -- Setup neovim lua configuration @@ -606,12 +643,23 @@ mason_lspconfig.setup { mason_lspconfig.setup_handlers { function(server_name) - require('lspconfig')[server_name].setup { + local opts = { capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, } + if server_name == 'elixirls' then + local version = vim.fn.system('mise current elixir') or '' + local match_version_111 = string.match(version, '^1.11') + local match_version_112 = string.match(version, '^1.12') + if match_version_111 ~= nil then + opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. '/elixir-ls/release/v0.12.0/language_server.sh' } }) + elseif match_version_112 ~= nil then + opts = vim.tbl_extend('keep', opts, { cmd = { vim.fn.expand('$LOCAL_SRC_HOME') .. '/elixir-ls/release/v0.14.6/language_server.sh' } }) + end + end + require('lspconfig')[server_name].setup(opts) end, }