Skip to content

Commit

Permalink
Merge branch 'main' into undofile-opts
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf authored Sep 17, 2024
2 parents 95728e4 + cb7ff87 commit 4e01a93
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 111 deletions.
2 changes: 1 addition & 1 deletion docs/manual/configuring/custom-plugins.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Custom Plugins {#ch-custom-plugins}

**nvf**, by default, exposes a wide variety of plugins as module options
for your convience and bundles necessary dependencies into **nvf**'s runtime.
for your convenience and bundles necessary dependencies into **nvf**'s runtime.
In case a plugin is not available in **nvf**, you may consider making a pull
request to **nvf** to include it as a module or you may add it to your
configuration locally.
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/configuring/dag-entries.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ entries in nvf:
inserted before the rest of the DAG
2. `globalsScript` - used to set globals defined in `vim.globals`
3. `basic` - used to set basic configuration options
4. `theme` - used to set up the theme, which has to be done before other plugins
4. `theme` (this is simply placed before `pluginConfigs`, meaning that surrounding entries don't depend on it) - used to set up the theme, which has to be done before other plugins
5. `pluginConfigs` - the result of the nested `vim.pluginRC` (internal option,
see the [Custom Plugins](/index.xhtml#ch-custom-plugins) page for adding your own
plugins) DAG, used to set up internal plugins
Expand Down
29 changes: 27 additions & 2 deletions docs/release-notes/rl-0.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ configuration formats.
longer filtered and thus should be used instead.
- Add dap-go for better dap configurations
- Make noice.nvim customizable
- Standardize border style options and add custom borders

[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim
Expand All @@ -71,7 +72,8 @@ configuration formats.

- Fix "Emac" typo

- Add [new-file-template.nvim] to automatically fill new file contents using templates.
- Add [new-file-template.nvim] to automatically fill new file contents using
templates.

[diniamo](https://github.com/diniamo):

Expand All @@ -93,7 +95,6 @@ configuration formats.
plugin's options can now be found under `indentBlankline.setupOpts`, the
previous iteration of the module also included out of place/broken options,
which have been removed for the time being. These are:

- `listChar` - this was already unused
- `fillChar` - this had nothing to do with the plugin, please configure it
yourself by adding `vim.opt.listchars:append({ space = '<char>' })` to your
Expand Down Expand Up @@ -146,7 +147,31 @@ configuration formats.
- Add `nvf-print-config` & `nvf-print-config-path` helper scripts to Neovim
closure. Both of those scripts have been automatically added to your PATH upon
using neovimConfig or `programs.nvf.enable`.

- `nvf-print-config` will display your `init.lua`, in full.
- `nvf-print-config-path` will display the path to _a clone_ of your
`init.lua`. This is not the path used by the Neovim wrapper, but an
identical clone.

- Add `vim.ui.breadcrumbs.lualine` to allow fine-tuning breadcrumbs behaviour on
Lualine. Only `vim.ui.breadcrumbs.lualine.winbar` is supported for the time
being.

- [](#opt-vim.ui.breadcrumbs.lualine.winbar.enable) has been added to allow
controlling the default behaviour of the `nvim-navic` component on Lualine,
which used to occupy `winbar.lualine_c` as long as breadcrumbs are enabled.
- `vim.ui.breadcrumbs.alwaysRender` has been renamed to
[](#opt-vim.ui.breadcrumbs.lualine.winbar.alwaysRender) to be conform to the
new format.

- Add [basedpyright](https://github.com/detachhead/basedpyright) as a Python LSP
server and make it default.

- Add [python-lsp-server](https://github.com/python-lsp/python-lsp-server) as an
additional Python LSP server.

[ppenguin](https://github.com/ppenguin):

- Telescope:
- Fixed `project-nvim` command and keybinding
- Added default ikeybind/command for `Telescope resume` (`<leader>fr`)
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/types/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
typesCustom = import ./custom.nix {inherit lib;};
in {
inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
inherit (typesLanguage) diagnostics mkGrammarOption;
inherit (typesCustom) anythingConcatLists char;
}
4 changes: 4 additions & 0 deletions lib/types/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@
};
};
};

borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
in {
inherit extraPluginType fromInputs pluginType;

borderType = either (enum borderPresets) (listOf (either str (listOf str)));

pluginsOpt = {
description,
example,
Expand Down
35 changes: 33 additions & 2 deletions modules/plugins/languages/python.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

cfg = config.vim.languages.python;

defaultServer = "pyright";
defaultServer = "basedpyright";
servers = {
pyright = {
package = pkgs.pyright;
Expand All @@ -30,6 +30,36 @@
}
'';
};

basedpyright = {
package = pkgs.basedpyright;
lspConfig = ''
lspconfig.basedpyright.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/basedpyright-langserver", "--stdio"}''
}
}
'';
};

python-lsp-server = {
package = pkgs.python-lsp-server;
lspConfig = ''
lspconfig.pylsp.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/pylsp"}''
}
}
'';
};
};

defaultFormat = "black";
Expand Down Expand Up @@ -61,11 +91,12 @@
black-and-isort = {
package = pkgs.writeShellApplication {
name = "black";
runtimeInputs = [pkgs.black pkgs.isort];
text = ''
black --quiet - "$@" | isort --profile black -
'';
runtimeInputs = [pkgs.black pkgs.isort];
};

nullConfig = ''
table.insert(
ls_sources,
Expand Down
3 changes: 2 additions & 1 deletion modules/plugins/lsp/lspconfig/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
inherit (lib.strings) optionalString;
inherit (lib.attrsets) mapAttrs;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject;

cfg = config.vim.lsp;
in {
Expand All @@ -22,7 +23,7 @@ in {
${
optionalString config.vim.ui.borders.enable ''
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
''
}
'';
Expand Down
3 changes: 2 additions & 1 deletion modules/plugins/lsp/nvim-code-action-menu/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;

cfg = config.vim.lsp;

Expand All @@ -25,7 +26,7 @@ in {

pluginRC.code-action-menu = entryAnywhere ''
-- border configuration
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
-- show individual sections of the code action menu
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
Expand Down
8 changes: 4 additions & 4 deletions modules/plugins/statusline/lualine/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
inherit (lib.generators) mkLuaInline;

cfg = config.vim.statusline.lualine;
breadcrumbsCfg = config.vim.ui.breadcrumbs;
bCfg = config.vim.ui.breadcrumbs;
in {
config = mkMerge [
# TODO: move into nvim-tree file
Expand All @@ -20,21 +20,21 @@ in {
extensions = ["nvim-tree"];
};
})
(mkIf (breadcrumbsCfg.enable && breadcrumbsCfg.source == "nvim-navic") {

(mkIf (bCfg.enable && bCfg.lualine.winbar.enable && bCfg.source == "nvim-navic") {
vim.statusline.lualine.setupOpts = {
# TODO: rewrite in new syntax
winbar.lualine_c = mkDefault [
[
"navic"
(mkLuaInline "draw_empty = ${boolToString config.vim.ui.breadcrumbs.alwaysRender}")
(mkLuaInline "draw_empty = ${boolToString bCfg.lualine.winbar.alwaysRender}")
]
];
};
})
(mkIf cfg.enable {
vim = {
startPlugins = ["lualine"];

pluginRC.lualine = entryAnywhere ''
local lualine = require('lualine')
lualine.setup ${toLuaObject cfg.setupOpts}
Expand Down
4 changes: 2 additions & 2 deletions modules/plugins/theme/theme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
inherit (lib.attrsets) attrNames;
inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.dag) entryBefore;

cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix {
Expand Down Expand Up @@ -45,7 +45,7 @@ in {
config = mkIf cfg.enable {
vim = {
startPlugins = [cfg.name];
luaConfigRC.theme = entryAfter ["basic"] ''
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
${cfg.extraConfig}
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
'';
Expand Down
17 changes: 10 additions & 7 deletions modules/plugins/ui/borders/borders.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.lists) optionals;
inherit (lib.types) enum;
inherit (lib.nvim.types) borderType;

cfg = config.vim.ui.borders;

defaultStyles = ["none" "single" "double" "rounded"];
in {
options.vim.ui.borders = {
enable = mkEnableOption "visible borders for most windows";

globalStyle = mkOption {
type = enum defaultStyles;
type = borderType;
default = "rounded";
description = ''
The global border style to use.
If a list is given, it should have a length of eight or any divisor of
eight. The array will specify the eight chars building up the border in
a clockwise fashion starting with the top-left corner. You can specify
a different highlight group for each character by passing a
[char, "YourHighlightGroup"] instead
'';
example = ["╔" "═" "╗" "║" "╝" "═" "╚" "║"];
};

# TODO: make per-plugin borders configurable
plugins = let
mkPluginStyleOption = name: {
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};

style = mkOption {
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
type = borderType;
default = cfg.globalStyle;
description = "The border style to use for the ${name} plugin";
};
Expand Down
Loading

0 comments on commit 4e01a93

Please sign in to comment.