nvim: redo LSP setup to be simpler
now uses more of the built-in LSP functionality built into neovim. - LSP configurations from the official repo - downloads LSPs from nix using lazy-lsp - autocomplete using blink.cmp - show status using fidget.nvim
This commit is contained in:
parent
4b7bf6b3b5
commit
6a644b4318
3 changed files with 67 additions and 123 deletions
|
|
@ -1,28 +1,23 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "faf3c94a44508cec1b961406d36cc65113ff3b98" },
|
||||
"bullets.vim": { "branch": "master", "commit": "8f3259e807c40b91d247f612823295ab99777a65" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"fzf-lua": { "branch": "main", "commit": "8adf950093af5361621cf52208d64995b1af78b5" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" },
|
||||
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
|
||||
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
|
||||
"lazy-lsp.nvim": { "branch": "master", "commit": "701893d2d60c7eff894324748073f682065999a2" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
||||
"mini.pick": { "branch": "main", "commit": "f02e64580a547346128799ba667dfc0e29737532" },
|
||||
"neogit": { "branch": "master", "commit": "7cec58c9272d61da5d77fe5869e3956b8a91f1eb" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f610208989e9c03561f9f601db3133f6ae398fcd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "db3ccffe79480543d8e0f7b0cac0d9b220f9486e" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
|
||||
"lazy-lsp.nvim": { "branch": "master", "commit": "5ea87155f84629b0bd90853a0d035422d7acd3a5" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" },
|
||||
"mini.pick": { "branch": "main", "commit": "96ee37d07043aeed90ae6ae32733b2d0db8f1c13" },
|
||||
"neogit": { "branch": "master", "commit": "0f48491ae0046796841aaa97d439267982fe72db" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||
"oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "d53856423be5ef3c267d26ee261b0981b372f718" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "d14614cbfc63b6037bfccd48bb982d2ad2003352" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
|
||||
}
|
||||
|
|
|
|||
29
stow/.config/nvim/lua/nico/lazy/blink.lua
Normal file
29
stow/.config/nvim/lua/nico/lazy/blink.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = '1.*',
|
||||
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||
-- build = 'cargo build --release',
|
||||
-- If you use nix, you can build from source using latest nightly rust with:
|
||||
-- build = 'nix run .#build-plugin',
|
||||
|
||||
opts = {
|
||||
keymap = { preset = 'default' },
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
completion = { documentation = { auto_show = false } },
|
||||
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
},
|
||||
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
},
|
||||
opts_extend = { "sources.default" }
|
||||
}
|
||||
|
|
@ -1,102 +1,22 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
"dundalek/lazy-lsp.nvim",
|
||||
},
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"j-hui/fidget.nvim", -- lsp status
|
||||
"dundalek/lazy-lsp.nvim", -- load LSPs from nix
|
||||
},
|
||||
config = function()
|
||||
require("fidget").setup {}
|
||||
require("lazy-lsp").setup {}
|
||||
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities())
|
||||
|
||||
require("fidget").setup({})
|
||||
|
||||
require("lazy-lsp").setup {
|
||||
-- By default all available servers are set up. Exclude unwanted or misbehaving servers.
|
||||
excluded_servers = {
|
||||
"ccls", "zk", "bufls", "ruff_lsp"
|
||||
},
|
||||
-- Alternatively specify preferred servers for a filetype (others will be ignored).
|
||||
preferred_servers = {
|
||||
markdown = {},
|
||||
python = { "pyright" },
|
||||
nix = { "nil_ls" },
|
||||
rust = { "rust_analyzer" },
|
||||
go = { "gopls" },
|
||||
c = { "clangd" },
|
||||
},
|
||||
prefer_local = true, -- Prefer locally installed servers over nix-shell
|
||||
-- Default config passed to all servers to specify on_attach callback and other options.
|
||||
default_config = {
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities,
|
||||
},
|
||||
-- Override config for specific servers that will passed down to lspconfig setup.
|
||||
-- Note that the default_config will be merged with this specific configuration so you don't need to specify everything twice.
|
||||
configs = {
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<A-Enter>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
['<C-x>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-z>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
end
|
||||
vim.lsp.enable({
|
||||
'gopls', -- go
|
||||
'pyright', -- python
|
||||
'lua_ls', -- lua
|
||||
'rust-analyzer', -- rust
|
||||
'nil_ls', -- nix
|
||||
'bashls', -- bash
|
||||
'html', -- html
|
||||
'cssls', -- css
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue