summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-09-17 04:54:00 -0400
committerseth <[email protected]>2023-10-07 12:55:41 -0400
commit9d0051e6b4170851ebcc09e7ff44097818c8e1dc (patch)
tree067e1d6b745fc61aeb9b885439482f946bbdf2fe
parente910460767dd835c7fb8aa7a59082e645c207cbd (diff)
start using willruggiano/neovim.nix
-rw-r--r--.github/workflows/build.yaml22
-rw-r--r--.github/workflows/check.yaml25
-rw-r--r--.github/workflows/ci.yaml59
-rw-r--r--.gitignore7
-rw-r--r--.luarc.json3
-rw-r--r--config/plugin/globals.lua1
-rw-r--r--config/plugin/keymaps.lua (renamed from lua/getchoo/keybinds.lua)2
-rw-r--r--config/plugin/options.lua (renamed from lua/getchoo/init.lua)9
-rw-r--r--default.nix30
-rw-r--r--flake.lock202
-rw-r--r--flake.nix132
-rw-r--r--lua/getchoo/plugins/general.lua107
-rw-r--r--lua/getchoo/plugins/init.lua11
-rw-r--r--lua/getchoo/plugins/lazy.lua93
-rw-r--r--lua/getchoo/plugins/lsp.lua183
-rw-r--r--lua/getchoo/plugins/mason.lua7
-rw-r--r--lua/getchoo/plugins/ui.lua40
-rw-r--r--neovim.nix41
-rw-r--r--plugins/bufferline.lua20
-rw-r--r--plugins/catppuccin.lua28
-rw-r--r--plugins/cmp.lua38
-rw-r--r--plugins/default.nix177
-rw-r--r--plugins/dressing.lua11
-rw-r--r--plugins/lspconfig.lua49
-rw-r--r--plugins/lualine.lua8
-rw-r--r--plugins/neo-tree.lua7
-rw-r--r--plugins/noice.lua30
-rw-r--r--plugins/null-ls.lua50
-rw-r--r--shell.nix6
29 files changed, 811 insertions, 587 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
deleted file mode 100644
index 85cd88b..0000000
--- a/.github/workflows/build.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: build plugin
-
-on:
- push:
- branches:
- - main
- pull_request:
- workflow_dispatch:
-
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
- - uses: DeterminateSystems/nix-installer-action@main
- - uses: DeterminateSystems/magic-nix-cache-action@main
-
- - name: run build
- run:
- nix build -L
diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
deleted file mode 100644
index e8f354f..0000000
--- a/.github/workflows/check.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: run checks
-
-on:
- push:
- branches:
- - main
- pull_request:
- workflow_dispatch:
-
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
- - uses: DeterminateSystems/nix-installer-action@main
- - uses: DeterminateSystems/magic-nix-cache-action@main
-
- - name: stylua
- run:
- nix build -L .#checks.x86_64-linux.stylua
-
- - name: flake check
- run: nix flake check --accept-flake-config
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..5391c66
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,59 @@
+name: ci
+
+on:
+ push:
+ branches: ["main"]
+ pull_request:
+ workflow_dispatch:
+
+jobs:
+ build:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ include:
+ - os: ubuntu-latest
+ arch:
+ - "aarch64"
+ - "x86_64"
+
+ runs-on: ${{ matrix.os }}
+ continue-on-error: true
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: setup qemu
+ if: matrix.arch == 'aarch64'
+ run: sudo apt install -y qemu-user-static
+
+ - name: install nix
+ if: matrix.arch != 'aarch64'
+ uses: DeterminateSystems/nix-installer-action@v4
+
+ - name: install nix (with aarch64)
+ if: matrix.arch == 'aarch64'
+ uses: DeterminateSystems/nix-installer-action@v4
+ with:
+ extra-conf: "extra-platforms = aarch64-linux arm-linux"
+
+ - name: setup cache
+ uses: DeterminateSystems/magic-nix-cache-action@v2
+
+ - name: run build
+ run: nix build --accept-flake-config -Lv
+
+ check:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: install nix
+ uses: DeterminateSystems/nix-installer-action@v4
+
+ - name: setup cache
+ uses: DeterminateSystems/magic-nix-cache-action@v2
+
+ - name: run check
+ run: nix flake check --accept-flake-config -Lv
diff --git a/.gitignore b/.gitignore
index ff46ce5..76797ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
-.direnv
+# nix build results
result*
repl-result-out*
-.luarc.json
+
+# dev shell artifacts
+.direnv
+.pre-commit-config.yaml
diff --git a/.luarc.json b/.luarc.json
new file mode 100644
index 0000000..23b9ee2
--- /dev/null
+++ b/.luarc.json
@@ -0,0 +1,3 @@
+{
+ "workspace.checkThirdParty": false
+} \ No newline at end of file
diff --git a/config/plugin/globals.lua b/config/plugin/globals.lua
new file mode 100644
index 0000000..79db9e3
--- /dev/null
+++ b/config/plugin/globals.lua
@@ -0,0 +1 @@
+vim.g.mapleader = ","
diff --git a/lua/getchoo/keybinds.lua b/config/plugin/keymaps.lua
index 7dab12e..8068db9 100644
--- a/lua/getchoo/keybinds.lua
+++ b/config/plugin/keymaps.lua
@@ -1,5 +1,3 @@
-vim.g.mapleader = ","
-
local opts = { noremap = true, silent = true }
local set = function(mode, key, vimcmd)
vim.keymap.set(mode, key, vimcmd, opts)
diff --git a/lua/getchoo/init.lua b/config/plugin/options.lua
index d33f072..7a13888 100644
--- a/lua/getchoo/init.lua
+++ b/config/plugin/options.lua
@@ -1,4 +1,3 @@
-local cmd = vim.cmd
local opt = vim.opt
-- text options
@@ -7,15 +6,7 @@ opt.shiftwidth = 2
opt.expandtab = false
opt.smartindent = true
opt.wrap = true
-opt.relativenumber = true
-- appearance
opt.syntax = "on"
-cmd("filetype plugin indent on")
opt.termguicolors = true
-
-require("getchoo.keybinds")
-
-if vim.g.use_plugins then
- require("getchoo.plugins")
-end
diff --git a/default.nix b/default.nix
deleted file mode 100644
index be725bd..0000000
--- a/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- lib,
- buildVimPluginFrom2Nix,
- self,
- version,
-}: let
- filter = path: type: let
- path' = toString path;
- base = baseNameOf path';
- isLua = lib.any (suffix: lib.hasSuffix suffix base) [".lua"];
- in
- type == "directory" || isLua;
-
- filterSource = src:
- lib.cleanSourceWith {
- src = lib.cleanSource self;
- inherit filter;
- };
-in
- buildVimPluginFrom2Nix {
- pname = "getchvim";
- inherit version;
- src = filterSource self;
- meta = with lib; {
- homepage = "https://github.com/getchoo/getchvim";
- license = licenses.mit;
- maintainers = with maintainers; [getchoo];
- platforms = platforms.all;
- };
- }
diff --git a/flake.lock b/flake.lock
index d37b30a..30f0db6 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,12 +1,120 @@
{
"nodes": {
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1673956053,
+ "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "gitignore": {
+ "inputs": {
+ "nixpkgs": [
+ "pre-commit",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1660459072,
+ "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "type": "github"
+ }
+ },
+ "lazy-nvim": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1678889456,
+ "narHash": "sha256-R+sfPOuWfwbrNXUiKQcb8MHYqK+o5Pw8gkEaYaidqp0=",
+ "owner": "folke",
+ "repo": "lazy.nvim",
+ "rev": "6b55862d2d264f0b48e0b9e42cc2d14f136bed55",
+ "type": "github"
+ },
+ "original": {
+ "owner": "folke",
+ "repo": "lazy.nvim",
+ "type": "github"
+ }
+ },
+ "neovim": {
+ "inputs": {
+ "flake-utils": [
+ "utils"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "dir": "contrib",
+ "lastModified": 1694922031,
+ "narHash": "sha256-12OiYaH906BnWOK+nlXbNOi3fMmt/3cAqILTyVXzxo8=",
+ "owner": "neovim",
+ "repo": "neovim",
+ "rev": "d70667a1c1f887529d1b4952325aff368c200ef1",
+ "type": "github"
+ },
+ "original": {
+ "dir": "contrib",
+ "owner": "neovim",
+ "repo": "neovim",
+ "type": "github"
+ }
+ },
+ "neovim-nix": {
+ "inputs": {
+ "flake-parts": [
+ "parts"
+ ],
+ "lazy-nvim": "lazy-nvim",
+ "neovim": [
+ "neovim"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "pre-commit-nix": [
+ "pre-commit"
+ ]
+ },
+ "locked": {
+ "lastModified": 1690613475,
+ "narHash": "sha256-DyhvApZb/NBZ92dBgr0deJi4XQZ6lppIc92aDGrj8OY=",
+ "owner": "willruggiano",
+ "repo": "neovim.nix",
+ "rev": "b9ba181c5e20287aeeda4203e02c73f2cff370c4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "willruggiano",
+ "repo": "neovim.nix",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
- "lastModified": 1693471703,
- "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=",
+ "lastModified": 1694767346,
+ "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85",
+ "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183",
"type": "github"
},
"original": {
@@ -15,9 +123,95 @@
"type": "indirect"
}
},
+ "parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1693611461,
+ "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "pre-commit": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": [
+ "utils"
+ ],
+ "gitignore": "gitignore",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "nixpkgs-stable": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1694364351,
+ "narHash": "sha256-oadhSCqopYXxURwIA6/Anpe5IAG11q2LhvTJNP5zE6o=",
+ "owner": "cachix",
+ "repo": "pre-commit-hooks.nix",
+ "rev": "4f883a76282bc28eb952570afc3d8a1bf6f481d7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "cachix",
+ "repo": "pre-commit-hooks.nix",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "neovim": "neovim",
+ "neovim-nix": "neovim-nix",
+ "nixpkgs": "nixpkgs",
+ "parts": "parts",
+ "pre-commit": "pre-commit",
+ "utils": "utils"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1694529238,
+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 37c8ebc..3bb86b4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,52 +1,92 @@
{
description = "getchoo's neovim config";
- inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
-
- outputs = {
- self,
- nixpkgs,
- ...
- }: let
- inherit (nixpkgs) lib;
- version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
-
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
-
- forAllSystems = fn: lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- in {
- checks = forAllSystems (pkgs: {
- stylua = pkgs.runCommand "stylua-check" {nativeBuildInputs = [pkgs.stylua];} ''
- stylua -c ${self}
- touch $out
- '';
- });
-
- devShells = forAllSystems (pkgs: {
- default = import ./shell.nix {inherit pkgs;};
- });
-
- formatter = forAllSystems (pkgs: pkgs.alejandra);
-
- packages = forAllSystems (pkgs: let
- p = self.overlays.default pkgs pkgs;
- in {
- inherit (p.vimPlugins) getchvim;
- default = p.vimPlugins.getchvim;
- });
-
- overlays.default = final: prev: {
- vimPlugins = prev.vimPlugins.extend (_: _: {
- getchvim = prev.callPackage ./default.nix {
- inherit (final.vimUtils) buildVimPluginFrom2Nix;
- inherit self version;
- };
- });
+ inputs = {
+ nixpkgs.url = "nixpkgs/nixos-unstable";
+
+ parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+
+ neovim = {
+ url = "github:neovim/neovim?dir=contrib";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.flake-utils.follows = "utils";
+ };
+
+ neovim-nix = {
+ url = "github:willruggiano/neovim.nix";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ flake-parts.follows = "parts";
+ pre-commit-nix.follows = "pre-commit";
+ neovim.follows = "neovim";
+ };
+ };
+
+ pre-commit = {
+ url = "github:cachix/pre-commit-hooks.nix";
+ inputs = {
+ nixpkgs.follows = "nixpkgs";
+ nixpkgs-stable.follows = "nixpkgs";
+ flake-utils.follows = "utils";
+ };
};
+
+ # this is to prevent multiple versions in lockfile
+ utils.url = "github:numtide/flake-utils";
};
+
+ outputs = {parts, ...} @ inputs:
+ parts.lib.mkFlake {inherit inputs;} {
+ imports = [
+ inputs.pre-commit.flakeModule
+ inputs.neovim-nix.flakeModule
+ ./neovim.nix
+ ];
+
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
+
+ perSystem = {
+ pkgs,
+ config,
+ self',
+ ...
+ }: {
+ packages = {
+ getchvim = config.neovim.final;
+ default = self'.packages.getchvim;
+ };
+
+ devShells.default = pkgs.mkShell {
+ shellHook = config.pre-commit.installationScript;
+
+ packages = with pkgs; [
+ actionlint
+ self'.formatter
+ deadnix
+ nil
+ statix
+ stylua
+ ];
+ };
+
+ formatter = pkgs.alejandra;
+
+ pre-commit.settings.hooks = {
+ actionlint.enable = true;
+ alejandra.enable = true;
+ deadnix.enable = true;
+ nil.enable = true;
+ statix.enable = true;
+ stylua.enable = true;
+ };
+ };
+ };
}
diff --git a/lua/getchoo/plugins/general.lua b/lua/getchoo/plugins/general.lua
deleted file mode 100644
index f9a0c2c..0000000
--- a/lua/getchoo/plugins/general.lua
+++ /dev/null
@@ -1,107 +0,0 @@
----- catppuccin
-local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim"
-vim.fn.mkdir(compile_path, "p")
-vim.opt.runtimepath:append(compile_path)
-
-require("catppuccin").setup({
- compile_path = compile_path,
- flavour = "mocha", -- mocha, macchiato, frappe, latte
- integrations = {
- cmp = true,
- flash = true,
- gitsigns = true,
- native_lsp = {
- enabled = true,
- },
- neotree = true,
- treesitter_context = true,
- treesitter = true,
- telescope = true,
- lsp_trouble = true,
- },
- no_italic = true,
-})
-vim.api.nvim_command("colorscheme catppuccin")
-
----- bufferline
-require("bufferline").setup({
- options = {
- always_show_bufferline = false,
- highlights = require("catppuccin.groups.integrations.bufferline").get(),
- diagnostics = "nvim_lsp",
- mode = "buffers",
- numbers = "ordinal",
- separator_style = "slant",
- offsets = {
- {
- filetype = "neo-tree",
- text = "neo-tree",
- highlight = "Directory",
- text_align = "left",
- },
- },
- },
-})
-
----- gitsigns
-require("gitsigns").setup()
-
----- indent-blankline.nvim
-require("indent_blankline").setup({
- filetype_exclude = {
- "help",
- "neo-tree",
- "Trouble",
- "lazy",
- "mason",
- "notify",
- "toggleterm",
- },
- show_trailing_blankline_indent = false,
- show_current_context = false,
-})
-
----- lualine
-require("lualine").setup({
- options = {
- theme = "catppuccin",
- },
- extensions = { "neo-tree", "trouble" },
-})
-
----- mini.nvim
-require("mini.pairs").setup({})
-require("mini.indentscope").setup({
- options = { try_as_border = true },
-})
-
-vim.api.nvim_create_autocmd("FileType", {
- pattern = {
- "help",
- "neo-tree",
- "Trouble",
- "lazy",
- "mason",
- "notify",
- "toggleterm",
- },
- callback = function()
- vim.b.miniindentscope_disable = true
- end,
-})
-
----- nvim-tree
-require("neo-tree").setup({
- sources = { "filesystem", "buffers", "git_status", "document_symbols" },
- open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" },
- filesystem = {
- bind_to_cwd = false,
- follow_current_file = { enabled = true },
- use_libuv_file_watcher = true,
- },
-})
-
----- which-key
-require("which-key").setup({
- plugins = { spelling = true },
-})
diff --git a/lua/getchoo/plugins/init.lua b/lua/getchoo/plugins/init.lua
deleted file mode 100644
index 43daa5b..0000000
--- a/lua/getchoo/plugins/init.lua
+++ /dev/null
@@ -1,11 +0,0 @@
-if vim.g.use_lazy then
- require("getchoo.plugins.lazy")
-end
-
-require("getchoo.plugins.general")
-require("getchoo.plugins.lsp")
-require("getchoo.plugins.ui")
-
-if vim.g.auto_install then
- require("getchoo.plugins.mason")
-end
diff --git a/lua/getchoo/plugins/lazy.lua b/lua/getchoo/plugins/lazy.lua
deleted file mode 100644
index 917bf33..0000000
--- a/lua/getchoo/plugins/lazy.lua
+++ /dev/null
@@ -1,93 +0,0 @@
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
-
--- bootstrap lazy
-if not vim.loop.fs_stat(lazypath) then
- vim.fn.system({
- "git",
- "clone",
- "--filter=blob:none",
- "https://github.com/folke/lazy.nvim.git",
- "--branch=stable", -- latest stable release
- lazypath,
- })
-end
-
-vim.opt.rtp:prepend(lazypath)
-
-require("lazy").setup({
- --- general
-
- { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
-
- { "j-hui/fidget.nvim", tag = "legacy" },
- { "folke/flash.nvim", event = "VeryLazy" },
-
- "lewis6991/gitsigns.nvim",
- "lukas-reineke/indent-blankline.nvim",
-
- { "nvim-lualine/lualine.nvim", dependencies = "nvim-tree/nvim-web-devicons" },
-
- {
- "nvim-neo-tree/neo-tree.nvim",
- branch = "v3.x",
- dependencies = {
- "nvim-lua/plenary.nvim",
- "nvim-tree/nvim-web-devicons",
- "MunifTanjim/nui.nvim",
- },
- },
-
- { "echasnovski/mini.nvim", version = false, event = "VeryLazy" },
-
- --- completion
-
- {
- "hrsh7th/nvim-cmp",
- dependencies = {
- "hrsh7th/cmp-nvim-lsp",
- "hrsh7th/cmp-buffer",
- "saadparwaiz1/cmp_luasnip",
- "FelipeLema/cmp-async-path",
- "L3MON4D3/LuaSnip",
- },
- },
-
- --- ui
-
- { "stevearc/dressing.nvim", lazy = true },
- { "folke/noice.nvim", event = "VeryLazy" },
- { "MunifTanjim/nui.nvim", lazy = true },
- "rcarriga/nvim-notify",
-
- --- lsp
-
- "neovim/nvim-lspconfig",
-
- {
- "nvim-treesitter/nvim-treesitter",
- dependencies = {
- "JoosepAlviste/nvim-ts-context-commentstring",
- },
- },
- {
- "jose-elias-alvarez/null-ls.nvim",
- dependencies = {
- "nvim-lua/plenary.nvim",
- },
- },
-
- {
- "williamboman/mason.nvim",
- dependencies = {
- "williamboman/mason-lspconfig.nvim",
- "jay-babu/mason-null-ls.nvim",
- },
- },
-
- --- utils
-
- { "akinsho/bufferline.nvim", version = "*", dependencies = "nvim-tree/nvim-web-devicons" },
- { "nvim-telescope/telescope.nvim", tag = "0.1.2" },
- { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } },
- { "folke/which-key.nvim", event = "VeryLazy" },
-})
diff --git a/lua/getchoo/plugins/lsp.lua b/lua/getchoo/plugins/lsp.lua
deleted file mode 100644
index e19b53b..0000000
--- a/lua/getchoo/plugins/lsp.lua
+++ /dev/null
@@ -1,183 +0,0 @@
----- cmp
-local cmp = require("cmp")
-local luasnip = require("luasnip")
-local mapping = cmp.mapping
-
-require("cmp").setup({
- completion = {
- completeopt = "menu,menuone,noinsert",
- },
-
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body)
- end,
- },
-
- mapping = mapping.preset.insert({
- ["<C-n>"] = mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
- ["<C-p>"] = mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
- ["<C-b>"] = mapping.scroll_docs(-4),
- ["<C-f>"] = mapping.scroll_docs(4),
- ["<C-Space>"] = mapping.complete(),
- ["<C-e>"] = mapping.abort(),
- ["<CR>"] = mapping.confirm({ select = true }),
- ["<S-CR>"] = mapping.confirm({
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- }),
- }),
-
- sources = cmp.config.sources({
- { name = "nvim_lsp" },
- { name = "luasnip" },
- { name = "async_path" },
- { name = "buffer" },
- }),
-})
-
----- gitsigns
-require("gitsigns").setup()
-
----- fidget
-require("fidget").setup()
-
----- lsp sources
-local null_ls = require("null-ls")
-local diagnostics = null_ls.builtins.diagnostics
-local formatting = null_ls.builtins.formatting
-
-local sources = {
- lsp_servers = {
- ["bashls"] = "bash-language-server",
- ["clangd"] = "clangd",
- ["pyright"] = "pyright-langserver",
- ["rust_analyzer"] = "rust-analyzer",
- ["tsserver"] = "typescript-language-server",
- },
- null_ls = {
- diagnostics.actionlint,
- diagnostics.alex,
- diagnostics.codespell,
- diagnostics.deadnix,
- diagnostics.eslint,
- diagnostics.pylint,
- diagnostics.shellcheck,
- diagnostics.statix,
- formatting.alejandra,
- formatting.beautysh,
- formatting.codespell,
- formatting.just,
- formatting.nimpretty,
- formatting.prettier,
- formatting.rustfmt,
- formatting.shellharden,
- formatting.stylua,
- formatting.yapf,
- },
-}
-
---- lsp config
-local capabilities = vim.tbl_deep_extend(
- "force",
- require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
- { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
-)
-
-local all_config = {
- capabilities = capabilities,
-}
-
-local servers = {}
-for server, binary in pairs(sources.lsp_servers) do
- if vim.fn.executable(binary) == 1 then
- servers[server] = all_config
- end
-end
-
-servers["lua_ls"] = {
- capabilities = capabilities,
- settings = {
- Lua = {
- runtime = {
- version = "LuaJIT",
- },
- diagnostics = {
- globals = { "vim" },
- },
- workspace = {
- library = vim.api.nvim_get_runtime_file("", true),
- },
- },
- },
-}
-
-servers["nil_ls"] = {
- capabilities = capabilities,
- settings = {
- ["nil"] = {
- nix = {
- flake = {
- autoArchive = false,
- autoEvalInputs = false,
- },
- },
- },
- },
-}
-
-for server, settings in pairs(servers) do
- require("lspconfig")[server].setup(settings)
-end
-
----- null-ls
--- auto-format
-local lsp_formatting = function(bufnr)
- vim.lsp.buf.format({
- filter = function(client)
- return client.name == "null-ls"
- end,
- bufnr = bufnr,
- })
-end
-
-local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
-local formatting_on_attach = function(client, bufnr)
- if client.supports_method("textDocument/formatting") then
- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
- vim.api.nvim_create_autocmd("BufWritePre", {
- group = augroup,
- buffer = bufnr,
- callback = function()
- lsp_formatting(bufnr)
- end,
- })
- end
-end
-
-require("mini.comment").setup({
- options = {
- custom_commentstring = function()
- return require("ts_context_commentstring.internal").calculate_commentstring()
- or vim.bo.context_commentstring
- end,
- },
-})
-
-require("null-ls").setup({
- on_attach = formatting_on_attach,
- sources = sources.null_ls,
-})
-
-require("nvim-treesitter.configs").setup({
- auto_install = (not vim.g.auto_install == nil) and vim.g.auto_install,
- highlight = { enable = true },
- indent = { enable = true },
- context_commentstring = {
- enable = true,
- enable_autocmd = false,
- },
-})
-
----- trouble
-require("trouble").setup()
diff --git a/lua/getchoo/plugins/mason.lua b/lua/getchoo/plugins/mason.lua
deleted file mode 100644
index 083d97c..0000000
--- a/lua/getchoo/plugins/mason.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-local commonArgs = {
- automatic_installation = true,
-}
-
-require("mason").setup()
-require("mason-null-ls").setup(commonArgs)
-require("mason-lspconfig").setup(commonArgs)
diff --git a/lua/getchoo/plugins/ui.lua b/lua/getchoo/plugins/ui.lua
deleted file mode 100644
index 3a0cc2e..0000000
--- a/lua/getchoo/plugins/ui.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-require("dressing")
-
-vim.notify = require("notify")
-
-vim.ui.select = function(...)
- return vim.ui.select(...)
-end
-
-vim.ui.input = function(...)
- return vim.ui.input(...)
-end
-
-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,
- },
- },
- routes = {
- {
- filter = {
- event = "msg_show",
- any = {
- { find = "%d+L, %d+B" },
- { find = "; after #%d+" },
- { find = "; before #%d+" },
- },
- },
- view = "mini",
- },
- },
- presets = {
- bottom_search = true,
- command_palette = true,
- long_message_to_split = true,
- inc_rename = true,
- },
-})
diff --git a/neovim.nix b/neovim.nix
new file mode 100644
index 0000000..5ade53e
--- /dev/null
+++ b/neovim.nix
@@ -0,0 +1,41 @@
+{
+ perSystem = {pkgs, ...}: {
+ neovim = {
+ package = pkgs.neovim-unwrapped;
+
+ paths = with pkgs; [
+ # external tools
+ fd
+ git
+ ripgrep
+ just
+
+ # lint
+ actionlint
+ codespell
+ deadnix
+ nodePackages.alex
+ shellcheck
+ statix
+
+ # format
+ alejandra
+ beautysh
+ stylua
+
+ # lsp
+ nil
+ sumneko-lua-language-server
+ ];
+
+ lazy = {
+ settings = {
+ performance.rtp.reset = true;
+ install.colorscheme = ["catppuccin"];
+ };
+
+ plugins = import ./plugins {inherit pkgs;};
+ };
+ };
+ };
+}
diff --git a/plugins/bufferline.lua b/plugins/bufferline.lua
new file mode 100644
index 0000000..5ec89e5
--- /dev/null
+++ b/plugins/bufferline.lua
@@ -0,0 +1,20 @@
+return function()
+ require("bufferline").setup({
+ options = {
+ always_show_bufferline = false,
+ highlights = require("catppuccin.groups.integrations.bufferline").get(),
+ diagnostics = "nvim_lsp",
+ mode = "buffers",
+ numbers = "ordinal",
+ separator_style = "slant",
+ offsets = {
+ {
+ filetype = "neo-tree",
+ text = "neo-tree",
+ highlight = "Directory",
+ text_align = "left",
+ },
+ },
+ },
+ })
+end
diff --git a/plugins/catppuccin.lua b/plugins/catppuccin.lua
new file mode 100644
index 0000000..2679b48
--- /dev/null
+++ b/plugins/catppuccin.lua
@@ -0,0 +1,28 @@
+return function()
+ require("catppuccin").setup({
+ compile_path = compile_path,
+ flavour = "mocha", -- mocha, macchiato, frappe, latte
+ integrations = {
+ cmp = true,
+ flash = true,
+ gitsigns = true,
+ indent_blankline = {
+ enabled = true,
+ },
+ lsp_trouble = true,
+ native_lsp = {
+ enabled = true,
+ },
+ neotree = true,
+ notify = true,
+ treesitter_context = true,
+ treesitter = true,
+ telescope = true,
+ which_key = true,
+ },
+
+ no_italic = true,
+ })
+
+ vim.cmd.colorscheme("catppuccin")
+end
diff --git a/plugins/cmp.lua b/plugins/cmp.lua
new file mode 100644
index 0000000..a61dc4a
--- /dev/null
+++ b/plugins/cmp.lua
@@ -0,0 +1,38 @@
+return function()
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+ local mapping = cmp.mapping
+
+ return {
+ completion = {
+ completeopt = "menu,menuone,noinsert",
+ },
+
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+
+ mapping = mapping.preset.insert({
+ ["<C-n>"] = mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
+ ["<C-p>"] = mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
+ ["<C-b>"] = mapping.scroll_docs(-4),
+ ["<C-f>"] = mapping.scroll_docs(4),
+ ["<C-Space>"] = mapping.complete(),
+ ["<C-e>"] = mapping.abort(),
+ ["<CR>"] = mapping.confirm({ select = true }),
+ ["<S-CR>"] = mapping.confirm({
+ behavior = cmp.ConfirmBehavior.Replace,
+ select = true,
+ }),
+ }),
+
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "async_path" },
+ { name = "buffer" },
+ }),
+ }
+end
diff --git a/plugins/default.nix b/plugins/default.nix
new file mode 100644
index 0000000..6f36f04
--- /dev/null
+++ b/plugins/default.nix
@@ -0,0 +1,177 @@
+{pkgs, ...}: let
+ inherit (pkgs) vimPlugins;
+in rec {
+ config = {
+ src = ../config;
+ lazy = false;
+ priority = 1000;
+ };
+
+ catppuccin-nvim = {
+ package = vimPlugins.catppuccin-nvim;
+
+ config = ./catppuccin.lua;
+ };
+
+ fidget-nvim = {
+ package = vimPlugins.fidget-nvim.overrideAttrs (_: {
+ src = pkgs.fetchFromGitHub {
+ owner = "j-hui";
+ repo = "fidget.nvim";
+ rev = "41f327b53c7977d47aee56f05e0bdbb4b994c5eb";
+ hash = "sha256-v9qARsW8Gozit4Z3+igiemjI467QgRhwM+crqwO9r6U=";
+ };
+ });
+ };
+
+ flash-nvim = {
+ package = vimPlugins.flash-nvim;
+ event = "VeryLazy";
+ };
+
+ gitsigns-nvim = {
+ package = vimPlugins.gitsigns-nvim;
+ event = ["BufReadPre" "BufNewFile"];
+ };
+
+ indent-blankline-nvim = {
+ package = vimPlugins.indent-blankline-nvim;
+
+ event = ["BufReadPost" "BufNewFile"];
+
+ config = {
+ filetype_exclude = [
+ "help"
+ "neo-tree"
+ "Trouble"
+ "lazy"
+ "mason"
+ "notify"
+ "toggleterm"
+ ];
+ show_trailing_blankline_indent = false;
+ show_current_context = false;
+ };
+ };
+
+ lualine-nvim = {
+ package = vimPlugins.lualine-nvim;
+
+ event = "VeryLazy";
+
+ dependencies = {
+ nvim-web-devicons.package = vimPlugins.nvim-web-devicons;
+ };
+
+ config = ./lualine.lua;
+ };
+
+ neo-tree-nvim = {
+ package = vimPlugins.neo-tree-nvim;
+ dependencies = {
+ plenary-nvim.package = vimPlugins.plenary-nvim;
+ inherit (lualine-nvim.dependencies) nvim-web-devicons;
+ inherit nui-nvim;
+ };
+
+ config = ./neo-tree.lua;
+ };
+
+ # TODO: configure mini.pairs, mini.indentscope, & mini.comment
+ mini-nvim.package = vimPlugins.mini-nvim;
+
+ nvim-cmp = {
+ package = vimPlugins.nvim-cmp;
+ dependencies = {
+ cmp-nvim-lsp.package = vimPlugins.cmp-nvim-lsp;
+ cmp-buffer.package = vimPlugins.cmp-buffer;
+ cmp_luasnip.package = vimPlugins.cmp_luasnip;
+ cmp-async-path.package = vimPlugins.cmp-async-path;
+ luasnip.package = vimPlugins.luasnip;
+ };
+
+ event = "InsertEnter";
+ config = ./cmp.lua;
+ };
+
+ dressing-nvim = {
+ package = vimPlugins.dressing-nvim;
+ lazy = true;
+ init = ./dressing.lua;
+ };
+
+ noice-nvim = {
+ package = vimPlugins.noice-nvim;
+ event = "VeryLazy";
+
+ config = ./noice.lua;
+ };
+
+ nui-nvim = {
+ package = vimPlugins.nui-nvim;
+ lazy = true;
+ };
+
+ nvim-lspconfig = {
+ package = vimPlugins.nvim-lspconfig;
+
+ event = ["BufReadPre" "BufNewFile"];
+ config = ./lspconfig.lua;
+ };
+
+ nvim-treesitter = {
+ package = vimPlugins.nvim-treesitter.withAllGrammars;
+ dependencies = {
+ nvim-ts-context-commentstring.package = vimPlugins.nvim-ts-context-commentstring;
+ };
+
+ event = ["BufReadPost" "BufNewFile"];
+ config = {
+ auto_install = false;
+ highlight.enable = true;
+ indent.enable = true;
+ context_commentstring = {
+ enable = true;
+ enable_autocmd = false;
+ };
+ };
+ };
+
+ null-ls = {
+ package = vimPlugins.null-ls-nvim;
+ dependencies = {
+ inherit (neo-tree-nvim.dependencies) plenary-nvim;
+ };
+
+ config = ./null-ls.lua;
+ };
+
+ bufferline-nvim = {
+ package = vimPlugins.bufferline-nvim;
+ dependencies = {
+ inherit (lualine-nvim.dependencies) nvim-web-devicons;
+ inherit catppuccin-nvim;
+ };
+
+ config = ./bufferline.lua;
+ };
+
+ telescope-nvim.package = vimPlugins.telescope-nvim;
+
+ trouble-nvim = {
+ package = vimPlugins.trouble-nvim;
+ dependencies = {
+ inherit (lualine-nvim.dependencies) nvim-web-devicons;
+ };
+ };
+
+ which-key-nvim = {
+ package = vimPlugins.which-key-nvim;
+ event = "VeryLazy";
+ config = {
+ plugins = {
+ spelling = true;
+ };
+ };
+ };
+}
diff --git a/plugins/dressing.lua b/plugins/dressing.lua
new file mode 100644
index 0000000..1f0e70a
--- /dev/null
+++ b/plugins/dressing.lua
@@ -0,0 +1,11 @@
+return function()
+ vim.ui.select = function(...)
+ require("lazy").load({ plugins = { "dressing-nvim" } })
+ return vim.ui.select(...)
+ end
+
+ vim.ui.input = function(...)
+ require("lazy").load({ plugins = { "dressing-nvim" } })
+ return vim.ui.input(...)
+ end
+end
diff --git a/plugins/lspconfig.lua b/plugins/lspconfig.lua
new file mode 100644
index 0000000..a17d5ab
--- /dev/null
+++ b/plugins/lspconfig.lua
@@ -0,0 +1,49 @@
+return function()
+ local sources = {
+ ["bashls"] = "bash-language-server",
+ ["clangd"] = "clangd",
+ ["eslint"] = "eslint",
+ ["nil_ls"] = "nil",
+ ["pyright"] = "pyright-langserver",
+ ["rust_analyzer"] = "rust-analyzer",
+ ["tsserver"] = "typescript-language-server",
+ }
+
+ local capabilities = vim.tbl_deep_extend(
+ "force",
+ require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
+ { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
+ )
+
+ local all_config = {
+ capabilities = capabilities,
+ }
+
+ local servers = {}
+ for server, binary in pairs(sources) do
+ if vim.fn.executable(binary) == 1 then
+ servers[server] = all_config
+ end
+ end
+
+ servers["lua_ls"] = {
+ capabilities = capabilities,
+ settings = {
+ Lua = {
+ runtime = {
+ version = "LuaJIT",
+ },
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ },
+ },
+ },
+ }
+
+ for server, settings in pairs(servers) do
+ require("lspconfig")[server].setup(settings)
+ end
+end
diff --git a/plugins/lualine.lua b/plugins/lualine.lua
new file mode 100644
index 0000000..dbf8602
--- /dev/null
+++ b/plugins/lualine.lua
@@ -0,0 +1,8 @@
+return function()
+ require("lualine").setup({
+ options = {
+ theme = "catppuccin",
+ },
+ extensions = { "neo-tree", "trouble" },
+ })
+end
diff --git a/plugins/neo-tree.lua b/plugins/neo-tree.lua
new file mode 100644
index 0000000..8d690d9
--- /dev/null
+++ b/plugins/neo-tree.lua
@@ -0,0 +1,7 @@
+return function()
+ require("neo-tree").setup({
+ filetype_exclude = { "help", "neo-tree", "Trouble", "lazy", "mason", "notify", "toggleterm" },
+ show_current_context = false,
+ show_trailing_blankline_indent = false,
+ })
+end
diff --git a/plugins/noice.lua b/plugins/noice.lua
new file mode 100644
index 0000000..ac8879e
--- /dev/null
+++ b/plugins/noice.lua
@@ -0,0 +1,30 @@
+return function()
+ 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,
+ },
+ },
+ routes = {
+ {
+ filter = {
+ event = "msg_show",
+ any = {
+ { find = "%d+L, %d+B" },
+ { find = "; after #%d+" },
+ { find = "; before #%d+" },
+ },
+ },
+ view = "mini",
+ },
+ },
+ presets = {
+ bottom_search = true,
+ command_palette = true,
+ long_message_to_split = true,
+ inc_rename = true,
+ },
+ })
+end
diff --git a/plugins/null-ls.lua b/plugins/null-ls.lua
new file mode 100644
index 0000000..a2a71f1
--- /dev/null
+++ b/plugins/null-ls.lua
@@ -0,0 +1,50 @@
+return function()
+ local null_ls = require("null-ls")
+ local diagnostics = null_ls.builtins.diagnostics
+ local formatting = null_ls.builtins.formatting
+
+ local lsp_formatting = function(bufnr)
+ vim.lsp.buf.format({
+ filter = function(client)
+ return client.name == "null-ls"
+ end,
+ bufnr = bufnr,
+ })
+ end
+
+ local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
+
+ null_ls.setup({
+ on_attach = function(client, bufnr)
+ if client.supports_method("textDocument/formatting") then
+ vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ group = augroup,
+ buffer = bufnr,
+ callback = function()
+ lsp_formatting(bufnr)
+ end,
+ })
+ end
+ end,
+ sources = {
+ diagnostics.actionlint,
+ diagnostics.alex,
+ diagnostics.codespell,
+ diagnostics.deadnix,
+ diagnostics.pylint,
+ diagnostics.shellcheck,
+ diagnostics.statix,
+ formatting.alejandra,
+ formatting.beautysh,
+ formatting.codespell,
+ formatting.just,
+ formatting.nimpretty,
+ formatting.prettier,
+ formatting.rustfmt,
+ formatting.shellharden,
+ formatting.stylua,
+ formatting.yapf,
+ },
+ })
+end
diff --git a/shell.nix b/shell.nix
deleted file mode 100644
index c647106..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{pkgs ? import <nixpkgs> {}}:
-pkgs.mkShell {
- packages = with pkgs; [
- stylua
- ];
-}