nvim: Add lsp-format
This commit is contained in:
parent
cb2f901a41
commit
809e2418f8
5 changed files with 49 additions and 29 deletions
|
@ -1,7 +1,8 @@
|
||||||
(let [mod {}
|
(let [mod {}
|
||||||
cmd vim.cmd
|
cmd vim.cmd
|
||||||
api vim.api
|
api vim.api
|
||||||
keymap (require :nifoc.keymap)]
|
keymap (require :nifoc.keymap)
|
||||||
|
lsp-format (require :lsp-format)]
|
||||||
(fn mod.setup []
|
(fn mod.setup []
|
||||||
(vim.diagnostic.config {:underline true
|
(vim.diagnostic.config {:underline true
|
||||||
:virtual_text {:source false}
|
:virtual_text {:source false}
|
||||||
|
@ -21,9 +22,6 @@
|
||||||
(when (and client.resolved_capabilities.document_formatting
|
(when (and client.resolved_capabilities.document_formatting
|
||||||
(= vim.b.nifoc_fixer_enabled nil))
|
(= vim.b.nifoc_fixer_enabled nil))
|
||||||
(api.nvim_buf_set_var bufnr :nifoc_fixer_enabled 1)
|
(api.nvim_buf_set_var bufnr :nifoc_fixer_enabled 1)
|
||||||
(api.nvim_create_autocmd :BufWritePre
|
(lsp-format.on_attach client bufnr)))
|
||||||
{:callback #(vim.lsp.buf.formatting_sync nil
|
|
||||||
1000)
|
|
||||||
:buffer bufnr})))
|
|
||||||
|
|
||||||
mod)
|
mod)
|
||||||
|
|
18
flake.lock
18
flake.lock
|
@ -96,11 +96,11 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "contrib",
|
"dir": "contrib",
|
||||||
"lastModified": 1649120448,
|
"lastModified": 1649217859,
|
||||||
"narHash": "sha256-x9WDekkKfkclTlm1fHtc4x3RODJ/BK9tPhi/RwnATlU=",
|
"narHash": "sha256-oNgBLLwSif+vuM9Sw2CAuI1OYv4aXOSOGtvhgt0jPpM=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "e135adcb8c4f32332ba87ea6681f41330b909e1c",
|
"rev": "233014f92b5d4d5bf8a6f019241aafd1b05dd383",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -119,11 +119,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649146867,
|
"lastModified": 1649233190,
|
||||||
"narHash": "sha256-S5SLLg5u0MTeogTmnB0QcXu10lkkl/erZ9oFGQwLFq8=",
|
"narHash": "sha256-ix8vwMZb8ulPU2DyTWlgH9mmvarXUH/yTWoJ25NbPzo=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "36e2791d468498789529c5bbd3d74948ed82f5c8",
|
"rev": "ee895464be12a3e733b3de850c2e00ccb52fd38f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -186,11 +186,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649118972,
|
"lastModified": 1649205586,
|
||||||
"narHash": "sha256-VCtGkNvjYd5uwy/tTprZGHSzWo8ZA9UcxHl28ImM2tM=",
|
"narHash": "sha256-OsKblro6/j+Yasg0qNzduYXOQWgPWKqRjHVdSFH2p1M=",
|
||||||
"owner": "arqv",
|
"owner": "arqv",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "a7281505148bd2879e69f319145601c70dadc546",
|
"rev": "054b19a87d5345f1bd367c643ef8a243a2a5b738",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -133,6 +133,15 @@ in
|
||||||
|
|
||||||
virtual-types-nvim
|
virtual-types-nvim
|
||||||
|
|
||||||
|
{
|
||||||
|
plugin = lsp-format-nvim;
|
||||||
|
config = ''
|
||||||
|
(let [lsp-format (require :lsp-format)]
|
||||||
|
(lsp-format.setup))
|
||||||
|
'';
|
||||||
|
type = "fennel";
|
||||||
|
}
|
||||||
|
|
||||||
# cmp
|
# cmp
|
||||||
{
|
{
|
||||||
plugin = nvim-cmp;
|
plugin = nvim-cmp;
|
||||||
|
|
|
@ -111,12 +111,12 @@
|
||||||
};
|
};
|
||||||
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "nvim-treesitter";
|
pname = "nvim-treesitter";
|
||||||
version = "1649143663";
|
version = "1649228392";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "nvim-treesitter";
|
owner = "nvim-treesitter";
|
||||||
repo = "nvim-treesitter";
|
repo = "nvim-treesitter";
|
||||||
rev = "f083b7bbfe9480df00a45ab5a0978cb2586dddf2";
|
rev = "99625b59b50f820adec52516b34bc6426f5ab614";
|
||||||
sha256 = "SNGb25nlcR/zWnAv8Q+vLBMzaJpVPPdJ8txCkf+aD34=";
|
sha256 = "8nDtP4x2aVdzW2jNiN9z2/ZI56+NA2l6IhdGmOnl+dA=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter";
|
meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter";
|
||||||
|
@ -190,24 +190,24 @@
|
||||||
};
|
};
|
||||||
nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "nvim-lspconfig";
|
pname = "nvim-lspconfig";
|
||||||
version = "1648480371";
|
version = "1649188800";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "neovim";
|
owner = "neovim";
|
||||||
repo = "nvim-lspconfig";
|
repo = "nvim-lspconfig";
|
||||||
rev = "3d1baa811b351078e5711be1a1158e33b074be9e";
|
rev = "f183d35725264d6184146eebcef1ba8338ddbc83";
|
||||||
sha256 = "If8vjLISzCC6qo7iorhgrX5fC6Q/p+a8qvUbrvaA4BA=";
|
sha256 = "nWjg/aw4UvTjeVtXRyBCVnN74ZRhYh//UM5qlmM9rhw=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/neovim/nvim-lspconfig";
|
meta.homepage = "https://github.com/neovim/nvim-lspconfig";
|
||||||
};
|
};
|
||||||
null-ls-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
null-ls-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "null-ls.nvim";
|
pname = "null-ls.nvim";
|
||||||
version = "1649122832";
|
version = "1649223024";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "jose-elias-alvarez";
|
owner = "jose-elias-alvarez";
|
||||||
repo = "null-ls.nvim";
|
repo = "null-ls.nvim";
|
||||||
rev = "f3107c3b211d62f53d34cbf0ca100fc948bc42d4";
|
rev = "8a401e19c0c2b2569e820b3cc0a3398100d7d6fb";
|
||||||
sha256 = "QpQqE7RrxhWpcY2HTyyoD9BkbQObS/nwV8khkSErpR8=";
|
sha256 = "zQmuIi1Yu3cXLFL5Zvl1Km7Do1aT21RbXieGIOEI3Sw=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/jose-elias-alvarez/null-ls.nvim";
|
meta.homepage = "https://github.com/jose-elias-alvarez/null-ls.nvim";
|
||||||
|
@ -224,14 +224,26 @@
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/jubnzv/virtual-types.nvim";
|
meta.homepage = "https://github.com/jubnzv/virtual-types.nvim";
|
||||||
};
|
};
|
||||||
|
lsp-format-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
|
pname = "lsp-format.nvim";
|
||||||
|
version = "1646880894";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "lukas-reineke";
|
||||||
|
repo = "lsp-format.nvim";
|
||||||
|
rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff";
|
||||||
|
sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4=";
|
||||||
|
fetchSubmodules = true;
|
||||||
|
};
|
||||||
|
meta.homepage = "https://github.com/lukas-reineke/lsp-format.nvim";
|
||||||
|
};
|
||||||
nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "nvim-cmp";
|
pname = "nvim-cmp";
|
||||||
version = "1648830769";
|
version = "1649208788";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "hrsh7th";
|
owner = "hrsh7th";
|
||||||
repo = "nvim-cmp";
|
repo = "nvim-cmp";
|
||||||
rev = "7dbe34e36d9de4912a5f3aa5279540445765814c";
|
rev = "27970d8a1c99cd6ddea2709beda52d8e9336228b";
|
||||||
sha256 = "7qsLuko9Jeipqv30y2brTFjzFnZSXaMSHShgY08Nv2w=";
|
sha256 = "Yvw5GXNrxFl8YNILNyAirqbTWxxEjgVbkeU7L5WodbY=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/hrsh7th/nvim-cmp";
|
meta.homepage = "https://github.com/hrsh7th/nvim-cmp";
|
||||||
|
@ -490,12 +502,12 @@
|
||||||
};
|
};
|
||||||
nvim-notify = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
nvim-notify = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
pname = "nvim-notify";
|
pname = "nvim-notify";
|
||||||
version = "1647766037";
|
version = "1649231629";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "rcarriga";
|
owner = "rcarriga";
|
||||||
repo = "nvim-notify";
|
repo = "nvim-notify";
|
||||||
rev = "da1030208347ad8937fdad1d4f8092b578e3ea2f";
|
rev = "5cfbdb27af2bb9b3e27bd5c9176e78f34be87682";
|
||||||
sha256 = "Csbe54tl808Fa8SRdJzzYIgEoYqKtuqPc8yCE0xl2Vc=";
|
sha256 = "VAW0w0pLwvvHHopiGhhIlMSstKhZqnrzvUzQFcDIK5A=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
meta.homepage = "https://github.com/rcarriga/nvim-notify";
|
meta.homepage = "https://github.com/rcarriga/nvim-notify";
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
- src: neovim/nvim-lspconfig
|
- src: neovim/nvim-lspconfig
|
||||||
- src: jose-elias-alvarez/null-ls.nvim
|
- src: jose-elias-alvarez/null-ls.nvim
|
||||||
- src: jubnzv/virtual-types.nvim
|
- src: jubnzv/virtual-types.nvim
|
||||||
|
- src: lukas-reineke/lsp-format.nvim
|
||||||
|
|
||||||
# cmp
|
# cmp
|
||||||
- src: hrsh7th/nvim-cmp
|
- src: hrsh7th/nvim-cmp
|
||||||
|
|
Loading…
Reference in a new issue