Merge branch 'main' into feature/custom-keybinds

This commit is contained in:
Michał 2023-05-03 00:18:25 +02:00 committed by GitHub
commit 933fa2a8ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 190 additions and 130 deletions

View file

@ -8,3 +8,4 @@ This section lists the release notes for tagged version of neovim-flake and curr
include::rl-0.1.adoc[]
include::rl-0.2.adoc[]
include::rl-0.3.adoc[]

View file

@ -1,3 +1,35 @@
[[sec-release-0.3]]
== Release 0.3
Release 0.3 had to come out beore I wanted it to due to Neovim 0.9 dropping into nixpkgs-unstable. The treesitter changes
have prompted a treesitter rework, which was followed by reworking the languages system. Most of the changes to those are downstreamed
from the original repository. The feature requests that was originally planned for 0.3 have been moved to 0.4, which
should come out soon.
[[sec-release-0.3-changelog]]
=== Changelog
* We have transitioned to flake-parts, from flake-utils to extend the flexibility of this flake. This means the flake structure
is different than usual, but the functionality remains the same.
* We now provide a home-manager module. Do note that it is still far from perfect, but it works.
* `nodejs_16` is now bundled with `Copilot.lua` if the user has enabled Copilot assistant.
* which-key section titles have been fixed. This is to be changed once again in a possible keybind rewrite, but now it should
display the correct titles instad of `+prefix`
* Most of `presence.nvim`'s options have been made fully configurable through your configuration file.
* Most of the modules have been refactored to separate `config` and `options` attributes.
* Darwin has been deprecated as the zig package is marked as broken. We will attempt to use the zig overlay to return Darwin
support.
* `Fidget.nvim` has been added as a neat visual addition for LSP installations.
* `diffview.nvim` has been added to provide a convenient diff utility.
* Treesitter grammars are now configurable with <<opt-vim.treesitter.grammars>>. Utilizes the nixpkgs `nvim-treesitter` plugin rather than a custom input in order to take advantage of build support of pinned versions. See https://discourse.nixos.org/t/psa-if-you-are-on-unstable-try-out-nvim-treesitter-withallgrammars/23321?u=snowytrees[discourse] for more information. Packages can be found under the `pkgs.vimPlugins.nvim-treesitter.builtGrammars` attribute. Treesitter grammars for supported languages should be enabled within the module. By default no grammars are installed, thus the following grammars which do not have a language section are not included anymore: comment, toml, make, html, css, graphql, json.
* A new section has been added for language support: `vim.languages.<language>`. The options <<opt-vim.languages.enableLSP>>, <<opt-vim.languages.enableTreesitter>>, etc. will enable the respective section for all languages that have been enabled.
@ -9,9 +41,35 @@
* Removed the plugins document in the docs. Was too unwieldy to keep updated.
* `vim.visual.lspkind` has been moved to <<opt-vim.lsp.lspkind.enable>>
* Improved handling of completion formatting. When setting <<opt-vim.autocomplete.sources>>, can also include optional menu mapping. And can provide your own function with <<opt-vim.autocomplete.formatting.format>>.
* For <<opt-vim.visuals.indentBlankline.fillChar>> and <<opt-vim.visuals.indentBlankline.eolChar>> turning them off should use `null` rather than `""` now.
* Transparency has been made optional and has been disabled by default. <<opt-vim.theme.transparent>> option can be used to enable or
disable transparency for your configuration.
* Fixed deprecated configuration method for Tokyonight, and added new style "moon"
* Dart language support as well as extended flutter support has been added. Thanks to @FlafyDev for his contributions towards Dart
language support.
* Elixir language support has been added through `elixir-tools.nvim`.
* `hop.nvim` and `leap.nvim` have been added for fast navigation.
* `modes.nvim` has been added to the UI plugins as a minor error highlighter.
* `smartcollumn.nvim` has been added to dynamically display a colorcolumn when the limit has been exceeded, providing
per-buftype column position and more.
* `project.nvim` has been added for better project management inside Neovim.
* More configuration options have been added to `nvim-session-manager`.
* Editorconfig support has been added to the core functionality, with an enable option.
* `venn-nvim` has been dropped due to broken keybinds.

View file

@ -0,0 +1,15 @@
[[sec-release-0.4]]
== Release 0.4
Release notes for release 0.4
[[sec-release-0.4-changelog]]
=== Changelog
ttps://github.com/horriblename[horriblename]:
* Added `clangd` as alternative lsp for C/++.
* Added `toggleterm` integration for `lazygit`.

View file

@ -91,6 +91,7 @@ inputs: let
enable = true;
name = "catppuccin";
style = "mocha";
transparent = false;
};
vim.autopairs.enable = true;
@ -127,7 +128,7 @@ inputs: let
vim.git = {
enable = true;
gitsigns.enable = true;
gitsigns.codeActions = true;
gitsigns.codeActions = false; # throws an annoying debug message
};
vim.minimap = {
@ -151,7 +152,6 @@ inputs: let
vim.utility = {
colorizer.enable = true;
icon-picker.enable = true;
venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually
diffview-nvim.enable = true;
motion = {
hop.enable = true;
@ -167,7 +167,10 @@ inputs: let
};
vim.terminal = {
toggleterm.enable = true;
toggleterm = {
enable = true;
lazygit.enable = true;
};
};
vim.ui = {

View file

@ -1355,7 +1355,6 @@
"toggleterm-nvim": "toggleterm-nvim",
"tokyonight": "tokyonight",
"trouble": "trouble",
"venn-nvim": "venn-nvim",
"vim-markdown": "vim-markdown",
"vim-repeat": "vim-repeat",
"vim-startify": "vim-startify",
@ -1652,22 +1651,6 @@
"type": "github"
}
},
"venn-nvim": {
"flake": false,
"locked": {
"lastModified": 1669127905,
"narHash": "sha256-Ks5qUaI0MrhVC2AhVsReVwC/2WArXqIQ36CcCSCyzAk=",
"owner": "jbyuki",
"repo": "venn.nvim",
"rev": "c114563960b8fb1197695d42798d1f3e7190b798",
"type": "github"
},
"original": {
"owner": "jbyuki",
"repo": "venn.nvim",
"type": "github"
}
},
"vim-markdown": {
"flake": false,
"locked": {

View file

@ -383,11 +383,6 @@
flake = false;
};
venn-nvim = {
url = "github:jbyuki/venn.nvim";
flake = false;
};
icon-picker-nvim = {
url = "github:ziontee113/icon-picker.nvim";
flake = false;

View file

@ -51,7 +51,6 @@ with lib; let
"cinnamon-nvim"
"cheatsheet-nvim"
"colorizer"
"venn-nvim"
"cellular-automaton"
"presence-nvim"
"icon-picker-nvim"

View file

@ -133,8 +133,8 @@ in {
set termguicolors
set t_Co=256
''}
${optionalString cfg.enableEditorconfig ''
vim.g.editorconfig = false
${optionalString (!cfg.enableEditorconfig) ''
let g:editorconfig = v:false
''}
'';
};

View file

@ -141,7 +141,7 @@ with builtins; {
};
enableEditorconfig = mkOption {
type = types.bool;
default = false;
default = true;
description = "Follow editorconfig rules in current directory";
};
};

View file

@ -16,8 +16,19 @@ with builtins; let
lspconfig.ccls.setup{
capabilities = capabilities;
on_attach=default_on_attach;
cmd = {"${pkgs.ccls}/bin/ccls"};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.cclsOpts}"}
cmd = {"${cfg.lsp.package}/bin/ccls"};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
}
'';
};
clangd = {
package = pkgs.clang-tools;
lspConfig = ''
lspconfig.clangd.setup{
capabilities = capabilities;
on_attach=default_on_attach;
cmd = {"${cfg.lsp.package}/bin/clangd"};
${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"}
}
'';
};

View file

@ -64,7 +64,11 @@ in {
type = with types; enum (attrNames servers);
default = defaultServer;
};
package = nvim.types.mkGrammarOption pkgs "python";
package = mkOption {
description = "python LSP server package";
type = types.package;
default = servers.${cfg.lsp.server}.package;
};
};
format = {

View file

@ -55,7 +55,7 @@ with builtins; let
};
in {
options.vim.languages.ts = {
enable = mkEnableOption "SQL language support";
enable = mkEnableOption "Typescript/Javascript language support";
treesitter = {
enable = mkOption {

View file

@ -28,7 +28,7 @@ in {
package = mkOption {
description = "ZLS package";
type = types.package;
default = pkgs.nodePackages.pyright;
default = pkgs.zls;
};
zigPackage = mkOption {
description = "Zig package used by ZLS";
@ -37,7 +37,6 @@ in {
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;

View file

@ -21,6 +21,7 @@ in {
'';
vim.luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] ''
require('null-ls').setup({
debug = false,
diagnostics_format = "[#{m}] #{s} (#{c})",
debounce = 250,
default_timeout = 5000,

View file

@ -6,33 +6,64 @@
with lib;
with builtins; let
cfg = config.vim.terminal.toggleterm;
toggleKey = "<c-t>";
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"toggleterm-nvim"
];
config = mkMerge [
(
mkIf cfg.enable {
vim.startPlugins = [
"toggleterm-nvim"
];
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
require("toggleterm").setup({
open_mapping = null,
direction = '${toString cfg.direction}',
-- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
winbar = {
enabled = '${toString cfg.enable_winbar}',
name_formatter = function(term) -- term: Terminal
return term.name
end
},
})
'';
vim.maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
vim.maps.normal = mkBinding cfg.mappings.open "<Cmd>execute v:count . \"ToggleTerm\"<CR>" "Toggle terminal";
};
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
require("toggleterm").setup({
open_mapping = null,
direction = '${toString cfg.direction}',
-- TODO: this should probably be turned into a module that uses the lua function if and only if the user has not set it
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
winbar = {
enabled = '${toString cfg.enable_winbar}',
name_formatter = function(term) -- term: Terminal
return term.name
end
},
})
'';
}
)
(
mkIf (cfg.enable && cfg.lazygit.enable)
{
vim.startPlugins = lib.optionals (cfg.lazygit.package != null) [
cfg.lazygit.package
];
vim.luaConfigRC.toggleterm-lazygit = nvim.dag.entryAfter ["toggleterm"] ''
local terminal = require 'toggleterm.terminal'
local lazygit = terminal.Terminal:new({
cmd = '${
if (cfg.lazygit.package != null)
then getExe cfg.lazygit.package
else "lazygit"
}',
direction = '${cfg.lazygit.direction}',
hidden = true,
on_open = function(term)
vim.cmd("startinsert!")
vim.keymap.set( 't', [[${toggleKey}]], function() term:toggle() end, {silent = true, noremap = true, buffer = term.bufnr})
end
})
vim.keymap.set( 'n', [[<leader>gg]], function() lazygit:toggle() end, {silent = true, noremap = true})
'';
}
)
];
}

View file

@ -1,4 +1,5 @@
{
pkgs,
config,
lib,
...
@ -24,5 +25,18 @@ with builtins; {
default = false;
description = "Enable winbar";
};
lazygit = {
enable = mkEnableOption "Enable LazyGit integration";
direction = mkOption {
type = types.enum ["horizontal" "vertical" "tab" "float"];
default = "float";
description = "Direction of the lazygit window";
};
package = mkOption {
type = with types; nullOr package;
default = pkgs.lazygit;
description = "The package that should be used for lazygit. Setting it to null will attempt to use lazygit from your PATH";
};
};
};
}

View file

@ -1,6 +1,9 @@
{lib}: {
onedark = {
setup = {style ? "dark"}: ''
setup = {
style ? "dark",
transparent,
}: ''
-- OneDark theme
require('onedark').setup {
style = "${style}"
@ -11,12 +14,13 @@
};
tokyonight = {
setup = {style ? "night"}: ''
-- need to set style before colorscheme to apply
vim.g.tokyonight_style = '${style}'
vim.cmd[[colorscheme tokyonight]]
setup = {
style ? "night",
transparent,
}: ''
vim.cmd[[colorscheme tokyonight-${style}]]
'';
styles = ["day" "night" "storm"];
styles = ["day" "night" "storm" "moon"];
};
dracula = {
@ -34,7 +38,7 @@
-- Catppuccin theme
require('catppuccin').setup {
flavour = "${style}",
transparent_background = "${builtins.toString transparent}",
transparent_background = ${lib.boolToString transparent},
integrations = {
nvimtree = {
enabled = true,

View file

@ -40,6 +40,8 @@ in {
config = mkIf cfg.enable {
vim.startPlugins = [cfg.name];
vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig;
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup {style = cfg.style;};
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; {
inherit style transparent;
});
};
}

View file

@ -7,7 +7,6 @@ _: {
./colorizer
./icon-picker
./telescope
./venn
./diffview
];
}

View file

@ -1,42 +0,0 @@
{
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.venn-nvim;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = [
"venn-nvim"
];
# TODO: https://github.com/jbyuki/venn.nvim#using-toggle-command
# add keybindings for drawing diagrams
vim.luaConfigRC.venn-nvim = nvim.dag.entryAnywhere ''
local venn = require('venn')
-- venn.nvim: enable or disable keymappings
function _G.Toggle_venn()
local venn_enabled = vim.inspect(vim.b.venn_enabled)
if venn_enabled == "nil" then
vim.b.venn_enabled = true
vim.cmd[[setlocal ve=all]]
-- draw a line on HJKL keystokes
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
-- draw a box by pressing "f" with visual selection
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
else
vim.cmd[[setlocal ve=]]
vim.cmd[[mapclear <buffer>]]
vim.b.venn_enabled = nil
end
end
-- toggle keymappings for venn using <leader>v
vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
'';
};
}

View file

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

View file

@ -1,11 +0,0 @@
{
config,
lib,
...
}:
with lib;
with builtins; {
options.vim.utility.venn-nvim = {
enable = mkEnableOption "Enable venn.nvim: draw ASCII diagrams in Neovim";
};
}