nvim: upgrade blink-cmp. lsp config for web stuff.
This commit is contained in:
parent
7a4712c057
commit
37ddc91613
4 changed files with 106 additions and 56 deletions
|
@ -42,6 +42,7 @@
|
|||
shellcheck
|
||||
shfmt
|
||||
stylua
|
||||
superhtml
|
||||
vscode-langservers-extracted
|
||||
];
|
||||
|
||||
|
@ -59,7 +60,7 @@
|
|||
}
|
||||
|
||||
{
|
||||
plugin = blink-cmp;
|
||||
plugin = pkgs.blink-cmp;
|
||||
type = "lua";
|
||||
config = ''
|
||||
require'blink-cmp'.setup({
|
||||
|
@ -68,27 +69,31 @@
|
|||
["<PageDown>"] = { "scroll_documentation_down" },
|
||||
["<PageUp>"] = { "scroll_documentation_up" },
|
||||
},
|
||||
trigger = {
|
||||
completion = {
|
||||
show_in_snippet = true,
|
||||
},
|
||||
signature_help = {
|
||||
accept = {
|
||||
auto_brackets = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
windows = {
|
||||
autocomplete = {
|
||||
border = 'none',
|
||||
selection = 'preselect',
|
||||
},
|
||||
|
||||
documentation = {
|
||||
border = 'rounded',
|
||||
auto_show = false,
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 800,
|
||||
},
|
||||
signature_help = {
|
||||
window = {
|
||||
border = 'rounded',
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
|
||||
signature = {
|
||||
enabled = true,
|
||||
window = {
|
||||
border = 'rounded',
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
'';
|
||||
|
@ -100,8 +105,8 @@
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "saghen";
|
||||
repo = "blink.compat";
|
||||
rev = "cd2d3a040b76ad0eeab9a3bba48bc4c2b9d703bf"; # v1.0.2
|
||||
hash = "sha256-4uoehv/qe74IivgXc69ekYLod3Zo+oPUvXJHtt4wc2U=";
|
||||
rev = "78f3f7187ff4a1444e952548c556d936da8f72fc"; # v2.1.2
|
||||
hash = "sha256-aqHDwrzPOyOw9UbJlQX10/cVQwNHg4v6i9jSm+pNKZc=";
|
||||
};
|
||||
};
|
||||
type = "lua";
|
||||
|
|
|
@ -1,31 +1,13 @@
|
|||
local configs = require('lspconfig.configs')
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
local servers = {
|
||||
'gopls',
|
||||
'ts_ls',
|
||||
}
|
||||
cssls = {},
|
||||
gopls = {},
|
||||
html = {},
|
||||
jsonls = {},
|
||||
superhtml = {},
|
||||
ts_ls = {},
|
||||
|
||||
for _, ls in ipairs(servers) do
|
||||
lspconfig[ls].setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
lspconfig.nixd.setup({
|
||||
capabilities = capabilities,
|
||||
cmd = { "nixd" },
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = { expr = "import <nixpkgs> { }" },
|
||||
formatting = { command = { "nixfmt" } },
|
||||
options = {},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
|
@ -41,4 +23,21 @@ lspconfig.lua_ls.setup({
|
|||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
nixd = {
|
||||
cmd = { "nixd" },
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = { expr = "import <nixpkgs> { }" },
|
||||
formatting = { command = { "nixfmt" } },
|
||||
options = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for server, config in pairs(servers) do
|
||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
|
|
45
pkgs/blink-cmp/default.nix
Normal file
45
pkgs/blink-cmp/default.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
stdenv,
|
||||
vimUtils,
|
||||
}:
|
||||
let
|
||||
version = "0.7.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Saghen";
|
||||
repo = "blink.cmp";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-nxiODLKgGeXzN5sqkLWU0PcsuSSB1scSzTC5qyCxLCI=";
|
||||
};
|
||||
libExt = if stdenv.hostPlatform.isDarwin then "dylib" else "so";
|
||||
blink-fuzzy-lib = rustPlatform.buildRustPackage {
|
||||
inherit version src;
|
||||
pname = "blink-fuzzy-lib";
|
||||
env = {
|
||||
# TODO: remove this if plugin stops using nightly rust
|
||||
RUSTC_BOOTSTRAP = true;
|
||||
};
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-XXI2jEoD6XbFNk3O8B6+aLzl1ZcJq1VinQXb+AOw8Rw=";
|
||||
};
|
||||
in
|
||||
vimUtils.buildVimPlugin {
|
||||
pname = "blink-cmp";
|
||||
inherit version src;
|
||||
preInstall = ''
|
||||
mkdir -p target/release
|
||||
ln -s ${blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.${libExt} target/release/libblink_cmp_fuzzy.${libExt}
|
||||
'';
|
||||
meta = {
|
||||
description = "Performant, batteries-included completion plugin for Neovim";
|
||||
homepage = "https://github.com/saghen/blink.cmp";
|
||||
maintainers = with lib.maintainers; [
|
||||
balssh
|
||||
redxtech
|
||||
];
|
||||
};
|
||||
doInstallCheck = true;
|
||||
nvimRequireCheck = "blink-cmp";
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
pkgs: {
|
||||
blink-cmp = pkgs.callPackage ./blink-cmp { };
|
||||
gnome-ssh-askpass4 = pkgs.callPackage ./gnome-ssh-askpass4 { };
|
||||
jujutsu-openssh = pkgs.callPackage ./jujutsu-openssh { };
|
||||
lazyjj = pkgs.callPackage ./lazyjj { };
|
||||
|
|
Loading…
Reference in a new issue