Merge branch 'main' into feature/breadcrumbs

This commit is contained in:
NotAShelf 2023-07-26 10:36:08 +03:00 committed by GitHub
commit 6e3ae75ae8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 138 additions and 132 deletions

View file

@ -30,22 +30,21 @@ Here are the overall boundaries I would like you to follow while contributing to
#### Documentation #### Documentation
If you are making a pull request to add a If you are making a pull request to add a
#### Style #### Style
**Nix** **Nix**
We use Alejandra for formatting nix code, which can be invoked directly with `nix fmt` in the repository. We use Alejandra for formatting nix code, which can be invoked directly by running `nix fmt` in the repository.
While Alejandra is mostly opinionated on how code looks after formatting, certain formattings are done at the user's discretion. While Alejandra is mostly opinionated on how code looks after formatting, certain formattings are done at the user's discretion.
Please use one line code for attribute sets that contain only one subset. Please use one line code for attribute sets that contain only one subset.
For example: For example:
```nix ```nix
# parent modules should always be unfolded # parent modules should always be unfolded
module = { module = {
value = mkEnableOption "some description" // { default = true; }; value = mkEnableOption "some description" // { default = true; };
# same as parent modules, unfold submodules # same as parent modules, unfold submodules
subModule = { subModule = {
@ -65,15 +64,16 @@ If you move a line down after the merge operator, Alejandra will automatically u
module = { module = {
key = mkEnableOption "some description" // { key = mkEnableOption "some description" // {
default = true; # we want this to be inline default = true; # we want this to be inline
}; };
# ... # ...
} }
``` ```
For lists, it's up mostly to your discretion but please try to avoid unfolded lists if there is only one item in the list. For lists, it's up mostly to your discretion but please try to avoid unfolded lists if there is only one item in the list.
```nix ```nix
# ok # ok
acceptableList = [ acceptableList = [
item1 item1
item2 item2
@ -85,10 +85,11 @@ acceptableList = [
listToBeAvoided = [item1 item2 item3 item4]; listToBeAvoided = [item1 item2 item3 item4];
``` ```
*This will be moved elsewhere, disregard unless you are adding a new plugin with keybinds* _This will be moved elsewhere, disregard unless you are adding a new plugin with keybinds_
#### Keybinds #### Keybinds
##### Custom key mappings support for a plugin ##### Custom key mappings support for a plugin
To add custom keymappings to a plugin, a couple of helper functions are available in the project. To add custom keymappings to a plugin, a couple of helper functions are available in the project.
@ -237,5 +238,3 @@ in {
``` ```
If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings, don't be scared to implement a draft PR. We'll help you get it done. If you have come across a plugin that has an API that doesn't seem to easily allow custom keybindings, don't be scared to implement a draft PR. We'll help you get it done.

View file

@ -7,7 +7,7 @@ body:
id: no-duplicate-issues id: no-duplicate-issues
attributes: attributes:
label: "⚠️ Please verify that this bug has NOT been reported before." label: "⚠️ Please verify that this bug has NOT been reported before."
description: "Search in the issues sections by clicking [HERE](https://github.com/notashelf/neovim-flake4/issues?q=)" description: "Search in the issues sections by clicking [HERE](https://github.com/notashelf/neovim-flake/issues?q=)"
options: options:
- label: "I checked all existing issues and didn't find a similar issue" - label: "I checked all existing issues and didn't find a similar issue"
required: true required: true

View file

@ -18,11 +18,10 @@ Please delete any options that are not relevant.
## Checklist ## Checklist
Please try to check at least a majority of the checklist before opening your pull request. PRs Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.
Exceptions to this will be reviewed on a case by case basis.
- [ ] My code follows the style and contributing guidelines of this project. - [ ] My code follows the style and contributing guidelines of this project.
- [ ] I ran Alejandra to format my code. - [ ] I ran Alejandra to format my code (`nix fmt`).
- [ ] I have performed a self-review of my own code and tested it. - [ ] I have performed a self-review of my own code and tested it.
- [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] My changes generate no new warnings. - [ ] My changes generate no new warnings.

4
.github/README.md vendored
View file

@ -52,7 +52,7 @@
</p></div> </p></div>
[Get Started]: #try-it-out [Get Started]: #get-started
[Documentation]: #documentation [Documentation]: #documentation
[Help]: #help [Help]: #help
[Contribute]: #contributing [Contribute]: #contributing
@ -144,8 +144,8 @@ Special thanks to
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work - [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
- [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible - [@n3oney](https://github.com/n3oney) - For making custom keybinds finally possible
- [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates - [@horriblename](https://github.com/horriblename) - For actively implementing planned features and quality of life updates
- [@FlafyDev](https://github.com/FlafyDev) - For getting the home-manager to work
- [@Yavko](https://github.com/Yavko) - For the amazing neovim-flake logo - [@Yavko](https://github.com/Yavko) - For the amazing neovim-flake logo
- [@FrothyMarrow](https://github.com/FrothyMarrow) - For seeing mistakes that I could not
and everyone who has submitted issues or pull requests! and everyone who has submitted issues or pull requests!

View file

@ -11,15 +11,16 @@ on:
- .gitignore - .gitignore
jobs: jobs:
cahix: cachix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
package: package:
- default - default
- nix - nix
- tidal - tidal
- maximal - maximal
steps: steps:
- uses: easimon/maximize-build-space@v6 - uses: easimon/maximize-build-space@v6
with: with:
@ -30,7 +31,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20 - uses: cachix/install-nix-action@v20
with: with:
extra_nix_config: | extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
auto-optimise-store = true auto-optimise-store = true
experimental-features = nix-command flakes experimental-features = nix-command flakes

View file

@ -20,10 +20,11 @@ jobs:
extra_nix_config: | extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix flake check - run: nix flake check
format-with-alejandra: format-with-alejandra:
name: Formatting via Alejandra name: Formatting via Alejandra
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20 - uses: cachix/install-nix-action@v20
with: with:
@ -32,4 +33,3 @@ jobs:
auto-optimise-store = true auto-optimise-store = true
experimental-features = nix-command flakes experimental-features = nix-command flakes
- run: nix run nixpkgs#alejandra -- -c . - run: nix run nixpkgs#alejandra -- -c .

View file

@ -206,7 +206,10 @@ inputs: let
}; };
vim.assistant = { vim.assistant = {
copilot.enable = isMaximal; copilot = {
enable = isMaximal;
cmp.enable = isMaximal;
};
}; };
vim.session = { vim.session = {

View file

@ -1,77 +0,0 @@
[[ch-hm-module]]
== Home Manager
The Home Manager module allows us to customize the different `vim` options. To use it, we first add the input flake.
[source,nix]
----
{
neovim-flake = {
url = github:notashelf/neovim-flake;
# you can override input nixpkgs
inputs.nixpkgs.follows = "nixpkgs";
};
}
----
Followed by importing the HM module.
[source,nix]
----
{
imports = [ neovim-flake.homeManagerModules.default ];
}
----
Then we should be able to use the given module. E.g.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
# your settings need to go into the settings attrset
settings = {
vim.viAlias = false;
vim.vimAlias = true;
vim.lsp = {
enable = true;
};
};
};
}
----
=== Custom vim plugins
It's possible to add custom vim plugins by using the startPlugins and lua DAG settings. First we install the plugin by adding it to startPlugins. This example uses nvim-surround, but the process will be similar for other plugins as well.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
};
};
}
----
Then we continue by requiring the plugin in lua using DAG settings. Please note that you're able to name this setting to however you want, the name will add a `--SECTION <name>` in the init.vim, under which it will be initialized.
[source,nix]
----
{
programs.neovim-flake = {
enable = true;
settings = {
vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ];
luaConfigRC.nvim-surround = nvim-flake.lib.nvim.dag.entryAnywhere '' # nvim-flake is a reference to the flake. Please change this accordingly to your config.
require("nvim-surround").setup()
'';
};
};
}
----

View file

@ -0,0 +1,21 @@
[[sec-release-0.5]]
== Release 0.5
[[sec-release-0.5-changelog]]
=== Changelog
https://github.com/horriblename[horriblename]:
* Add transparency support for tokyonight theme.
* Fix bug where cmp's close and scrollDocs mappings wasn't working.
https://github.com/amanse[amanse]:
* Add daily notes options for obsidian plugin
https://github.com/notashelf[notashelf]:
* Add GitHub Copilot to completion sources

View file

@ -224,6 +224,22 @@
"type": "github" "type": "github"
} }
}, },
"copilot-cmp": {
"flake": false,
"locked": {
"lastModified": 1683831407,
"narHash": "sha256-+MzEGnhlrYRvAfskOwmw69OC1CsPXt7s3z+xPe9XPqs=",
"owner": "zbirenbaum",
"repo": "copilot-cmp",
"rev": "c2cdb3c0f5078b0619055af192295830a7987790",
"type": "github"
},
"original": {
"owner": "zbirenbaum",
"repo": "copilot-cmp",
"type": "github"
}
},
"copilot-lua": { "copilot-lua": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -919,16 +935,15 @@
"nvim-bufferline-lua": { "nvim-bufferline-lua": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1666171880, "lastModified": 1689661992,
"narHash": "sha256-hueIGT7KOhca0kP0M1nUYzBrzMz+DpuZSOt5iyuEa40=", "narHash": "sha256-0BJXUDGeUhPALEnPgO4ix+GgI/3P/Foiqi0tf2mgUXg=",
"owner": "akinsho", "owner": "akinsho",
"repo": "nvim-bufferline.lua", "repo": "nvim-bufferline.lua",
"rev": "e70be6232f632d16d2412b1faf85554285036278", "rev": "d24378edc14a675c820a303b4512af3bbc5761e9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "akinsho", "owner": "akinsho",
"ref": "v3.0.1",
"repo": "nvim-bufferline.lua", "repo": "nvim-bufferline.lua",
"type": "github" "type": "github"
} }
@ -1385,6 +1400,7 @@
"cmp-vsnip": "cmp-vsnip", "cmp-vsnip": "cmp-vsnip",
"codewindow-nvim": "codewindow-nvim", "codewindow-nvim": "codewindow-nvim",
"comment-nvim": "comment-nvim", "comment-nvim": "comment-nvim",
"copilot-cmp": "copilot-cmp",
"copilot-lua": "copilot-lua", "copilot-lua": "copilot-lua",
"crates-nvim": "crates-nvim", "crates-nvim": "crates-nvim",
"dashboard-nvim": "dashboard-nvim", "dashboard-nvim": "dashboard-nvim",

View file

@ -182,7 +182,7 @@
# Tablines # Tablines
nvim-bufferline-lua = { nvim-bufferline-lua = {
url = "github:akinsho/nvim-bufferline.lua?ref=v3.0.1"; url = "github:akinsho/nvim-bufferline.lua";
flake = false; flake = false;
}; };
@ -493,6 +493,11 @@
flake = false; flake = false;
}; };
copilot-cmp = {
url = "github:zbirenbaum/copilot-cmp";
flake = false;
};
# Session management # Session management
nvim-session-manager = { nvim-session-manager = {
url = "github:Shatur/neovim-session-manager"; url = "github:Shatur/neovim-session-manager";

View file

@ -89,6 +89,7 @@ with lib; let
"nvim-dap-ui" "nvim-dap-ui"
"nvim-navic" "nvim-navic"
"nvim-navbuddy" "nvim-navbuddy"
"copilot-cmp"
]; ];
# You can either use the name of the plugin or a package. # You can either use the name of the plugin or a package.
pluginsType = with types; pluginsType = with types;

View file

@ -21,16 +21,21 @@ with builtins; let
''; '';
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [ vim.startPlugins =
"copilot-lua" [
cfg.copilotNodePackage "copilot-lua"
]; cfg.copilotNodePackage
]
++ lib.optionals (cfg.cmp.enable) [
"copilot-cmp"
];
vim.luaConfigRC.copilot = nvim.dag.entryAnywhere '' vim.luaConfigRC.copilot = nvim.dag.entryAnywhere ''
require("copilot").setup({ require("copilot").setup({
-- available options: https://github.com/zbirenbaum/copilot.lua -- available options: https://github.com/zbirenbaum/copilot.lua
copilot_node_command = "${cfg.copilot_node_command}", copilot_node_command = "${cfg.copilotNodeCommand}",
panel = { panel = {
enabled = ${lib.boolToString (!cfg.cmp.enable)},
keymap = { keymap = {
jump_prev = false, jump_prev = false,
jump_next = false, jump_next = false,
@ -44,6 +49,7 @@ in {
}, },
}, },
suggestion = { suggestion = {
enabled = ${lib.boolToString (!cfg.cmp.enable)},
keymap = { keymap = {
accept = false, accept = false,
accept_word = false, accept_word = false,
@ -54,6 +60,10 @@ in {
}, },
}, },
}) })
${lib.optionalString (cfg.cmp.enable) ''
require("copilot_cmp").setup()
''}
''; '';
vim.maps.normal = mkMerge [ vim.maps.normal = mkMerge [

View file

@ -10,6 +10,7 @@ with builtins; let
in { in {
options.vim.assistant.copilot = { options.vim.assistant.copilot = {
enable = mkEnableOption "GitHub Copilot AI assistant"; enable = mkEnableOption "GitHub Copilot AI assistant";
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
panel = { panel = {
position = mkOption { position = mkOption {
@ -91,16 +92,22 @@ in {
}; };
}; };
copilot_node_command = mkOption { copilotNodeCommand = mkOption {
type = types.str; type = types.str;
default = "${lib.getExe cfg.copilotNodePackage}"; default = "${lib.getExe cfg.copilotNodePackage}";
description = "Path to nodejs"; description = ''
The command that will be executed to initiate nodejs for GitHub Copilot.
Recommended to leave as default.
'';
}; };
copilotNodePackage = mkOption { copilotNodePackage = mkOption {
type = with types; nullOr package; # TODO - maybe accept a path as well? imperative users might want to use something like nvm type = with types; nullOr package;
default = pkgs.nodejs-slim; # this will likely need to be downgraded because Copilot does not stay up to date with NodeJS default = pkgs.nodejs-slim;
description = "The package that will be used for Copilot. NodeJS v18 is recommended."; description = ''
The nodeJS package that will be used for GitHub Copilot. If you are using a custom node command
you may want to set this option to null so that the package is not pulled from nixpkgs.
'';
}; };
}; };
} }

View file

@ -49,6 +49,7 @@ in {
"buffer" = "[Buffer]"; "buffer" = "[Buffer]";
"crates" = "[Crates]"; "crates" = "[Crates]";
"path" = "[Path]"; "path" = "[Path]";
"copilot" = "[Copilot]";
}; };
vim.maps.insert = mkMerge [ vim.maps.insert = mkMerge [
@ -106,17 +107,13 @@ in {
end end
'') '')
(mkSetLuaBinding mappings.close '' (mkSetLuaBinding mappings.close ''
require('cmp').mapping.abort require('cmp').mapping.abort()
'') '')
(mkSetLuaBinding mappings.scrollDocsUp '' (mkSetLuaBinding mappings.scrollDocsUp ''
function() require('cmp').mapping.scroll_docs(-4)
require('cmp').mapping.scroll_docs(-4)
end
'') '')
(mkSetLuaBinding mappings.scrollDocsDown '' (mkSetLuaBinding mappings.scrollDocsDown ''
function() require('cmp').mapping.scroll_docs(4)
require('cmp').mapping.scroll_docs(4)
end
'') '')
]; ];
@ -125,17 +122,13 @@ in {
require('cmp').complete require('cmp').complete
'') '')
(mkSetLuaBinding mappings.close '' (mkSetLuaBinding mappings.close ''
require('cmp').mapping.close require('cmp').mapping.close()
'') '')
(mkSetLuaBinding mappings.scrollDocsUp '' (mkSetLuaBinding mappings.scrollDocsUp ''
function() require('cmp').mapping.scroll_docs(-4)
require('cmp').mapping.scroll_docs(-4)
end
'') '')
(mkSetLuaBinding mappings.scrollDocsDown '' (mkSetLuaBinding mappings.scrollDocsDown ''
function() require('cmp').mapping.scroll_docs(4)
require('cmp').mapping.scroll_docs(4)
end
'') '')
]; ];

View file

@ -23,6 +23,18 @@ in {
if (auto.type == "nvim-cmp") if (auto.type == "nvim-cmp")
then "true" then "true"
else "false" else "false"
}
},
daily_notes = {
folder = ${
if (cfg.daily-notes.folder == "")
then "nil,"
else "'${cfg.daily-notes.folder}',"
}
date_format = ${
if (cfg.daily-notes.date-format == "")
then "nil,"
else "'${cfg.daily-notes.date-format}',"
} }
} }
}) })

View file

@ -14,6 +14,19 @@ with builtins; {
description = "Obsidian vault directory"; description = "Obsidian vault directory";
}; };
daily-notes = {
folder = mkOption {
type = types.str;
default = "";
description = "Directory in which daily notes should be created";
};
date-format = mkOption {
type = types.str;
default = "";
description = "Date format used for creating daily notes";
};
};
completion = { completion = {
nvim_cmp = mkOption { nvim_cmp = mkOption {
# if using nvim-cmp, otherwise set to false # if using nvim-cmp, otherwise set to false

View file

@ -18,6 +18,9 @@
style ? "night", style ? "night",
transparent, transparent,
}: '' }: ''
require('tokyonight').setup {
transparent = ${lib.boolToString transparent};
}
vim.cmd[[colorscheme tokyonight-${style}]] vim.cmd[[colorscheme tokyonight-${style}]]
''; '';
styles = ["day" "night" "storm" "moon"]; styles = ["day" "night" "storm" "moon"];