Merge pull request #1 from NotAShelf/rebase

refactor and new plugins
This commit is contained in:
NotAShelf 2023-02-06 05:35:50 +00:00 committed by GitHub
commit 4a577a4424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 3213 additions and 643 deletions

1
.github/CODEOWNERS vendored Normal file
View file

@ -0,0 +1 @@
* @NotAShelf

46
.github/workflows/cachix.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: build-and-cache
on:
workflow_dispatch:
push:
paths-ignore:
- '**/README.md'
- '**/.gitignore'
- '**/assets'
jobs:
nix:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- default
- nix
- tidal
- maximal
steps:
- uses: easimon/maximize-build-space@v6
with:
overprovision-lvm: true
remove-android: true
remove-dotnet: true
remove-haskell: true
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
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: cachix/cachix-action@v12
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community
name: neovim-flake
- 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 Hyprland with default settings
run: nix build .#${{ matrix.package }} --print-build-logs

15
.gitignore vendored
View file

@ -1,2 +1,13 @@
result
.config
# Ignore nix artifacts
result/
.direnv
# Ignore files generated by common IDEs
.vscode/*
.idea/*
# Ignore log files generated by my debuggers
*.log
*.log.*
#

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Jordan
Copyright (c) 2023 NotAShelf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

142
README.md
View file

@ -1,30 +1,144 @@
# neovim-flake
<div align="center"><p>
<a href="https://github.com/NotAShelf/neovim-flake/releases/latest">
<img alt="Latest release" src="https://img.shields.io/github/v/release/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/NotAShelf/neovim-flake/pulse">
<img alt="Last commit" src="https://img.shields.io/github/last-commit/NotAShelf/neovim-flake?style=for-the-badge&logo=starship&color=8bd5ca&logoColor=D9E0EE&labelColor=302D41"/>
</a>
<a href="https://github.com/NotAShelf/neovim-flake/blob/main/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=ee999f&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/NotAShelf/neovim-flake/stargazers">
<img alt="Stars" src="https://img.shields.io/github/stars/NotAShelf/neovim-flake?style=for-the-badge&logo=nixos&color=c69ff5&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/NotAShelf/neovim-flake/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/NotAShelf/neovim-flake?style=for-the-badge&logo=bilibili&color=F5E0DC&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://github.com/NotAShelf/neovim-flake">
<img alt="Repo Size" src="https://img.shields.io/github/repo-size/NotAShelf/neovim-flake?color=%23DDB6F2&label=SIZE&logo=codesandbox&style=for-the-badge&logoColor=D9E0EE&labelColor=302D41" />
</a>
<a href="https://patreon.com/chrisatmachine" title="Donate to this project using Patreon">
<img alt="Patreon donate button" src="https://img.shields.io/badge/patreon-donate-yellow.svg?style=for-the-badge&logo=starship&color=f5a97f&logoColor=D9E0EE&labelColor=302D41" />
</a>
A highly configurable nix flake for neovim.
<p align="center">
<img src="https://stars.medv.io/NotAShelf/neovim-flake.svg", title="commits"/>
</p>
</p></div>
Come join the Matrix room if you have any questions or need help: [#neovim-flake:matrix.org](https://matrix.to/#/#neovim-flake:matrix.org)
An Nix wrapped IDE layer for the superior text editor, Neovim.
---
<div align="center"><p>
**[<kbd><br>Install<br></kbd>][Install]**
**[<kbd><br>Configure<br></kbd>][Configure]**
**[<kbd><br>Documentation<br></kbd>][Documentation]**
**[<kbd><br>Contribute<br></kbd>][Contribute]**
**[<kbd><br>FAQ<br></kbd>][Faq]**
</p></div>
[Contribute]: #contributing
[Install]: #install
[Configure]: #configure
[Documentation]: #documentation
[FAQ]: #faq
---
A highly configurable nix flake for Neovim, packing everything you might need to create your own neovim IDE.
## Install
### Using `nix`
The easiest way to install is to use the `nix profile` command. To install the default configuration, run:
```console
nix run github:notashelf/neovim-flake
```
The package exposes `.#nix` as the default output. You may use `.#nix`, `.#tidal` or `.#maximal` to get different configurations.
It is as simply as changing the target output to get a different configuration. For example, to get a configuration with `tidal` support, run:
```console
nix run github:notashelf/neovim-flake#tidal
```
Similar instructions will apply for `nix profile install`.
### On NixOS
NixOS users may add this repo to their flake inputs as such:
```nix
{
inputs = {
# point at this repository, you may pin specific revisions or branches while using `github:`
neovim-flake.url = "github:notashelf/neovim-flake";
# you may override our nixpkgs with your own, this will save you some cache hits and s recommended
nixpkgs.follows = "nixpkgs";
};
}
```
Then, you can use the `neovim-flake` input in your `systemPackages` or `home.packages`.
## Configure
TODO (awaiting #1 to be merged, which implements a separate configuration file)
## Documentation
See the [neovim-flake Manual](https://jordanisaacs.github.io/neovim-flake/) for documentation, available options, and release notes.
See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for detailed documentation, available options, and release notes.
If you want to dive right into trying **neovim-flake** you can get a fully featured configuration with `nix` language support by running:
If you want to dive right into trying neovim-flake you can get a fully featured configuration with `nix` language support by running:
```
nix run github:jordanisaacs/neovim-flake
```console
nix run github:notashelf/neovim-flake
```
## Screenshot
The documentation is scarce right now as a result of the ongoing rebase and refactor, but shall be available once more soon.
![screenshot](./screenshot.png)
## Help
You can create an issue on the [issue tracker](issues) to ask questions or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue tracker for now.
## Philosophy
The philosophy behind this flake configuration is to allow for easily configurable and reproducible neovim environments. Enter a directory and have a ready to go neovim configuration that is the same on every machine. Whether you are a developer, writer, or live coder (see tidal cycles below!), quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more).
The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment. While it does sacrifice in size
(which I know some users will find *disagreeable*), it offers a lot of flexibility and customizability in exchange for the large size of the flake inputs.
The KISS (Keep it simple, stupid) principle has been abandoned here, but you can ultimately declare a configuration that follows KISS.
For it is very easy to bring your own plugins and configurations. Whether you are a developer, writer, or live coder (see tidal cycles below!),
quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that takes advantage of pinning vim plugins and
third party dependencies (such as tree-sitter grammars, language servers, and more).
As a result, one should never get a broken config when setting options. If setting multiple options results in a broken neovim, file an issue! Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things like completion sources and languages.
One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue! Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things like completion sources and languages.
## Credits
## Credit
This configuration is based on a few other configurations, including:
Originally based on Wil Taylor's amazing [neovim-flake](https://github.com/wiltaylor/neovim-flake)
- [@sioodmy's](https://github.com/sioodmy) [dotfiles](https://github.com/sioodmy/dotfiles)
- [@wiltaylor's](https://github.com/wiltaylor) [neovim-flake](https://github.com/wiltaylor/neovim-flake)
- [@jordanisaacs's](https://github.com/jordanisaacs) [neovim-flake](https://github.com/jordanisaacs/neovim-flake)
- [@gvolpe's](https://github.com/gvolpe) [neovim-flake](https://github.com/gvolpe/neovim-flake)
I am grateful for their work and inspiration.
## FAQ
**Q**: Why is this flake so big?
**A**: I have sacrificed in size in order to provide a highly configurable and reproducible Neovim environment. A binary cache is provided to
eleminate the need to build the flake from source, but it is still a large flake. If you do not need all the features, you can use the default `nix` output
instead of the `maximal` output. This will reduce size by a lot, but you will lose some language specific features.
**Q**: Will you use a plugin manager?
**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.
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
assets/dashboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

BIN
assets/ide_mode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

BIN
assets/telescope.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

View file

@ -18,7 +18,7 @@ The following is an example of a barebones vim configuration with the default th
[source,nix]
----
{
inputs.neovim-flake.url = "github:jordanisaacs/neovim-flake";
inputs.neovim-flake.url = "github:notashelf/neovim-flake";
outputs = {nixpkgs, neovim-flake, ...}: let
system = "x86_64-linux";

View file

@ -7,7 +7,7 @@ While you can configure neovim-flake yourself using the builder, here are a few
=== Tidal Cycles
[source,console]
$ nix run github:jordanisaacs/neovim-flake#tidal file.tidal
$ nix run github:notashelf/neovim-flake#tidal file.tidal
Utilizing https://github.com/tidalcycles/vim-tidal[vim-tidal] and mitchmindtree's fantastic https://github.com/mitchmindtree/tidalcycles.nix[tidalcycles.nix] start playing with tidal cycles in a single command.
@ -18,7 +18,7 @@ In your tidal file, type a cycle e.g. `d1 $ s "drum"` and then press _ctrl+enter
=== Nix
[source,console]
$ nix run github:jordanisaacs/neovim-flake#nix test.nix
$ nix run github:notashelf/neovim-flake#nix test.nix
Enables all the of neovim plugins, with language support for specifically Nix. This lets you see what a fully configured neovim setup looks like without downloading a whole bunch of language servers and associated tools.
@ -26,11 +26,12 @@ Enables all the of neovim plugins, with language support for specifically Nix. T
=== Maximal
[source,console]
$ nix shell github:jordanisaacs/neovim-flake#maximal test.nix
$ nix run github:notashelf/neovim-flake#maximal test.nix
It is the same fully configured neovim as with the <<sec-default-nix,Nix>> config, but with every supported language enabled.
[NOTE]
====
Running the maximal config will download *a lot* of packages as it is downloading language servers, formatters, and more.
Running the maximal config will download *a lot* of packages, as it will be downloading language servers, formatters, and more. You are recommended to use the binary cache if
using the default configs.
====

View file

@ -22,7 +22,7 @@
}
++ [scrubbedPkgsModule];
moduleRootPaths = [./..];
mkModuleUrl = path: "https://github.com/jordanisaacs/neovim-flake/blob/main/${path}#blob-path";
mkModuleUrl = path: "https://github.com/notashelf/neovim-flake/blob/main/${path}#blob-path";
channelName = "neovim-flake";
docBook.id = "neovim-flake-options";
};

View file

@ -5,7 +5,7 @@
<info>
<author><personname>neovim-flake contributors</personname></author>
<copyright>
<year>20212022</year>
<year>2023</year>
<holder>neovim-flake contributors</holder>
</copyright>
</info>

View file

@ -9,10 +9,8 @@
<preface>
<title>Preface</title>
<para>
If you encounter problems or want to discuss neovim-flake then join the Matrix room
<link xlink:href="https://matrix.to/#/%23neovim-flake:matrix.org">#neovim-flake:matrix.org</link>.
If your problem is caused by a bug in neovim-flake then it should be reported on the
<link xlink:href="https://github.com/jordanisaacs/neovim-flake/issues">neovim-flake issue tracker</link>.
<link xlink:href="https://github.com/notashelf/neovim-flake/issues">neovim-flake issue tracker</link>.
</para>
</preface>
<xi:include href="default-configs.xml"/>

View file

@ -3,6 +3,42 @@
The following are the neovim plugins used within neovim-flake. Some plugins are explicitly enabled by the user, while others are enabled implicitly.
[[sec-plugins-buffer]]
=== Coding Assistants
* https://github.com/zbirenbaum/copilot.lua[copilot.lua] a lua replacement for github.vim, the license nightmare AI assistant
* https://github.com/codota/tabnine-nvim[tabnine-nvim] neovim plugin for the more ethically acceptable AI assistant TabNine
[[sec-plugins-buffer]]
=== Buffers
* https://github.com/akinsho/bufferline.nvim[nvim-bufferline-lua] a buffer line with tab integration
* https://github.com/famiu/bufdelete.nvim[bufdelete-nvim] delete buffers without losing window layout
[[sec-plugins-commenting]]
=== Commenting
* https://github.com/b3nj5m1n/kommentary[kommentary] neovim plugin to comment text in and out, written in lua. Supports commenting out the current line, a visual selection and a motion
* https://github.com/folke/todo-comments.nvim[todo-comments.nvim] plugin to highlight and search for todo comments like TODO, HACK, BUG in your codebase
[[sec-plugins-completions]]
=== Completions
* https://github.com/hrsh7th/nvim-cmp[nvim-cmp] a completion engine that utilizes sources
** https://github.com/hrsh7th/cmp-buffer[cmp-buffer] a source for buffer words
** https://github.com/hrsh7th/cmp-nvim-lsp[cmp-nvim-lsp] a source for builtin LSP client
** https://github.com/hrsh7th/cmp-vsnip[cmp-vsnip] a source for vim-vsnip autocomplete
** https://github.com/hrsh7th/cmp-path[cmp-path] a source for path autocomplete
** https://github.com/ray-x/cmp-treesitter[cmp-treesitter] treesitter nodes autcomplete
[[sec-plugins-dashboard]]
=== Dashboard
* https://github.com/glepnir/dashboard-nvim[dashboard.nvim] fancy and blazing fast start screen plugin for Neovim
* https://github.com/goolord/alpha-nvim[alpha.nvim] a fast and fully programmable greeter for neovim
* https://github.com/mhinz/vim-startify[vim-startify] a fancy start screen for {neo,}vim
[[sec-plugins-server]]
=== Language Server
@ -14,12 +50,6 @@ The following are the neovim plugins used within neovim-flake. Some plugins are
* https://github.com/ray-x/lsp_signature.nvim[lsp-signature] show function signatures as you type
* https://github.com/onsails/lspkind-nvim[lspkind-nvim] for pictograms in lsp (with support for nvim-cmp)
[[sec-plugins-buffer]]
=== Buffers
* https://github.com/akinsho/bufferline.nvim[nvim-bufferline-lua] a buffer line with tab integration
* https://github.com/famiu/bufdelete.nvim[bufdelete-nvim] delete buffers without losing window layout
[[sec-plugins-statuslines]]
=== Statuslines
@ -44,23 +74,58 @@ The following are the neovim plugins used within neovim-flake. Some plugins are
=== Visuals
* https://github.com/lukas-reineke/indent-blankline.nvim[indent-blankline] for indentation guides
* https://github.com/kyazdani42/nvim-web-devicons[nvim-web-devicons] Plugins and colors for icons. Requires patched font
* https://github.com/kyazdani42/nvim-web-devicons[nvim-web-devicons] plugins and colors for icons. Requires patched font
* https://github.com/declancm/cinnamon.nvim[cinnamon.nvim] smooth scrolling for ANY movement command
* https://github.com/nvim-cursorline[nvim-cursorline] a plugin for neovim that highlights cursor words and lines
* https://github.com/petertriho/nvim-scrollbar[nvim-scrollbar] a scrollbar plugin for neovim
* https://github.com/Eandrju/cellular-automaton.nvim[cellular-automatan] a vanity to plugin to help you procrastinate more efficiently
[[sec-plugins-minimap]]
=== Minimap
* https://github.com/wfxr/minimap.vim[minimap.vim] a blazing fast minimap plugin for neovim. Depends on code-minimap
* https://github.com/gorbit99/codewindow.nvim[codewindow.nvim] a simple, configurable minimap plugin for neovim with no external dependencies
[[sec-plugins-notifications]]
=== Notifications
* https://github.com/rcarriga/nvim-notify[nvim-notify] simple notification plugin that also integrates with noice.nvim
[sec-plugins-notes]]
=== Note-taking
* https://github.com/obsidian.nvim[obsidian.nvim] a neovim plugin that deeply integrates with the obsidian markdown editor. Also works standalone
* https://github.com/nvim-orgmode/orgmode[orgmode] a neovim replacement for emac orgmode
[sec-plugins-session-management]]
=== Session Management
* https://github.com/Shatur/neovim-session-manager[neovim-session-manager] a simple wrapper around :mksession
[sec-plugins-terminal]]
=== Terminal
* https://github.com/akinsho/toggleterm.nvim[toggleterm.nvim] a simple terminal plugin that opens a terminal buffer on demand
[[sec-plugins-presence]]
=== Rich Presence
* https://github.com/andweeb/presence.nvim[presence.nvim] light and powerful discord rich presence plugin
[[sec-plugins-utilities]]
=== Utilities
* https://github.com/nvim-telescope/telescope.nvim[telescope] an extendable fuzzy finder of lists. Working ripgrep and fd
* https://github.com/folke/which-key.nvim[which-key] a popup that displays possible keybindings of command being typed
* https://github.com/sudormrfbin/cheatsheet.nvim[cheatsheet.nvim] a searchable cheatsheet for neovim from within the editor using Telescope
* https://github.com/ga-rosa/ccc.nvim[ccc.nvim] super powerful color picker / colorizer plugin.
* https://github.com/ziontee113/icon-picker.nvim[icon-picker.nvim] an icon picker plugin that provides access to thousands of icons
* https://github.com/jbyuki/venn.nvim[venn.nvim] draw venn diagrams inside neovim
[[sec-plugins-completions]]
=== Completions
[[sec-plugins-utilities]]
=== Utilities
* https://github.com/hrsh7th/nvim-cmp[nvim-cmp] a completion engine that utilizes sources
** https://github.com/hrsh7th/cmp-buffer[cmp-buffer] a source for buffer words
** https://github.com/hrsh7th/cmp-nvim-lsp[cmp-nvim-lsp] a source for builtin LSP client
** https://github.com/hrsh7th/cmp-vsnip[cmp-vsnip] a source for vim-vsnip autocomplete
** https://github.com/hrsh7th/cmp-path[cmp-path] a source for path autocomplete
** https://github.com/ray-x/cmp-treesitter[cmp-treesitter] treesitter nodes autcomplete
* https://github.com/folke/noice.nvim[noice.nvim] an experimental neovim plugin that replaces some UI components of neovim
[[sec-plugins-snippets]]
=== Snippets
@ -109,3 +174,7 @@ The following are the neovim plugins used within neovim-flake. Some plugins are
=== Dependencies
* https://github.com/nvim-lua/plenary.nvim[plenary] which is a dependency of some plugins, installed automatically if needed
* https://github.comstevearc/dressing.nvim[dressing.nvim] which is a dependency for icon-picker.nvim
* https://github.com/preservim/vim-markdown[vim-markdown] which is a dependency for obsidian.nvim
* https://github.comgodlygeek/tabular[tabular] which is a dependency for vim-markdown
* https://github.com/MunifTanjim/nui.nvim[nui.nvim] which is a dependency for nui-nvim

View file

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

View file

@ -0,0 +1,46 @@
[[sec-release-0.2]]
== Release 0.2
Release notes for release 0.2
[[sec-release-0.2-changelog]]
=== Changelog
https://github.com/notashelf[notashelf]:
* Added two minimap plugins under `vim.minimap`. `codewindow.nvim` is enabled by default, while `minimap.vim` is available with its code-minimap dependency.
* A complementary plugin, `obsidian.nvim` and the Neovim alternative for Emacs' orgmode with `orgmode.nvim` have been added. Both will be disabled by default.
* Smooth scrolling for ANY movement command is now available with `cinnamon.nvim`
* You will now notice a dashboard on startup. This is provided by the `alpha.nvim` plugin. You can use any of the three available dashboard plugins, or disable them entirely.
* There is now a scrollbar on active buffers, which can highlight errors by hooking to your LSPs. This is on by default, but can be toggled off under `vim.visuals` if seen necessary.
* Discord Rich Presence has been added through `presence.nvim` for those who want to flex that they are using the *superior* text editor.
* An icon picker is now available with telescope integration. You can use `:IconPickerInsert` or `:IconPickerYank` to add icons to your code.
* A general purpose cheatsheet has been added through `cheatsheet.nvim`. Forget no longer!
* `ccc.nvim` has been added to the default plugins to allow picking colors with ease.
* Most UI components of Neovim have been replaced through the help of `noice.nvim`. There are also notifications and custom UI elements available for Neovim messages and prompts.
* A (floating by default) terminal has been added through `toggleterm.nvim`.
* Harness the power of ethical (`tabnine.nvim`) and not-so-ethical (`copilot.lua`) AI by those new assistant plugins. Both are off by default, TabNine needs to be wrapped before it's working.
* Experimental mouse gestures have been addede through `gesture.nvim`. See plugin page and the relevant module for more details on how to use.
* Re-open last visited buffers via `nvim-session-manager`. Disabled by default as deleting buffers seems to be problematic at the moment.
* Most of NvimTree's configuration options have been changed with some options being toggled to off by default.
* Lualine had its configuration simplified and style toned down. Less color, more info.
* Modules where multiple plugin configurations were in the same directory have been simplified. Each plugin inside a single module gets its own directory to be imported.
* Separate config options with the same parent attribute have been merged into one for simplicity.

File diff suppressed because it is too large Load diff

694
flake.nix
View file

@ -1,232 +1,5 @@
{
description = "Jordan's Neovim Configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
# For generating documentation website
nmd = {
url = "gitlab:rycee/nmd";
flake = false;
};
# LSP plugins
nvim-lspconfig = {
# url = "github:neovim/nvim-lspconfig?ref=v0.1.3";
# Use master for nil_ls
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:lewis6991/nvim-treesitter-context";
flake = false;
};
nvim-lightbulb = {
url = "github:kosayoda/nvim-lightbulb";
flake = false;
};
nvim-code-action-menu = {
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;
};
# Copying/Registers
registers = {
url = "github:tversteeg/registers.nvim";
flake = false;
};
nvim-neoclip = {
url = "github:AckslD/nvim-neoclip.lua";
flake = false;
};
# Telescope
telescope = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
# Langauge server (use master instead of nixpkgs)
rnix-lsp.url = "github:nix-community/rnix-lsp";
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# Filetrees
nvim-tree-lua = {
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
# Tablines
nvim-bufferline-lua = {
url = "github:akinsho/nvim-bufferline.lua?ref=v3.0.1";
flake = false;
};
# Statuslines
lualine = {
url = "github:hoob3rt/lualine.nvim";
flake = false;
};
# Autocompletes
nvim-compe = {
url = "github:hrsh7th/nvim-compe";
flake = false;
};
nvim-cmp = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
cmp-buffer = {
url = "github:hrsh7th/cmp-buffer";
flake = false;
};
cmp-nvim-lsp = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
cmp-vsnip = {
url = "github:hrsh7th/cmp-vsnip";
flake = false;
};
cmp-path = {
url = "github:hrsh7th/cmp-path";
flake = false;
};
cmp-treesitter = {
url = "github:ray-x/cmp-treesitter";
flake = false;
};
# snippets
vim-vsnip = {
url = "github:hrsh7th/vim-vsnip";
flake = false;
};
# Autopairs
nvim-autopairs = {
url = "github:windwp/nvim-autopairs";
flake = false;
};
nvim-ts-autotag = {
url = "github:windwp/nvim-ts-autotag";
flake = false;
};
# Commenting
kommentary = {
url = "github:b3nj5m1n/kommentary";
flake = false;
};
todo-comments = {
url = "github:folke/todo-comments.nvim";
flake = false;
};
# Buffer tools
bufdelete-nvim = {
url = "github:famiu/bufdelete.nvim";
flake = false;
};
# Themes
tokyonight = {
url = "github:folke/tokyonight.nvim";
flake = false;
};
onedark = {
url = "github:navarasu/onedark.nvim";
flake = false;
};
catppuccin = {
url = "github:catppuccin/nvim";
flake = false;
};
# Rust crates
crates-nvim = {
url = "github:Saecki/crates.nvim";
flake = false;
};
# Visuals
nvim-cursorline = {
url = "github:yamatsum/nvim-cursorline";
flake = false;
};
indent-blankline = {
url = "github:lukas-reineke/indent-blankline.nvim";
flake = false;
};
nvim-web-devicons = {
url = "github:kyazdani42/nvim-web-devicons";
flake = false;
};
gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
# Key binding help
which-key = {
url = "github:folke/which-key.nvim";
flake = false;
};
# Markdown
glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;
};
# Tidal cycles
tidalcycles = {
url = "github:mitchmindtree/tidalcycles.nix";
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
};
# Plenary (required by crates-nvim)
plenary-nvim = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
};
description = "A neovim flake with a modular configuration";
outputs = {
nixpkgs,
flake-utils,
@ -264,8 +37,11 @@
mainConfig = isMaximal: {
config = {
vim.viAlias = false;
vim.vimAlias = true;
vim = {
viAlias = true;
vimAlias = true;
};
vim.lsp = {
enable = true;
formatOnSave = true;
@ -274,10 +50,6 @@
nvimCodeActionMenu.enable = true;
trouble.enable = true;
lspSignature.enable = true;
nix = {
enable = true;
formatter = "alejandra";
};
rust.enable = isMaximal;
python = isMaximal;
clang.enable = isMaximal;
@ -285,10 +57,18 @@
ts = isMaximal;
go = isMaximal;
zig.enable = isMaximal;
nix = {
enable = true;
formatter = "alejandra";
};
};
vim.visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = true;
smoothScroll.enable = true;
cellularAutomaton.enable = true;
lspkind.enable = true;
indentBlankline = {
enable = true;
@ -301,41 +81,106 @@
lineTimeout = 0;
};
};
vim.statusline.lualine = {
enable = true;
theme = "catppuccin";
};
vim.theme = {
enable = true;
name = "catppuccin";
style = "mocha";
};
vim.autopairs.enable = true;
vim.autocomplete = {
enable = true;
type = "nvim-cmp";
};
vim.filetree.nvimTreeLua.enable = true;
vim.tabline.nvimBufferline.enable = true;
vim.filetree = {
nvimTreeLua = {
enable = true;
view = {
width = 25;
};
};
};
vim.tabline = {
nvimBufferline.enable = true;
};
vim.treesitter = {
enable = true;
context.enable = true;
};
vim.keys = {
enable = true;
vim.binds = {
whichKey.enable = true;
cheatsheet.enable = true;
};
vim.telescope = {
enable = true;
};
vim.markdown = {
enable = true;
glow.enable = true;
};
vim.git = {
enable = true;
gitsigns.enable = true;
};
vim.minimap = {
minimap-vim.enable = false;
codewindow.enable = true; # lighter, faster, and uses lua for configuration
};
vim.dashboard = {
dashboard-nvim.enable = false;
alpha.enable = true;
};
vim.notify = {
nvim-notify.enable = true;
};
vim.utility = {
colorizer.enable = true;
icon-picker.enable = true;
venn-nvim.enable = false; # FIXME throws an error when its commands are ran manually
};
vim.notes = {
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
orgmode.enable = true;
};
vim.terminal = {
toggleterm.enable = true;
};
vim.ui = {
noice.enable = true;
};
vim.assistant = {
copilot.enable = false;
tabnine.enable = false; # FIXME: this is not working because the plugin depends on an internal script to be ran by the package manager
};
vim.session = {
nvim-session-manager.enable = false;
};
vim.gestures = {
gesture-nvim.enable = false;
};
};
};
@ -418,4 +263,377 @@
else {}
);
}));
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
# For generating documentation website
nmd = {
url = "gitlab:rycee/nmd";
flake = false;
};
# LSP plugins
nvim-lspconfig = {
# url = "github:neovim/nvim-lspconfig?ref=v0.1.3";
# Use master for nil_ls
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:lewis6991/nvim-treesitter-context";
flake = false;
};
nvim-lightbulb = {
url = "github:kosayoda/nvim-lightbulb";
flake = false;
};
nvim-code-action-menu = {
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;
};
# Copying/Registers
registers = {
url = "github:tversteeg/registers.nvim";
flake = false;
};
nvim-neoclip = {
url = "github:AckslD/nvim-neoclip.lua";
flake = false;
};
# Telescope
telescope = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
# Langauge server (use master instead of nixpkgs)
rnix-lsp.url = "github:nix-community/rnix-lsp";
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# Filetrees
nvim-tree-lua = {
url = "github:nvim-tree/nvim-tree.lua";
flake = false;
};
# Tablines
nvim-bufferline-lua = {
url = "github:akinsho/nvim-bufferline.lua?ref=v3.0.1";
flake = false;
};
# Statuslines
lualine = {
url = "github:hoob3rt/lualine.nvim";
flake = false;
};
# Autocompletes
nvim-compe = {
url = "github:hrsh7th/nvim-compe";
flake = false;
};
nvim-cmp = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
cmp-buffer = {
url = "github:hrsh7th/cmp-buffer";
flake = false;
};
cmp-nvim-lsp = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
cmp-vsnip = {
url = "github:hrsh7th/cmp-vsnip";
flake = false;
};
cmp-path = {
url = "github:hrsh7th/cmp-path";
flake = false;
};
cmp-treesitter = {
url = "github:ray-x/cmp-treesitter";
flake = false;
};
# snippets
vim-vsnip = {
url = "github:hrsh7th/vim-vsnip";
flake = false;
};
# Presence
discord-nvim = {
url = "github:andweeb/presence.nvim";
flake = false;
};
# Autopairs
nvim-autopairs = {
url = "github:windwp/nvim-autopairs";
flake = false;
};
nvim-ts-autotag = {
url = "github:windwp/nvim-ts-autotag";
flake = false;
};
# Commenting
kommentary = {
url = "github:b3nj5m1n/kommentary";
flake = false;
};
todo-comments = {
url = "github:folke/todo-comments.nvim";
flake = false;
};
# Buffer tools
bufdelete-nvim = {
url = "github:famiu/bufdelete.nvim";
flake = false;
};
# Dashboard Utilities
dashboard-nvim = {
url = "github:glepnir/dashboard-nvim";
flake = false;
};
alpha-nvim = {
url = "github:goolord/alpha-nvim";
flake = false;
};
vim-startify = {
url = "github:mhinz/vim-startify";
flake = false;
};
# Themes
tokyonight = {
url = "github:folke/tokyonight.nvim";
flake = false;
};
onedark = {
url = "github:navarasu/onedark.nvim";
flake = false;
};
catppuccin = {
url = "github:catppuccin/nvim";
flake = false;
};
# Rust crates
crates-nvim = {
url = "github:Saecki/crates.nvim";
flake = false;
};
# Visuals
nvim-cursorline = {
url = "github:yamatsum/nvim-cursorline";
flake = false;
};
scrollbar-nvim = {
url = "github:petertriho/nvim-scrollbar";
flake = false;
};
cinnamon-nvim = {
url = "github:declancm/cinnamon.nvim";
flake = false;
};
cellular-automaton = {
url = "github:Eandrju/cellular-automaton.nvim";
flake = false;
};
indent-blankline = {
url = "github:lukas-reineke/indent-blankline.nvim";
flake = false;
};
nvim-web-devicons = {
url = "github:kyazdani42/nvim-web-devicons";
flake = false;
};
gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
# Markdown
glow-nvim = {
url = "github:ellisonleao/glow.nvim";
flake = false;
};
# Tidal cycles
tidalcycles = {
url = "github:mitchmindtree/tidalcycles.nix";
inputs.vim-tidal-src.url = "github:tidalcycles/vim-tidal";
};
# Minimap
minimap-vim = {
url = "github:wfxr/minimap.vim";
flake = false;
};
codewindow-nvim = {
url = "github:gorbit99/codewindow.nvim";
flake = false;
};
# Notifications
nvim-notify = {
url = "github:rcarriga/nvim-notify";
flake = false;
};
# Utilities
colorizer = {
url = "github:uga-rosa/ccc.nvim";
flake = false;
};
venn-nvim = {
url = "github:jbyuki/venn.nvim";
flake = false;
};
icon-picker-nvim = {
url = "github:ziontee113/icon-picker.nvim";
flake = false;
};
which-key = {
url = "github:folke/which-key.nvim";
flake = false;
};
cheatsheet-nvim = {
url = "github:sudormrfbin/cheatsheet.nvim";
flake = false;
};
gesture-nvim = {
url = "github:notomo/gesture.nvim";
flake = false;
};
# Note-taking
obsidian-nvim = {
url = "github:epwalsh/obsidian.nvim";
flake = false;
};
orgmode-nvim = {
url = "github:nvim-orgmode/orgmode";
flake = false;
};
# Terminal
toggleterm-nvim = {
url = "github:akinsho/toggleterm.nvim";
flake = false;
};
# UI
noice-nvim = {
url = "github:folke/noice.nvim";
flake = false;
};
# Assistant
copilot-lua = {
url = "github:zbirenbaum/copilot.lua";
flake = false;
};
tabnine-nvim = {
url = "github:codota/tabnine-nvim";
flake = false;
};
# Session management
nvim-session-manager = {
url = "github:Shatur/neovim-session-manager";
flake = false;
};
# Dependencies
plenary-nvim = {
# (required by crates-nvim)
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
dressing-nvim = {
# (required by icon-picker-nvim)
url = "github:stevearc/dressing.nvim";
flake = false;
};
vim-markdown = {
# (required by obsidian-nvim)
url = "github:preservim/vim-markdown";
flake = false;
};
tabular = {
# (required by vim-markdown)
url = "github:godlygeek/tabular";
flake = false;
};
nui-nvim = {
# (required by noice.nvim)
url = "github:MunifTanjim/nui.nvim";
flake = false;
};
};
}

View file

@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.assistant.copilot;
in {
options.vim.assistant.copilot = {
enable = mkEnableOption "Enable GitHub Copilot";
};
config = mkIf cfg.enable {
vim.startPlugins = ["copilot-lua"];
vim.luaConfigRC.copilot = nvim.dag.entryAnywhere ''
require("copilot").setup({
-- available options: https://github.com/zbirenbaum/copilot.lua
})
'';
};
}

View file

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

View file

@ -0,0 +1,28 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.assistant.tabnine;
in {
options.vim.assistant.tabnine = {
enable = mkEnableOption "Enable TabNine assistant";
};
config = mkIf cfg.enable {
vim.startPlugins = ["tabnine-nvim"];
vim.luaConfigRC.tabnine-nvim = nvim.dag.entryAnywhere ''
require('tabnine').setup({
disable_auto_comment=true,
accept_keymap="<Tab>",
dismiss_keymap = "<C-]>",
debounce_ms = 800,
execlude_filetypes = {"TelescopePrompt", "NvimTree", "alpha"}
})
'';
};
}

222
modules/dashboard/alpha.nix Normal file
View file

@ -0,0 +1,222 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.dashboard.alpha;
in {
options.vim.dashboard.alpha = {
enable = mkEnableOption "alpha";
};
config = mkIf cfg.enable {
vim.startPlugins = [
"alpha-nvim"
];
# the credit for this configuration goes to https://github.com/Rishabh672003
# good work, honestly
vim.luaConfigRC.alpha = nvim.dag.entryAnywhere ''
local alpha = require("alpha")
local plenary_path = require("plenary.path")
local dashboard = require("alpha.themes.dashboard")
local cdir = vim.fn.getcwd()
local if_nil = vim.F.if_nil
local nvim_web_devicons = {
enabled = true,
highlight = true,
}
local function get_extension(fn)
local match = fn:match("^.+(%..+)$")
local ext = ""
if match ~= nil then
ext = match:sub(2)
end
return ext
end
local function icon(fn)
local nwd = require("nvim-web-devicons")
local ext = get_extension(fn)
return nwd.get_icon(fn, ext, { default = true })
end
local function file_button(fn, sc, short_fn)
short_fn = short_fn or fn
local ico_txt
local fb_hl = {}
if nvim_web_devicons.enabled then
local ico, hl = icon(fn)
local hl_option_type = type(nvim_web_devicons.highlight)
if hl_option_type == "boolean" then
if hl and nvim_web_devicons.highlight then
table.insert(fb_hl, { hl, 0, 3 })
end
end
if hl_option_type == "string" then
table.insert(fb_hl, { nvim_web_devicons.highlight, 0, 3 })
end
ico_txt = ico .. " "
else
ico_txt = ""
end
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, "<cmd>e " .. fn .. " <CR>")
local fn_start = short_fn:match(".*[/\\]")
if fn_start ~= nil then
table.insert(fb_hl, { "Comment", #ico_txt - 2, #fn_start + #ico_txt })
end
file_button_el.opts.hl = fb_hl
return file_button_el
end
local default_mru_ignore = { "gitcommit" }
local mru_opts = {
ignore = function(path, ext)
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
end,
}
--- @param start number
--- @param cwd string optional
--- @param items_number number optional number of items to generate, default = 10
local function mru(start, cwd, items_number, opts)
opts = opts or mru_opts
items_number = if_nil(items_number, 15)
local oldfiles = {}
for _, v in pairs(vim.v.oldfiles) do
if #oldfiles == items_number then
break
end
local cwd_cond
if not cwd then
cwd_cond = true
else
cwd_cond = vim.startswith(v, cwd)
end
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then
oldfiles[#oldfiles + 1] = v
end
end
local target_width = 35
local tbl = {}
for i, fn in ipairs(oldfiles) do
local short_fn
if cwd then
short_fn = vim.fn.fnamemodify(fn, ":.")
else
short_fn = vim.fn.fnamemodify(fn, ":~")
end
if #short_fn > target_width then
short_fn = plenary_path.new(short_fn):shorten(1, { -2, -1 })
if #short_fn > target_width then
short_fn = plenary_path.new(short_fn):shorten(1, { -1 })
end
end
local shortcut = tostring(i + start - 1)
local file_button_el = file_button(fn, shortcut, short_fn)
tbl[i] = file_button_el
end
return {
type = "group",
val = tbl,
opts = {},
}
end
local default_header = {
type = "text",
val = {
[[ ]],
[[ ]],
[[ ]],
[[ ]],
[[ ]],
-- [[ __ ]],
-- [[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
-- [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
-- [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
-- [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
-- [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
},
opts = {
position = "center",
hl = "Type",
-- wrap = "overflow";
},
}
local section_mru = {
type = "group",
val = {
{
type = "text",
val = "Recent files",
opts = {
hl = "SpecialComment",
shrink_margin = false,
position = "center",
},
},
{ type = "padding", val = 1 },
{
type = "group",
val = function()
return { mru(0, cdir) }
end,
opts = { shrink_margin = false },
},
},
}
local buttons = {
type = "group",
val = {
{ type = "text", val = "Quick links", opts = { hl = "SpecialComment", position = "center" } },
{ type = "padding", val = 1 },
dashboard.button("e", " New file", "<cmd>ene<CR>"),
dashboard.button("SPC F", " Find file"),
dashboard.button("SPC ff", " Live grep"),
dashboard.button("SPC p", " Projects"),
dashboard.button("q", " Quit", "<cmd>qa<CR>"),
},
position = "center",
}
local config = {
layout = {
{ type = "padding", val = 2 },
default_header,
{ type = "padding", val = 2 },
section_mru,
{ type = "padding", val = 2 },
buttons,
},
opts = {
margin = 5,
setup = function()
vim.cmd([[
autocmd alpha_temp DirChanged * lua require('alpha').redraw()
]])
end,
},
}
alpha.setup(config)
'';
};
}

View file

@ -0,0 +1,25 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.dashboard.dashboard-nvim;
in {
options.vim.dashboard.dashboard-nvim = {
enable = mkEnableOption "dashboard-nvim";
};
config = mkIf cfg.enable {
vim.startPlugins = [
"dashboard-nvim"
];
vim.luaConfigRC.dashboard-nvim = nvim.dag.entryAnywhere ''
require("dashboard").setup{
}
'';
};
}

View file

@ -0,0 +1,12 @@
{
pkgs,
config,
lib,
...
}: {
imports = [
./alpha.nix
./dashboard-nvim.nix
./startify.nix
];
}

View file

@ -0,0 +1,236 @@
{
pkgs,
config,
lib,
...
}:
with builtins;
with lib; let
cfg = config.vim.dashboard.startify;
mkVimBool = val:
if val
then "1"
else "0";
in {
options.vim.dashboard.startify = {
enable = mkEnableOption "Enable startify";
bookmarks = mkOption {
default = [];
description = ''List of book marks to disaply on start page'';
type = with types; listOf attrs;
example = {"c" = "~/.vimrc";};
};
changeToDir = mkOption {
default = true;
description = "Should vim change to the directory of the file you open";
type = types.bool;
};
changeToVCRoot = mkOption {
default = false;
description = "Should vim change to the version control root when opening a file";
type = types.bool;
};
changeDirCmd = mkOption {
default = "lcd";
description = "Command to change the current window with. Can be cd, lcd or tcd";
type = types.enum ["cd" "lcd" "tcd"];
};
customHeader = mkOption {
default = [];
description = "Text to place in the header";
type = with types; listOf str;
};
customFooter = mkOption {
default = [];
description = "Text to place in the footer";
type = with types; listOf str;
};
lists = mkOption {
default = [
{
type = "files";
header = ["MRU"];
}
{
type = "dir";
header = ["MRU Current Directory"];
}
{
type = "sessions";
header = ["Sessions"];
}
{
type = "bookmarks";
header = ["Bookmarks"];
}
{
type = "commands";
header = ["Commands"];
}
];
description = "Specify the lists and in what order they are displayed on startify.";
type = with types; listOf attrs;
};
skipList = mkOption {
default = [];
description = "List of regex patterns to exclude from MRU lists";
type = with types; listOf str;
};
updateOldFiles = mkOption {
default = false;
description = "Set if you want startify to always update and not just when neovim closes";
type = types.bool;
};
sessionAutoload = mkOption {
default = false;
description = "Make startify auto load Session.vim files from the current directory";
type = types.bool;
};
commands = mkOption {
default = [];
description = "Commands that are presented to the user on startify page";
type = with types; listOf (oneOf [str attrs (listOf str)]);
};
filesNumber = mkOption {
default = 10;
description = "How many files to list";
type = types.int;
};
customIndices = mkOption {
default = [];
description = "Specify a list of default charecters to use instead of numbers";
type = with types; listOf str;
};
disableOnStartup = mkOption {
default = false;
description = "Prevent startify from opening on startup but can be called with :Startify";
type = types.bool;
};
unsafe = mkOption {
default = false;
description = "Turns on unsafe mode for Startify. Stops resolving links, checking files are readable and filtering bookmark list";
type = types.bool;
};
paddingLeft = mkOption {
default = 3;
description = "Number of spaces used for left padding.";
type = types.int;
};
useEnv = mkOption {
default = false;
description = "Show environment variables in path if name is shorter than value";
type = types.bool;
};
sessionBeforeSave = mkOption {
default = [];
description = "Commands to run before saving a session";
type = with types; listOf str;
};
sessionPersistence = mkOption {
default = false;
description = "Persist session before leaving vim or switching session";
type = types.bool;
};
sessionDeleteBuffers = mkOption {
default = true;
description = "Delete all buffers when loading or closing a session";
type = types.bool;
};
sessionDir = mkOption {
default = "~/.vim/session";
description = "Directory to save and load sessions from";
type = types.str;
};
skipListServer = mkOption {
default = [];
description = "List of vim servers to not load startify for";
type = with types; listOf str;
};
sessionRemoveLines = mkOption {
default = [];
description = "Patterns to remove from session files";
type = with types; listOf str;
};
sessionSavevars = mkOption {
default = [];
description = "List of variables to save into a session file.";
type = with types; listOf str;
};
sessionSavecmds = mkOption {
default = [];
description = "List of commands to run when loading a session.";
type = with types; listOf str;
};
sessionSort = mkOption {
default = false;
description = "Set if you want items sorted by date rather than alphabetically";
type = types.bool;
};
};
config = mkIf (cfg.enable) {
vim.startPlugins = with pkgs.neovimPlugins; [vim-startify];
vim.globals = {
"startify_custom_header" =
if cfg.customHeader == []
then null
else cfg.customHeader;
"startify_custom_footer" =
if cfg.customFooter == []
then null
else cfg.customFooter;
"startify_bookmarks" = cfg.bookmarks;
"startify_lists" = cfg.lists;
"startify_change_to_dir" = mkVimBool cfg.changeToDir;
"startify_change_to_vcs_root" = mkVimBool cfg.changeToVCRoot;
"startify_change_cmd" = cfg.changeDirCmd;
"startify_skiplist" = cfg.skipList;
"startify_update_oldfiles" = mkVimBool cfg.updateOldFiles;
"startify_session_autoload" = mkVimBool cfg.sessionAutoload;
"startify_commands" = cfg.commands;
"startify_files_number" = cfg.filesNumber;
"startify_custom_indices" = cfg.customIndices;
"startify_disable_at_vimenter" = mkVimBool cfg.disableOnStartup;
"startify_enable_unsafe" = mkVimBool cfg.unsafe;
"startify_padding_left" = cfg.paddingLeft;
"startify_use_env" = mkVimBool cfg.useEnv;
"startify_session_before_save" = cfg.sessionBeforeSave;
"startify_session_persistence" = mkVimBool cfg.sessionPersistence;
"startify_session_delete_buffers" = mkVimBool cfg.sessionDeleteBuffers;
"startify_session_dir" = cfg.sessionDir;
"startify_skiplist_server" = cfg.skipListServer;
"startify_session_remove_lines" = cfg.sessionRemoveLines;
"startify_session_savevars" = cfg.sessionSavevars;
"startify_session_savecmds" = cfg.sessionSavecmds;
"startify_session_sort" = mkVimBool cfg.sessionSort;
};
};
}

View file

@ -57,18 +57,6 @@ in {
type = with types; listOf str;
};
closeOnFileOpen = mkOption {
default = false;
description = "Closes the tree when a file is opened.";
type = types.bool;
};
resizeOnFileOpen = mkOption {
default = false;
description = "Resizes the tree when opening a file.";
type = types.bool;
};
followBufferFile = mkOption {
default = true;
description = "Follow file that is in current buffer on tree";
@ -128,6 +116,266 @@ in {
description = "The command used to open a file with the associated default program";
type = types.str;
};
updateCwd = mkOption {
# updateCwd has been deprecated in favor of syncRootWithCwd
# this option is kept for backwards compatibility
default = true;
description = "Updates the tree when changing nvim's directory (DirChanged event).";
type = types.bool;
};
ignore_ft_on_setup = mkOption {
default = [];
description = "Ignore file types on setup";
type = with types; listOf str;
};
hijackCursor = mkOption {
default = true;
description = "Hijack the cursor in the tree to put it at the start of the filename";
type = types.bool;
};
hijackUnnamedBufferWhenOpening = mkOption {
default = false;
description = "Open nvimtree in place of the unnamed buffer if it's empty.";
type = types.bool;
};
syncRootWithCwd = mkOption {
default = true;
description = "Changes the tree root directory on `DirChanged` and refreshes the tree";
type = types.bool;
};
updateFocusedFile = mkOption {
default = {
enable = true;
update_cwd = true;
};
description = "Updates the tree when changing nvim's directory (DirChanged event).";
type = with types; attrsOf (either bool (attrsOf bool));
};
view = {
adaptiveSize = mkOption {
default = true;
description = "Resize the tree when the window is resized";
type = types.bool;
};
side = mkOption {
default = "left";
description = "Side the tree will appear on left or right";
type = types.enum ["left" "right"];
};
width = mkOption {
default = 35;
description = "Width of the tree in charecters";
type = types.int;
};
hideRootFolder = mkOption {
default = false;
description = "Hide the root folder";
type = types.bool;
};
};
git = {
enable = mkEnableOption "Git integration";
ignore = mkOption {
default = true;
description = "Ignore files in git";
type = types.bool;
};
};
filesystemWatchers = {
enable = mkOption {
default = true;
description = "Enable filesystem watchers";
type = types.bool;
};
};
actions = {
openFile = {
resizeWindow = mkOption {
default = true;
description = "Resize the tree when opening a file";
type = types.bool;
};
quitOnOpen = mkOption {
default = false;
description = "Quit the tree when opening a file";
type = types.bool;
};
};
};
renderer = {
higlightGit = mkOption {
default = false;
description = "Highlight git related files";
type = types.bool;
};
highlightOpenedFiles = mkOption {
default = "none";
description = "Highlight opened files";
type = types.enum ["none" "icon" "name" "all"];
};
indentMarkers = mkOption {
default = false;
description = "Show indent markers";
type = types.bool;
};
showHiddenFiles = mkOption {
default = true;
description = "Show hidden files";
type = types.bool;
};
trailingSlash = mkOption {
default = false;
description = "Add a trailing slash to all folders";
type = types.bool;
};
showParentFolder = mkOption {
default = false;
description = "Show parent folder";
type = types.bool;
};
groupEmptyFolders = mkOption {
default = false;
description = "Compact empty folders trees into a single item";
type = types.bool;
};
icons = {
show = {
file = mkOption {
default = true;
description = "Show file icons";
type = types.bool;
};
folder = mkOption {
default = true;
description = "Show folder icons";
type = types.bool;
};
folderArrow = mkOption {
default = true;
description = "Show folder arrow icons";
type = types.bool;
};
git = mkOption {
default = false;
description = "Show git icons";
type = types.bool;
};
};
glyphs = {
default = mkOption {
default = "";
description = "Default icon";
type = types.str;
};
symlink = mkOption {
default = "";
description = "Symlink icon";
type = types.str;
};
folder = {
default = mkOption {
default = "";
description = "Default folder icon";
type = types.str;
};
open = mkOption {
default = "";
description = "Open folder icon";
type = types.str;
};
empty = mkOption {
default = "";
description = "Empty folder icon";
type = types.str;
};
emptyOpen = mkOption {
default = "";
description = "Empty open folder icon";
type = types.str;
};
symlink = mkOption {
default = "";
description = "Symlink folder icon";
type = types.str;
};
symlinkOpen = mkOption {
default = "";
description = "Symlink open folder icon";
type = types.str;
};
arrowOpen = mkOption {
default = "";
description = "Open folder arrow icon";
type = types.str;
};
arrowClosed = mkOption {
default = "";
description = "Closed folder arrow icon";
type = types.str;
};
};
git = {
unstaged = mkOption {
default = "";
description = "Unstaged git icon";
type = types.str;
};
staged = mkOption {
default = "";
description = "Staged git icon";
type = types.str;
};
unmerged = mkOption {
default = "";
description = "Unmerged git icon";
type = types.str;
};
renamed = mkOption {
default = "";
description = "Renamed git icon";
type = types.str;
};
untracked = mkOption {
default = "";
description = "Untracked git icon";
type = types.str;
};
deleted = mkOption {
default = "";
description = "Deleted git icon";
type = types.str;
};
ignored = mkOption {
default = "";
description = "Ignored git icon";
type = types.str;
};
};
};
};
};
};
config = mkIf cfg.enable {
@ -144,36 +392,57 @@ in {
require'nvim-tree'.setup({
disable_netrw = ${boolToString cfg.disableNetRW},
hijack_netrw = ${boolToString cfg.hijackNetRW},
hijack_cursor = ${boolToString cfg.hijackCursor},
open_on_tab = ${boolToString cfg.openTreeOnNewTab},
open_on_setup = ${boolToString cfg.openOnSetup},
open_on_setup_file = ${boolToString cfg.openOnSetup},
-- FIXME: Open on startup has been deprecated
-- needs an alternative, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup3
-- open_on_setup = ${boolToString cfg.openOnSetup},
-- open_on_setup_file = ${boolToString cfg.openOnSetup},
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
update_focused_file = {
enable = ${boolToString cfg.updateFocusedFile.enable},
update_cwd = ${boolToString cfg.updateFocusedFile.update_cwd},
},
view = {
width = ${toString cfg.view.width},
side = ${"'" + cfg.view.side + "'"},
adaptive_size = ${boolToString cfg.view.adaptiveSize},
hide_root_folder = ${boolToString cfg.view.hideRootFolder},
},
git = {
enable = ${boolToString cfg.git.enable},
ignore = ${boolToString cfg.git.ignore},
},
filesystem_watchers = {
enable = ${boolToString cfg.filesystemWatchers.enable},
},
actions = {
open_file = {
quit_on_open = ${boolToString cfg.actions.openFile.quitOnOpen},
resize_window = ${boolToString cfg.actions.openFile.resizeWindow},
},
},
renderer = {
highlight_git = ${boolToString cfg.renderer.higlightGit},
highlight_opened_files = ${"'" + cfg.renderer.highlightOpenedFiles + "'"},
indent_markers = {
enable = ${boolToString cfg.renderer.indentMarkers},
},
-- TODO: those two
add_trailing = ${boolToString cfg.renderer.trailingSlash},
group_empty = ${boolToString cfg.renderer.groupEmptyFolders},
},
system_open = {
cmd = ${"'" + cfg.systemOpenCmd + "'"},
},
diagnostics = {
enable = ${boolToString cfg.lspDiagnostics},
},
view = {
width = ${toString cfg.treeWidth},
side = ${"'" + cfg.treeSide + "'"},
},
renderer = {
indent_markers = {
enable = ${boolToString cfg.indentMarkers},
},
add_trailing = ${boolToString cfg.trailingSlash},
group_empty = ${boolToString cfg.groupEmptyFolders},
},
actions = {
open_file = {
quit_on_open = ${boolToString cfg.closeOnFileOpen},
resize_window = ${boolToString cfg.resizeOnFileOpen},
},
},
git = {
enable = true,
ignore = ${boolToString cfg.hideIgnoredGitFiles},
},
filters = {
dotfiles = ${boolToString cfg.hideDotFiles},
custom = {

View file

@ -1,6 +0,0 @@
{
config,
lib,
pkgs,
...
}: {imports = [./which-key.nix];}

View file

@ -1,24 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.keys;
in {
options.vim.keys = {
enable = mkEnableOption "key binding plugins";
whichKey = {
enable = mkEnableOption "which-key menu";
};
};
config = mkIf (cfg.enable && cfg.whichKey.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''local wk = require("which-key").setup {}'';
};
}

View file

@ -16,62 +16,64 @@ in {
isDag = dag:
builtins.isAttrs dag && all nvim.dag.isEntry (builtins.attrValues dag);
# Takes an attribute set containing entries built by entryAnywhere,
# entryAfter, and entryBefore to a topologically sorted list of
# entries.
#
# Internally this function uses the `toposort` function in
# `<nixpkgs/lib/lists.nix>` and its value is accordingly.
#
# Specifically, the result on success is
#
# { result = [ { name = ?; data = ?; } … ] }
#
# For example
#
# nix-repl> topoSort {
# a = entryAnywhere "1";
# b = entryAfter [ "a" "c" ] "2";
# c = entryBefore [ "d" ] "3";
# d = entryBefore [ "e" ] "4";
# e = entryAnywhere "5";
# } == {
# result = [
# { data = "1"; name = "a"; }
# { data = "3"; name = "c"; }
# { data = "2"; name = "b"; }
# { data = "4"; name = "d"; }
# { data = "5"; name = "e"; }
# ];
# }
# true
#
# And the result on error is
#
# {
# cycle = [ { after = ?; name = ?; data = ? } … ];
# loops = [ { after = ?; name = ?; data = ? } … ];
# }
#
# For example
#
# nix-repl> topoSort {
# a = entryAnywhere "1";
# b = entryAfter [ "a" "c" ] "2";
# c = entryAfter [ "d" ] "3";
# d = entryAfter [ "b" ] "4";
# e = entryAnywhere "5";
# } == {
# cycle = [
# { after = [ "a" "c" ]; data = "2"; name = "b"; }
# { after = [ "d" ]; data = "3"; name = "c"; }
# { after = [ "b" ]; data = "4"; name = "d"; }
# ];
# loops = [
# { after = [ "a" "c" ]; data = "2"; name = "b"; }
# ];
# }
# true
/*
Takes an attribute set containing entries built by entryAnywhere,
entryAfter, and entryBefore to a topologically sorted list of
entries.
Internally this function uses the `toposort` function in
`<nixpkgs/lib/lists.nix>` and its value is accordingly.
Specifically, the result on success is
{ result = [ { name = ?; data = ?; } ] }
For example
nix-repl> topoSort {
a = entryAnywhere "1";
b = entryAfter [ "a" "c" ] "2";
c = entryBefore [ "d" ] "3";
d = entryBefore [ "e" ] "4";
e = entryAnywhere "5";
} == {
result = [
{ data = "1"; name = "a"; }
{ data = "3"; name = "c"; }
{ data = "2"; name = "b"; }
{ data = "4"; name = "d"; }
{ data = "5"; name = "e"; }
];
}
true
And the result on error is
{
cycle = [ { after = ?; name = ?; data = ? } ];
loops = [ { after = ?; name = ?; data = ? } ];
}
For example
nix-repl> topoSort {
a = entryAnywhere "1";
b = entryAfter [ "a" "c" ] "2";
c = entryAfter [ "d" ] "3";
d = entryAfter [ "b" ] "4";
e = entryAnywhere "5";
} == {
cycle = [
{ after = [ "a" "c" ]; data = "2"; name = "b"; }
{ after = [ "d" ]; data = "3"; name = "c"; }
{ after = [ "b" ]; data = "4"; name = "d"; }
];
loops = [
{ after = [ "a" "c" ]; data = "2"; name = "b"; }
];
}
true
*/
topoSort = dag: let
dagBefore = dag: name:
builtins.attrNames

View file

@ -1,7 +1,8 @@
{lib}:
with lib; let
# Plugin must be same as input name
# Plugin must be same as input name from flake.nix
availablePlugins = [
# TODO: sort by category
"nvim-treesitter-context"
"gitsigns-nvim"
"plenary-nvim"
@ -40,8 +41,33 @@ with lib; let
"rust-tools"
"onedark"
"catppuccin"
"minimap-vim"
"dashboard-nvim"
"alpha-nvim"
"scrollbar-nvim"
"codewindow-nvim"
"nvim-notify"
"cinnamon-nvim"
"cheatsheet-nvim"
"colorizer"
"venn-nvim"
"cellular-automaton"
"presence-nvim"
"icon-picker-nvim"
"dressing-nvim"
"orgmode-nvim"
"obsidian-nvim"
"vim-markdown"
"tabular"
"toggleterm-nvim"
"noice-nvim"
"nui-nvim"
"copilot-lua"
"tabnine-nvim"
"nvim-session-manager"
"gesture-nvim"
];
# You can either use the name of the plugin or a package.
pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package));
in {
pluginsOpt = {

View file

@ -5,7 +5,6 @@
...
}: {
imports = [
./config.nix
./glow.nix
./glow
];
}

View file

@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.minimap.codewindow;
in {
options.vim.minimap.codewindow = {
enable = mkEnableOption "Enable minimap-vim plugin";
};
config = mkIf cfg.enable {
vim.startPlugins = [
"codewindow-nvim"
];
vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere ''
local codewindow = require('codewindow')
codewindow.setup({
exclude_filetypes = { 'NvimTree', 'orgagenda'},
}
)
codewindow.apply_default_keybinds()
'';
};
}

View file

@ -0,0 +1,11 @@
{
pkgs,
lib,
config,
...
}: {
imports = [
./minimap-vim.nix
./codewindow.nix
];
}

View file

@ -0,0 +1,21 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.minimap.minimap-vim;
in {
options.vim.minimap.minimap-vim = {
enable = mkEnableOption "Enable minimap-vim plugin";
};
config = mkIf cfg.enable {
vim.startPlugins = [
pkgs.code-minimap
"minimap-vim"
];
};
}

View file

@ -17,10 +17,18 @@
./tidal
./autopairs
./snippets
./keys
./markdown
./telescope
./git
./minimap
./dashboard
./notifications
./utility
./presence
./notes
./terminal
./ui
./assistant
./session
];
pkgsModule = {config, ...}: {

View file

@ -0,0 +1,6 @@
_: {
imports = [
./obsidian
./orgmode
];
}

View file

@ -0,0 +1,51 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.notes.obsidian;
auto = config.vim.autocomplete;
in {
options.vim.notes = {
obsidian = {
enable = mkEnableOption "Complementary neovim plugins for Obsidian editor";
dir = mkOption {
type = types.str;
default = "~/my-vault";
description = "Obsidian vault directory";
};
completion = {
nvim_cmp = mkOption {
# if using nvim-cmp, otherwise set to false
type = types.bool;
description = "If using nvim-cmp, otherwise set to false";
};
};
};
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"obsidian-nvim"
"vim-markdown"
"tabular"
];
vim.luaConfigRC.obsidian = nvim.dag.entryAnywhere ''
require("obsidian").setup({
dir = "${cfg.dir}",
completion = {
nvim_cmp = ${
if (auto.type == "nvim-cmp")
then "true"
else "false"
}
}
})
'';
};
}

View file

@ -0,0 +1,56 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.notes.orgmode;
in {
options.vim.notes = {
orgmode = {
enable = mkEnableOption "Neovim plugin for Emac Orgmode. Get the best of both worlds.";
orgAgendaFiles = mkOption {
type = types.str;
default = "{'~/Dropbox/org/*', '~/my-orgs/**/*'}";
description = "List of org files to be used as agenda files.";
};
orgDefaultNotesFile = mkOption {
type = types.str;
default = "~/Dropbox/org/refile.org";
description = "Default org file to be used for notes.";
};
};
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"orgmode-nvim"
];
vim.luaConfigRC.orgmode = nvim.dag.entryAnywhere ''
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
-- Treesitter configuration
require('nvim-treesitter.configs').setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = {'org'},
},
ensure_installed = {'org'}, -- Or run :TSUpdate org
}
require('orgmode').setup({
org_agenda_files = ${cfg.orgAgendaFiles},
org_default_notes_file = '${cfg.orgDefaultNotesFile}',
})
'';
};
}

View file

@ -0,0 +1,5 @@
_: {
imports = [
./nvim-notify.nix
];
}

View file

@ -0,0 +1,34 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.notify.nvim-notify;
in {
options.vim.notify.nvim-notify = {
enable = mkEnableOption "Enable nvim-notify plugin";
};
config = mkIf cfg.enable {
vim.startPlugins = ["nvim-notify"];
vim.luaConfigRC.nvim-notify = nvim.dag.entryAnywhere ''
require('notify').setup {
stages = 'fade_in_slide_out',
timeout = 1000,
background_colour = '#000000',
position = 'top_right',
icons = {
ERROR = '',
WARN = '',
INFO = '',
DEBUG = '',
TRACE = '',
},
}
'';
};
}

View file

@ -0,0 +1,5 @@
_: {
imports = [
./discord-nvim.nix
];
}

View file

@ -0,0 +1,45 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.presence.presence-nvim;
in {
options.vim.presence.presence-nvim = {
enable = mkEnableOption "Enable presence.nvim plugin";
};
config = mkIf cfg.enable {
vim.startPlugins = ["presence-nvim"];
vim.luaConfigRC.presence-nvim = nvim.dag.entryAnywhere ''
-- Description of each option can be found in https://github.com/andweeb/presence.nvim444
require("presence").setup({
-- General options
auto_update = true,
neovim_image_text = "The One True Text Editor",
main_image = "neovim",
client_id = "793271441293967371",
log_level = nil,
debounce_timeout = 10,
enable_line_number = false,
blacklist = {},
buttons = true,
file_assets = {},
show_time = true,
-- Rich Presence text options
editing_text = "Editing %s",
file_explorer_text = "Browsing %s",
git_commit_text = "Committing changes",
plugin_manager_text = "Managing plugins",
reading_text = "Reading %s",
workspace_text = "Working on %s",
line_number_text = "Line %s out of %s",
})
'';
};
}

View file

@ -0,0 +1,5 @@
_: {
imports = [
./nvim-session-manager.nix
];
}

View file

@ -0,0 +1,22 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.session.nvim-session-manager;
in {
options.vim.session.nvim-session-manager = {
enable = mkEnableOption "Enable nvim-session-manager";
};
config = mkIf cfg.enable {
vim.startPlugins = ["nvim-session-manager"];
vim.luaConfigRC.nvim-session-manager = nvim.dag.entryAnywhere ''
require('session_manager').setup({})
'';
};
}

View file

@ -1,65 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib; {
config = {
vim.statusline.lualine = {
enable = mkDefault false;
icons = mkDefault true;
theme = mkDefault "auto";
sectionSeparator = {
left = mkDefault "";
right = mkDefault "";
};
componentSeparator = {
left = mkDefault "";
right = mkDefault "";
};
activeSection = {
a = mkDefault "{'mode'}";
b = ''
{
{
"branch",
separator = '',
},
"diff",
}
'';
c = mkDefault "{'filename'}";
x = mkDefault ''
{
{
"diagnostics",
sources = {'nvim_lsp'},
separator = '',
symbols = {error = '', warn = '', info = '', hint = ''},
},
{
"filetype",
},
"fileformat",
"encoding",
}
'';
y = mkDefault "{'progress'}";
z = mkDefault "{'location'}";
};
inactiveSection = {
a = mkDefault "{}";
b = mkDefault "{}";
c = mkDefault "{'filename'}";
x = mkDefault "{'location'}";
y = mkDefault "{}";
z = mkDefault "{}";
};
};
};
}

View file

@ -5,7 +5,6 @@
...
}: {
imports = [
./lualine.nix
./config.nix
./lualine
];
}

View file

@ -0,0 +1,94 @@
{
pkgs,
config,
lib,
...
}:
with lib; {
config = {
vim.statusline.lualine = {
enable = mkDefault false;
icons = mkDefault true;
theme = mkDefault "auto";
sectionSeparator = {
left = mkDefault "";
right = mkDefault "";
};
componentSeparator = {
left = mkDefault "";
right = mkDefault "";
};
activeSection = {
# left side of the statusline 4
a = mkDefault "{'mode'}";
b = mkDefault ''
{
{
"filename",
color = {bg='none'},
symbols = {modified = '', readonly = ''},
},
}
'';
c = mkDefault ''
{
{
"branch",
icon = ' ',
separator = { left = '(', right = ')'},
},
}
'';
# right side of the statusline (x, y, z)
x = mkDefault ''
{
{
"diagnostics",
sources = {'nvim_lsp', 'nvim_diagnostic'},
symbols = {error = '', warn = '', info = '', hint = ''}
},
}
'';
y = mkDefault ''
{
{
"fileformat",
color = {bg='none'}
},
}
'';
z = mkDefault ''
{
{
"progress",
color = {
bg='none',
fg='lavender'
}
},
{
"location",
color = {bg='none', fg='lavender'},
},
{
"filetype",
color = {bg='none', fg='lavender'},
},
}
'';
};
inactiveSection = {
a = mkDefault "{}";
b = mkDefault "{}";
c = mkDefault "{'filename'}";
x = mkDefault "{'location'}";
y = mkDefault "{}";
z = mkDefault "{}";
};
};
};
}

View file

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

View file

@ -7,7 +7,7 @@
with lib;
with builtins; let
cfg = config.vim.statusline.lualine;
supported_themes = import ./supported_lualine_themes.nix;
supported_themes = import ./supported_themes.nix;
in {
options.vim.statusline.lualine = {
enable = mkOption {
@ -175,7 +175,7 @@ in {
theme = "${cfg.theme}",
component_separators = {"${cfg.componentSeparator.left}","${cfg.componentSeparator.right}"},
section_separators = {"${cfg.sectionSeparator.left}","${cfg.sectionSeparator.right}"},
disabled_filetypes = {},
disabled_filetypes = { 'packer', 'NvimTree', 'alpha' }
},
sections = {
lualine_a = ${cfg.activeSection.a},

View file

@ -0,0 +1,5 @@
_: {
imports = [
./toggleterm.nix
];
}

View file

@ -0,0 +1,51 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.terminal.toggleterm;
in {
options.vim.terminal.toggleterm = {
enable = mkEnableOption "Enable toggleterm as a replacement to built-in terminal command";
direction = mkOption {
type = types.enum ["horizontal" "vertical" "tab" "float"];
default = "float";
description = "Direction of the terminal";
};
enable_winbar = mkOption {
type = types.bool;
default = false;
description = "Enable winbar";
};
};
config = mkIf cfg.enable {
vim.startPlugins = [
"toggleterm-nvim"
];
vim.luaConfigRC.toggleterm = nvim.dag.entryAnywhere ''
require("toggleterm").setup({
open_mapping = [[<c-t>]],
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
},
})
'';
};
}

View file

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
with lib; {
config = {
vim.theme = {

View file

@ -1,33 +1,47 @@
{
onedark = {
setup = { style ? "dark" }: ''
setup = {style ? "dark"}: ''
-- OneDark theme
require('onedark').setup {
style = "${style}"
}
require('onedark').load()
'';
styles = [ "dark" "darker" "cool" "deep" "warm" "warmer" ];
styles = ["dark" "darker" "cool" "deep" "warm" "warmer"];
};
tokyonight = {
setup = { style ? "night" }: ''
setup = {style ? "night"}: ''
-- need to set style before colorscheme to apply
vim.g.tokyonight_style = '${style}'
vim.cmd[[colorscheme tokyonight]]
'';
styles = [ "day" "night" "storm" ];
styles = ["day" "night" "storm"];
};
catppuccin = {
setup = { style ? "mocha" }: ''
setup = {style ? "mocha"}: ''
-- Catppuccin theme
require('catppuccin').setup {
flavour = "${style}"
flavour = "${style}",
transparent_background = true,
integrations = {
nvimtree = {
enabled = true,
transparent_panel = false,
show_root = true,
},
hop = true,
gitsigns = true,
telescope = true,
treesitter = true,
ts_rainbow = true,
},
}
-- setup must be called before loading
vim.cmd.colorscheme "catppuccin"
'';
styles = [ "latte" "frappe" "macchiato" "mocha" ];
styles = ["latte" "frappe" "macchiato" "mocha"];
};
}

View file

@ -3,4 +3,8 @@
lib,
pkgs,
...
}: {imports = [./tidal.nix];}
}: {
imports = [
./tidal.nix
];
}

View file

@ -29,24 +29,26 @@ in {
grammars = mkOption {
type = with types; listOf package;
default = with (pkgs.vimPlugins.nvim-treesitter.builtGrammars); [
c
cpp
nix
python
rust
markdown
comment
toml
make
tsx
html
javascript
css
graphql
json
zig
];
default = with (pkgs.vimPlugins.nvim-treesitter.builtGrammars);
[
c
cpp
nix
python
rust
markdown
comment
toml
make
tsx
html
javascript
css
graphql
json
zig
]
++ (optional config.vim.notes.orgmode.enable org); # add orgmode grammar if enabled
description = ''
List of treesitter grammars to install.
When enabling a language, its treesitter grammar is added for you.

5
modules/ui/default.nix Normal file
View file

@ -0,0 +1,5 @@
_: {
imports = [
./noice.nix
];
}

67
modules/ui/noice.nix Normal file
View file

@ -0,0 +1,67 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.ui.noice;
in {
options.vim.ui.noice = {
enable = mkEnableOption "noice-nvim";
};
config = mkIf cfg.enable {
vim.startPlugins = [
"noice-nvim"
"nui-nvim"
];
vim.luaConfigRC.noice-nvim = nvim.dag.entryAnywhere ''
require("noice").setup({
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
signature = {
enabled = false, -- FIXME: enabling this file throws an error which I couldn't figure out
},
},
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
format = {
cmdline = { pattern = "^:", icon = "", lang = "vim" },
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
filter = { pattern = "^:%s*!", icon = "", lang = "bash" },
lua = { pattern = "^:%s*lua%s+", icon = "", lang = "lua" },
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
input = {},
},
-- Hide written messages
routes = {
{
filter = {
event = "msg_show",
kind = "",
find = "written",
},
opts = { skip = true },
},
},
})
'';
};
}

View file

@ -0,0 +1,22 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.cheatsheet;
in {
options.vim.binds.cheatsheet = {
enable = mkEnableOption "Searchable cheatsheet for nvim using telescope";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["cheatsheet-nvim"];
vim.luaConfigRC.cheaetsheet-nvim = nvim.dag.entryAnywhere ''
require('cheatsheet').setup({})
'';
};
}

View file

@ -0,0 +1,11 @@
{
config,
lib,
pkgs,
...
}: {
imports = [
./which-key.nix
./cheatsheet.nix
];
}

View file

@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.binds.whichKey;
in {
options.vim.binds.whichKey = {
enable = mkEnableOption "which-key menu";
};
config = mkIf (cfg.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere ''local wk = require("which-key").setup {}'';
};
}

View file

@ -0,0 +1,24 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.colorizer;
in {
options.vim.utility.colorizer = {
enable = mkEnableOption "ccc color picker for neovim";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"colorizer"
];
vim.configRC.ccc =
nvim.dag.entryAnywhere ''
'';
};
}

View file

@ -0,0 +1,10 @@
_: {
imports = [
./binds
./gestures
./telescope
./colorizer.nix
./venn.nix
./icon-picker.nix
];
}

View file

@ -0,0 +1,5 @@
_: {
imports = [
./gesture-nvim.nix
];
}

View file

@ -0,0 +1,55 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.gestures.gesture-nvim;
in {
options.vim.gestures.gesture-nvim = {
enable = mkEnableOption "Enable GitHub Copilot";
};
config = mkIf cfg.enable {
vim.startPlugins = ["gesture-nvim"];
vim.luaConfigRC.gesture-nvim = nvim.dag.entryAnywhere ''
vim.opt.mouse = "a"
vim.keymap.set("n", "<LeftDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true })
vim.keymap.set("n", "<LeftRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true })
-- or if you would like to use right click
-- vim.keymap.set("n", "<RightMouse>", [[<Nop>]])
-- vim.keymap.set("n", "<RightDrag>", [[<Cmd>lua require("gesture").draw()<CR>]], { silent = true })
-- vim.keymap.set("n", "<RightRelease>", [[<Cmd>lua require("gesture").finish()<CR>]], { silent = true })
local gesture = require("gesture")
gesture.register({
name = "scroll to bottom",
inputs = { gesture.up(), gesture.down() },
action = "normal! G",
})
gesture.register({
name = "next tab",
inputs = { gesture.right() },
action = "tabnext",
})
gesture.register({
name = "previous tab",
inputs = { gesture.left() },
action = function(ctx) -- also can use callable
vim.cmd.tabprevious()
end,
})
gesture.register({
name = "go back",
inputs = { gesture.right(), gesture.left() },
-- map to `<C-o>` keycode
action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]],
})
'';
};
}

View file

@ -0,0 +1,27 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.icon-picker;
in {
options.vim.utility.icon-picker = {
enable = mkEnableOption "Nerdfonts icon picker for nvim";
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
"icon-picker-nvim"
"dressing-nvim"
];
vim.luaConfigRC.icon-picker = nvim.dag.entryAnywhere ''
require("icon-picker").setup({
disable_legacy_commands = true
})
'';
};
}

View file

@ -54,7 +54,8 @@ in {
);
vim.luaConfigRC.telescope = nvim.dag.entryAnywhere ''
require("telescope").setup {
local telescope = require('telescope')
telescope.setup {
defaults = {
vimgrep_arguments = {
"${pkgs.ripgrep}/bin/rg",
@ -72,6 +73,18 @@ in {
},
}
}
${
if config.vim.ui.noice.enable
then "telescope.load_extension('noice')"
else null
}
${
if config.vim.notify.nvim-notify.enable
then "telescope.load_extension('notify')"
else null
}
'';
};
}

47
modules/utility/venn.nix Normal file
View file

@ -0,0 +1,47 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.utility.venn-nvim;
in {
options.vim.utility.venn-nvim = {
enable = mkEnableOption "draw ASCII diagrams in Neovim";
};
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,7 +1,8 @@
{ pkgs
, config
, lib
, ...
{
pkgs,
config,
lib,
...
}:
with lib; {
config = {
@ -11,6 +12,10 @@ with lib; {
nvimWebDevicons.enable = mkDefault false;
lspkind.enable = mkDefault false;
scrollBar = {
enable = mkDefault false;
};
cursorWordline = {
enable = mkDefault false;
lineTimeout = mkDefault 500;

View file

@ -24,6 +24,22 @@ in {
description = "enable vscode-like pictograms for lsp [lspkind]";
};
scrollBar.enable = mkOption {
type = types.bool;
description = "enable scrollbar [scrollbar.nvim]";
};
smoothScroll.enable = mkOption {
type = types.bool;
description = "enable smooth scrolling [cinnamon-nvim]";
};
cellularAutomaton.enable = mkOption {
type = types.bool;
description = "enable cellular automaton [cellular-automaton]";
default = false;
};
cursorWordline = {
enable = mkOption {
type = types.bool;
@ -88,6 +104,21 @@ in {
then "indent-blankline"
else null
)
(
if cfg.scrollBar.enable
then "scrollbar-nvim"
else null
)
(
if cfg.smoothScroll.enable
then "cinnamon-nvim"
else null
)
(
if cfg.cellularAutomaton.enable
then "cellular-automaton"
else null
)
];
vim.luaConfigRC.visuals = nvim.dag.entryAnywhere ''
@ -130,6 +161,55 @@ in {
then "vim.g.cursorline_timeout = ${toString cfg.cursorWordline.lineTimeout}"
else ""
}
${
if cfg.scrollBar.enable
then "require('scrollbar').setup{
excluded_filetypes = {
'prompt',
'TelescopePrompt',
'noice',
'NvimTree',
'alpha'
},
}"
else ""
}
${
if cfg.smoothScroll.enable
then "require('cinnamon').setup()"
else ""
}
${
if cfg.cellularAutomaton.enable
then ''
local config = {
fps = 50,
name = 'slide',
}
-- init function is invoked only once at the start
-- config.init = function (grid)
--
-- end
-- update function
config.update = function (grid)
for i = 1, #grid do
local prev = grid[i][#(grid[i])]
for j = 1, #(grid[i]) do
grid[i][j], prev = prev, grid[i][j]
end
end
return true
end
require("cellular-automaton").register_animation(config)
vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
''
else ""
}
'';
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB