Merge branch 'main' into feature/neovim0.9

This commit is contained in:
NotAShelf 2023-04-18 02:50:50 +03:00 committed by GitHub
commit 81421e529b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 202 additions and 9 deletions

10
.github/README.md vendored
View file

@ -123,22 +123,26 @@ instead of the `maximal` output. This will reduce size by a lot, but you will lo
**A**: Yes. As a matter of fact, I am actively working on making this flake smaller. Unfortunately the process of providing everything possible by itself makes the flake large. Best I can do is to optimize the flake as much as possible by selecting plugins that are small and fast. And the binary cache, so at least you don't have to build it from source.
<br/><br/>
**Q**: Will you use a plugin manager?
**Q**: Will you use a plugin manager/language server installer?
<br/>
**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. We load plugins with raw lua.
**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations.
<br/><br/>
**Q**: Can you add *X*?
<br/>
**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to add every plugin that is in existence, but I will consider it, should it offer something useful to the flake.
**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to add *every plugin that is in existence*, but I will consider it, should it offer something useful to the flake.
## Credits
### Contributors
Special thanks to
- [@fufexan](https://github.com/fufexan) - For the transition to flake-parts
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
and everyone who has submitted issues or pull requests!
### Inspiration
This configuration borrows from and is based on a few other configurations, including:

View file

@ -1,4 +1,4 @@
name: build-and-cache
name: "Set up binary cache"
on:
workflow_dispatch:
@ -11,7 +11,7 @@ on:
- .gitignore
jobs:
nix:
cahix:
runs-on: ubuntu-latest
strategy:
matrix:
@ -44,5 +44,5 @@ jobs:
run: git config --global init.defaultBranch main
- name: Validate Flakes
run: nix flake check
- name: Build Hneovim-flake with default settings
- name: Build neovim-flake with default settings
run: nix build .#${{ matrix.package }} --print-build-logs

44
.github/workflows/check-docs.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: "Validate flake & check documentation"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
paths:
- docs/**
jobs:
flake-docs-check:
name: Validate Flake Documentation
runs-on: ubuntu-latest
strategy:
matrix:
package:
- docs
- docs-html
- docs-manpages
- docs-json
steps:
- uses: easimon/maximize-build-space@v6
with:
overprovision-lvm: true
remove-android: true
remove-dotnet: true
remove-haskell: true
- uses: cachix/install-nix-action@v20
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
auto-optimise-store = true
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- uses: actions/checkout@v3
- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main
- name: Validate Flakes
run: nix flake check
- name: Build neovim-flake with default settings
run: nix build .#${{ matrix.package }} --print-build-logs

View file

@ -1,4 +1,4 @@
name: Github Pages docs
name: "Build and deploy documentation"
on:
workflow_dispatch:
push:

View file

@ -21,6 +21,8 @@ Tidal is an alternative config that adds vim-tidal on top of the plugins from th
Maximal is the ultimate configuration that will enable basically everything. Keep in mind, however, that this will pull a lot of dependencies.
You are strongly recommended to use the binary cache if you would like to try the Maximal configuration.
=== Using Prebuilt Configs

View file

@ -337,6 +337,38 @@
"type": "github"
}
},
"elixir-ls": {
"flake": false,
"locked": {
"lastModified": 1681462421,
"narHash": "sha256-pIwZFiCLJ0f7OXi1iTza04KSn7rpFpvUsNYrFh0FoEM=",
"owner": "elixir-lsp",
"repo": "elixir-ls",
"rev": "85cfc5604edeadb0a6a683c41abff60a0c959de7",
"type": "github"
},
"original": {
"owner": "elixir-lsp",
"repo": "elixir-ls",
"type": "github"
}
},
"elixir-tools": {
"flake": false,
"locked": {
"lastModified": 1681453321,
"narHash": "sha256-7QgWrdq4p5t8WVnFhL5P948JFPR0i2C06kisxl30D2U=",
"owner": "elixir-tools",
"repo": "elixir-tools.nvim",
"rev": "8ccb696c048eca667486ee005f4386c0db8c5e14",
"type": "github"
},
"original": {
"owner": "elixir-tools",
"repo": "elixir-tools.nvim",
"type": "github"
}
},
"fidget-nvim": {
"flake": false,
"locked": {
@ -1262,6 +1294,8 @@
"diffview-nvim": "diffview-nvim",
"dracula": "dracula",
"dressing-nvim": "dressing-nvim",
"elixir-ls": "elixir-ls",
"elixir-tools": "elixir-tools",
"fidget-nvim": "fidget-nvim",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",

View file

@ -74,22 +74,27 @@
url = "github:neovim/nvim-lspconfig";
flake = false;
};
lspsaga = {
url = "github:tami5/lspsaga.nvim";
flake = false;
};
lspkind = {
url = "github:onsails/lspkind-nvim";
flake = false;
};
trouble = {
url = "github:folke/trouble.nvim";
flake = false;
};
nvim-treesitter-context = {
url = "github:nvim-treesitter/nvim-treesitter-context";
flake = false;
};
nvim-lightbulb = {
url = "github:kosayoda/nvim-lightbulb";
flake = false;
@ -99,18 +104,22 @@
url = "github:weilbith/nvim-code-action-menu";
flake = false;
};
lsp-signature = {
url = "github:ray-x/lsp_signature.nvim";
flake = false;
};
null-ls = {
url = "github:jose-elias-alvarez/null-ls.nvim";
flake = false;
};
sqls-nvim = {
url = "github:nanotee/sqls.nvim";
flake = false;
};
rust-tools = {
url = "github:simrat39/rust-tools.nvim";
flake = false;
@ -121,6 +130,16 @@
flake = false;
};
elixir-ls = {
url = "github:elixir-lsp/elixir-ls";
flake = false;
};
elixir-tools = {
url = "github:elixir-tools/elixir-tools.nvim";
flake = false;
};
# Copying/Registers
registers = {
url = "github:tversteeg/registers.nvim";

View file

@ -80,6 +80,8 @@ with lib; let
"vim-repeat"
"smartcolumn"
"project-nvim"
"elixir-ls"
"elixir-tools"
];
# You can either use the name of the plugin or a package.
pluginsType = with types;

View file

@ -24,6 +24,7 @@ with builtins; {
type = types.bool;
default = true;
description = nvim.nmd.asciiDoc ''map <CR> on insert mode'';
};
map_complete = mkOption {

View file

@ -45,6 +45,7 @@ in {
if client.supports_method("textDocument/formatting") then
local params = require'vim.lsp.util'.make_formatting_params({})
client.request('textDocument/formatting', params, nil, bufnr)
end
end
end
@ -60,4 +61,5 @@ in {
${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"}
'';
};
}

View file

@ -16,7 +16,8 @@ _: {
./lightbulb
./lspkind
# flutter-tools
./flutter-tools-nvim
# language specific modules
./flutter-tools-nvim # dart & flutter
./elixir # elixir
];
}

View file

@ -0,0 +1,67 @@
{
config,
lib,
pkgs,
...
}:
with lib;
with builtins; let
cfg = config.vim.lsp.elixir;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = [
"elixir-tools"
"plenary-nvim"
];
vim.luaConfigRC.elixir-tools = nvim.dag.entryAnywhere ''
local elixir = require("elixir")
local elixirls = require("elixir.elixirls")
elixir.setup {
elixirls = {
-- alternatively, point to an existing elixir-ls installation (optional)
-- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}`
cmd = "${lib.getExe pkgs.elixir-ls}",
-- default settings, use the `settings` function to override settings
settings = elixirls.settings {
dialyzerEnabled = true,
fetchDeps = false,
enableTestLenses = false,
suggestSpecs = false,
},
on_attach = function(client, bufnr)
local map_opts = { buffer = true, noremap = true}
-- run the codelens under the cursor
vim.keymap.set("n", "<space>r", vim.lsp.codelens.run, map_opts)
-- remove the pipe operator
vim.keymap.set("n", "<space>fp", ":ElixirFromPipe<cr>", map_opts)
-- add the pipe operator
vim.keymap.set("n", "<space>tp", ":ElixirToPipe<cr>", map_opts)
vim.keymap.set("v", "<space>em", ":ElixirExpandMacro<cr>", map_opts)
-- bindings for standard LSP functions.
vim.keymap.set("n", "<space>df", "<cmd>lua vim.lsp.buf.format()<cr>", map_opts)
vim.keymap.set("n", "<space>gd", "<cmd>lua vim.diagnostic.open_float()<cr>", map_opts)
vim.keymap.set("n", "<space>dt", "<cmd>lua vim.lsp.buf.definition()<cr>", map_opts)
vim.keymap.set("n", "<space>K", "<cmd>lua vim.lsp.buf.hover()<cr>", map_opts)
vim.keymap.set("n", "<space>gD","<cmd>lua vim.lsp.buf.implementation()<cr>", map_opts)
vim.keymap.set("n", "<space>1gD","<cmd>lua vim.lsp.buf.type_definition()<cr>", map_opts)
-- keybinds for fzf-lsp.nvim: https://github.com/gfanto/fzf-lsp.nvim
-- you could also use telescope.nvim: https://github.com/nvim-telescope/telescope.nvim
-- there are also core vim.lsp functions that put the same data in the loclist
vim.keymap.set("n", "<space>gr", ":References<cr>", map_opts)
vim.keymap.set("n", "<space>g0", ":DocumentSymbols<cr>", map_opts)
vim.keymap.set("n", "<space>gW", ":WorkspaceSymbols<cr>", map_opts)
vim.keymap.set("n", "<leader>d", ":Diagnostics<cr>", map_opts)
end
}
}
'';
};
}

View file

@ -0,0 +1,6 @@
_: {
imports = [
./config.nix
./elixir-tools.nix
];
}

View file

@ -0,0 +1,10 @@
{
config,
lib,
...
}:
with lib;
with builtins; {
options.vim.lsp.elixir = {
};
}

View file

@ -22,6 +22,7 @@ in {
description = nvim.nmd.asciiDoc ''
List of treesitter grammars to install. For supported languages
use the `vim.language.<lang>.treesitter` option
'';
};
};