~damien/dotfiles

fc8d0e62369e245054ff1b2ecaf6a8b9af5dda40 — Damien Radtke 7 months ago f3cffca
Use mason for LSP + other small changes
M vim/.config/nvim/init.lua => vim/.config/nvim/init.lua +3 -5
@@ 17,9 17,7 @@ vim.keymap.set('n', '<leader>rf', '<cmd>TestNearest<cr>')
vim.keymap.set('n', '<leader>rb', '<cmd>TestFile<cr>')
vim.keymap.set('n', '<leader>rl', '<cmd>TestLast<cr>')

vim.cmd [[colorscheme catppuccin]]

-- debug-console development
vim.cmd [[
	source /home/damien/Workspace/debug-console/misc/nvim/debug-console.vim
]]
--vim.cmd [[
--	source /home/damien/Workspace/debug-console/misc/nvim/debug-console.vim
--]]

M vim/.config/nvim/lua/lsp.lua => vim/.config/nvim/lua/lsp.lua +16 -25
@@ 3,11 3,6 @@ if not ok then
	return
end

local ok, lsp_installer = pcall(require, 'nvim-lsp-installer')
if not ok then
	return
end

-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }


@@ 49,35 44,35 @@ local lsp_flags = {
	debounce_text_changes = 150,
}

local lsp_server_dir = vim.fn.stdpath('data')..'/lsp_servers'
local mason_dir = vim.fn.stdpath('data')..'/mason'

lspconfig['rust_analyzer'].setup {
	on_attach = on_attach,
	flags = lsp_flags,
	cmd = {lsp_server_dir..'/rust/rust-analyzer'},
	cmd = {mason_dir..'/bin/rust-analyzer'},
	-- Server-specific settings...
	settings = {
		["rust-analyzer"] = {}
	}
}

lspconfig['sumneko_lua'].setup {
	on_attach = on_attach,
	flags = lsp_flags,
	cmd = {lsp_server_dir..'/sumneko_lua/extension/server/bin/lua-language-server'},
	settings = {
		Lua = {
			diagnostics = {
				globals = {'vim'}
			}
		}
	}
}
--lspconfig['sumneko_lua'].setup {
--	on_attach = on_attach,
--	flags = lsp_flags,
--	cmd = {mason_dir..'/sumneko_lua/extension/server/bin/lua-language-server'},
--	settings = {
--		Lua = {
--			diagnostics = {
--				globals = {'vim'}
--			}
--		}
--	}
--}

lspconfig['gopls'].setup {
	on_attach = on_attach,
	flags = lsp_flags,
	cmd = {lsp_server_dir..'/gopls/gopls'},
	cmd = {mason_dir..'/bin/gopls'},
	-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
	--settings = {
	--	ui = {


@@ 91,11 86,7 @@ lspconfig['gopls'].setup {
lspconfig['zls'].setup {
	on_attach = on_attach,
	flags = lsp_flags,
	cmd = {lsp_server_dir..'/zls/package/zls'},
}

lsp_installer.setup {
	automatic_installation = true,
	cmd = {mason_dir..'/bin/zls'},
}

-- Make diagnostics a little bit less aggressive. Use \ee to see the error

M vim/.config/nvim/lua/plugins.lua => vim/.config/nvim/lua/plugins.lua +15 -2
@@ 5,6 5,13 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
	vim.cmd [[packadd packer.nvim]]
end

vim.cmd([[
	augroup packer_user_config
		autocmd!
		autocmd BufWritePost plugins.lua source <afile> | PackerCompile
	augroup end
]])

return require('packer').startup(function(use)
	use 'wbthomason/packer.nvim' -- Manage itself
	use 'stevearc/dressing.nvim' -- Improve the select UI


@@ 12,10 19,17 @@ return require('packer').startup(function(use)
	use 'benmills/vimux' -- Tmux integration

	-- Configure/install LSP servers
	use 'williamboman/mason.nvim'
	use {
		'williamboman/mason-lspconfig.nvim',
		after = 'mason.nvim'
	}
	use {
		'neovim/nvim-lspconfig',
		requires = 'williamboman/nvim-lsp-installer',
		after = 'mason-lspconfig.nvim',
		config = function()
			require('mason').setup()
			require('mason-lspconfig').setup()
			require('lsp')
		end,
	}


@@ 36,7 50,6 @@ return require('packer').startup(function(use)
	use {
		'vim-test/vim-test',
		config = function() 
			-- TODO: set the strategy
			vim.cmd [[let test#strategy = 'vimux']]
		end,
	}

A vim/.config/nvim/plugin/packer_compiled.lua => vim/.config/nvim/plugin/packer_compiled.lua +180 -0
@@ 0,0 1,180 @@
-- Automatically generated packer.nvim plugin loader code

if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
  vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
  return
end

vim.api.nvim_command('packadd packer.nvim')

local no_errors, error_msg = pcall(function()

_G._packer = _G._packer or {}
_G._packer.inside_compile = true

local time
local profile_info
local should_profile = false
if should_profile then
  local hrtime = vim.loop.hrtime
  profile_info = {}
  time = function(chunk, start)
    if start then
      profile_info[chunk] = hrtime()
    else
      profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
    end
  end
else
  time = function(chunk, start) end
end

local function save_profiles(threshold)
  local sorted_times = {}
  for chunk_name, time_taken in pairs(profile_info) do
    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
  end
  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
  local results = {}
  for i, elem in ipairs(sorted_times) do
    if not threshold or threshold and elem[2] > threshold then
      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
    end
  end
  if threshold then
    table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
  end

  _G._packer.profile_output = results
end

time([[Luarocks path setup]], true)
local package_path_str = "/home/damien/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/damien/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/damien/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/damien/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/damien/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
  package.path = package.path .. ';' .. package_path_str
end

if not string.find(package.cpath, install_cpath_pattern, 1, true) then
  package.cpath = package.cpath .. ';' .. install_cpath_pattern
end

time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
  local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
  if not success then
    vim.schedule(function()
      vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
    end)
  end
  return result
end

time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
  bufexplorer = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/bufexplorer",
    url = "https://github.com/jlanzarotta/bufexplorer"
  },
  catppuccin = {
    config = { "\27LJ\2\n:\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\27colorscheme catppuccin\bcmd\bvim\0" },
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/catppuccin",
    url = "https://github.com/catppuccin/nvim"
  },
  ["dressing.nvim"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/dressing.nvim",
    url = "https://github.com/stevearc/dressing.nvim"
  },
  ["mason-lspconfig.nvim"] = {
    after = { "nvim-lspconfig" },
    load_after = {},
    loaded = true,
    needs_bufread = false,
    path = "/home/damien/.local/share/nvim/site/pack/packer/opt/mason-lspconfig.nvim",
    url = "https://github.com/williamboman/mason-lspconfig.nvim"
  },
  ["mason.nvim"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/mason.nvim",
    url = "https://github.com/williamboman/mason.nvim"
  },
  ["nvim-lspconfig"] = {
    config = { "\27LJ\2\ng\0\0\3\0\5\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\3\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\4\0B\0\2\1K\0\1\0\blsp\20mason-lspconfig\nsetup\nmason\frequire\0" },
    load_after = {},
    loaded = true,
    needs_bufread = false,
    path = "/home/damien/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig",
    url = "https://github.com/neovim/nvim-lspconfig"
  },
  ["nvim-treesitter"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
    url = "https://github.com/nvim-treesitter/nvim-treesitter"
  },
  ["packer.nvim"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/packer.nvim",
    url = "https://github.com/wbthomason/packer.nvim"
  },
  ["plenary.nvim"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/plenary.nvim",
    url = "https://github.com/nvim-lua/plenary.nvim"
  },
  ["telescope.nvim"] = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/telescope.nvim",
    url = "https://github.com/nvim-telescope/telescope.nvim"
  },
  ["vim-test"] = {
    config = { "\27LJ\2\n?\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0 let test#strategy = 'vimux'\bcmd\bvim\0" },
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/vim-test",
    url = "https://github.com/vim-test/vim-test"
  },
  vimux = {
    loaded = true,
    path = "/home/damien/.local/share/nvim/site/pack/packer/start/vimux",
    url = "https://github.com/benmills/vimux"
  }
}

time([[Defining packer_plugins]], false)
-- Config for: vim-test
time([[Config for vim-test]], true)
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0 let test#strategy = 'vimux'\bcmd\bvim\0", "config", "vim-test")
time([[Config for vim-test]], false)
-- Config for: catppuccin
time([[Config for catppuccin]], true)
try_loadstring("\27LJ\2\n:\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\27colorscheme catppuccin\bcmd\bvim\0", "config", "catppuccin")
time([[Config for catppuccin]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd mason.nvim ]]
vim.cmd [[ packadd mason-lspconfig.nvim ]]
vim.cmd [[ packadd nvim-lspconfig ]]

-- Config for: nvim-lspconfig
try_loadstring("\27LJ\2\ng\0\0\3\0\5\0\0146\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\3\0B\0\2\0029\0\2\0B\0\1\0016\0\0\0'\2\4\0B\0\2\1K\0\1\0\blsp\20mason-lspconfig\nsetup\nmason\frequire\0", "config", "nvim-lspconfig")

time([[Sequenced loading]], false)

_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
  vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false

if should_profile then save_profiles() end

end)

if not no_errors then
  error_msg = error_msg:gsub('"', '\\"')
  vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end