Compare commits
75 commits
lspsaga-re
...
main
Author | SHA1 | Date | |
---|---|---|---|
6bbb562216 | |||
40bc84d1f8 | |||
d280679b14 | |||
dfef2d38b1 | |||
542364e035 | |||
ddc7c23ef6 | |||
41585809d7 | |||
e4411e7378 | |||
c414c1d302 | |||
23a3e4c52e | |||
c4374c0037 | |||
c3a3fe588f | |||
e572ba6d78 | |||
b4a93f588f | |||
91b9f31c3f | |||
45117804e7 | |||
3717b5002d | |||
54333ac0a6 | |||
ecd458f1d3 | |||
dc2181a344 | |||
06b4e995bf | |||
b7a44b014a | |||
db6fc1b83b | |||
904a97ea5f | |||
6942284275 | |||
020520b007 | |||
ecd8cd11ed | |||
2a44c3e661 | |||
5c5878a64f | |||
a84098dd91 | |||
efd4f06e0d | |||
6dd623dd38 | |||
69355e6429 | |||
d576379760 | |||
70c85a004f | |||
ad87fe9316 | |||
1504ad1ad0 | |||
d317a7c665 | |||
99e095d919 | |||
437e0e05cf | |||
005ddc0b9e | |||
2de32b283e | |||
d991c749c2 | |||
dc805ab062 | |||
ae6faa78c5 | |||
7d91e495dc | |||
aa9f2ccb68 | |||
4edf3f4d64 | |||
465f27ac0c | |||
ea2231f615 | |||
42e6ef422f | |||
1067059290 | |||
4811c8054c | |||
93b5f04284 | |||
91e0909ac6 | |||
a44c17c95a | |||
f8d8c99ac5 | |||
2b24da8720 | |||
3463a6c419 | |||
23fce1be6c | |||
0d27956624 | |||
019d8ae991 | |||
621f99403b | |||
9dca04d9b2 | |||
b6f33bfb03 | |||
116764c3a0 | |||
cf97347ae5 | |||
5225154c6c | |||
8957cc62e6 | |||
b22dfff883 | |||
ccc489bbbd | |||
1e9bae6c7b | |||
89665d9a4a | |||
27b6718d38 | |||
6f09704969 |
31 changed files with 1700 additions and 103 deletions
176
config/basic.lua
176
config/basic.lua
|
@ -1,3 +1,179 @@
|
|||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- Basic Settings
|
||||
--
|
||||
|
||||
vim.cmd("filetype off")
|
||||
|
||||
-- Leaders
|
||||
vim.g.mapleader = ","
|
||||
vim.g.maplocalleader = "-"
|
||||
|
||||
-- Better Unix support
|
||||
vim.opt.viewoptions = { "folds", "options", "cursor", "unix", "slash" }
|
||||
vim.opt.encoding = "utf-8"
|
||||
|
||||
-- True color support
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Other options
|
||||
vim.opt.backspace = { "indent", "eol", "start" }
|
||||
vim.opt.laststatus = 2
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Tabs as spaces
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
|
||||
-- Fixes broken cursor on Linux
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
-- Disable mouse / touchpad
|
||||
vim.opt.mouse = ""
|
||||
|
||||
-- Incremental substitutin
|
||||
vim.opt.inccommand = "split"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- General editor options
|
||||
--
|
||||
|
||||
-- Hide files when leaving them.
|
||||
vim.opt.hidden = true
|
||||
-- Show line numbers.
|
||||
vim.opt.number = true
|
||||
-- Minimum line number column width.
|
||||
vim.opt.numberwidth = 1
|
||||
-- Number of screen lines to use for the commandline.
|
||||
vim.opt.cmdheight = 2
|
||||
-- Lines length limit (0 if no limit).
|
||||
vim.opt.textwidth = 0
|
||||
-- Don't cut lines in the middle of a work.
|
||||
vim.opt.linebreak = true
|
||||
-- Show matching parenthesis.
|
||||
vim.opt.showmatch = true
|
||||
-- Time during which the matching parenthesis is shown.
|
||||
vim.opt.matchtime = 2
|
||||
-- Sensible default line auto cutting and formatting.
|
||||
vim.opt.formatoptions = "jtcrq"
|
||||
-- Copy/Past to/from clipboard.
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
-- Highlight line cursor is currently on.
|
||||
vim.opt.cursorline = true
|
||||
-- Invisible characters representation when :set list
|
||||
vim.opt.listchars = {
|
||||
tab = "→ ",
|
||||
trail = "~",
|
||||
nbsp = "␣",
|
||||
eol = "¬",
|
||||
}
|
||||
|
||||
-- Search
|
||||
-- Incremental search.
|
||||
vim.opt.incsearch = true
|
||||
-- Case insensitive.
|
||||
vim.opt.ignorecase = true
|
||||
-- Case insensitive if no uppercase letter in pattern, case sensitive otherwise.
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Spell
|
||||
vim.opt.spelllang = "en,ru"
|
||||
|
||||
-- Fold level
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldminlines = 3
|
||||
vim.opt.foldnestmax = 5
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.cmd([[
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
]])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- File type specified
|
||||
--
|
||||
local bufReadFile = { "BufNewFile", "BufRead" }
|
||||
|
||||
-- Set up a line limiter for each lang
|
||||
local line_limiter_augroup = vim.api.nvim_create_augroup("line_limiter", {})
|
||||
local function set_line_limiter(limit, patterns)
|
||||
vim.api.nvim_create_autocmd(bufReadFile, {
|
||||
pattern = patterns,
|
||||
group = line_limiter_augroup,
|
||||
callback = function()
|
||||
vim.wo.colorcolumn = tostring(limit)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
set_line_limiter(101, {
|
||||
"*.nix",
|
||||
"*.vim",
|
||||
"*.lua",
|
||||
"*.ts",
|
||||
"*.tsx",
|
||||
"*.js",
|
||||
"*.jsx",
|
||||
"*.rs",
|
||||
})
|
||||
set_line_limiter(81, {
|
||||
"*.json",
|
||||
"*.yml",
|
||||
"*.yaml",
|
||||
"*.md",
|
||||
"*.html",
|
||||
"*.css",
|
||||
})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- Bindings
|
||||
--
|
||||
local function clear_search_hl()
|
||||
vim.opt.hlsearch = false
|
||||
end
|
||||
vim.keymap.set("n", "<C-z>", clear_search_hl, { desc = "Clear search highlighting" })
|
||||
|
||||
-- Enable fast navigation between windows
|
||||
vim.keymap.set("n", "<C-h>", "<C-W>h")
|
||||
vim.keymap.set("n", "<C-l>", "<C-W>l")
|
||||
vim.keymap.set("n", "<C-j>", "<C-W>j")
|
||||
vim.keymap.set("n", "<C-k>", "<C-W>k")
|
||||
|
||||
-- Disable the annoying and useless ex-mode
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "gQ", "<nop>")
|
||||
|
||||
-- Disable arrow keys
|
||||
vim.keymap.set("n", "<Up>", "<nop>")
|
||||
vim.keymap.set("n", "<Down>", "<nop>")
|
||||
vim.keymap.set("n", "<Left>", "<nop>")
|
||||
vim.keymap.set("n", "<Right>", "<nop>")
|
||||
vim.keymap.set("v", "<Up>", "<nop>")
|
||||
vim.keymap.set("v", "<Down>", "<nop>")
|
||||
vim.keymap.set("v", "<Left>", "<nop>")
|
||||
vim.keymap.set("v", "<Right>", "<nop>")
|
||||
-- ... instead of insert mode for rus lang and popups
|
||||
-- vim.keymap.set("i", "<Up>", "<nop>")
|
||||
-- vim.keymap.set("i", "<Down>", "<nop>")
|
||||
-- vim.keymap.set("i", "<Left>", "<nop>")
|
||||
-- vim.keymap.set("i", "<Right>", "<nop>")
|
||||
|
||||
-- Disable page up / down
|
||||
vim.keymap.set("n", "<PageUp>", "<nop>")
|
||||
vim.keymap.set("n", "<PageDown>", "<nop>")
|
||||
vim.keymap.set("v", "<PageUp>", "<nop>")
|
||||
vim.keymap.set("v", "<PageDown>", "<nop>")
|
||||
vim.keymap.set("i", "<PageUp>", "<nop>")
|
||||
vim.keymap.set("i", "<PageDown>", "<nop>")
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
--
|
||||
-- Abbreviatures
|
||||
--
|
||||
vim.cmd("cabbrev bsp belowright split")
|
||||
vim.cmd("cabbrev rvsp belowright vsplit")
|
||||
|
|
50
default.nix
50
default.nix
|
@ -1,47 +1,3 @@
|
|||
{ enableDevIcons ? false
|
||||
, enableBarBar ? false
|
||||
, enableTabby ? false
|
||||
, viAlias ? false
|
||||
, vimAlias ? false
|
||||
, theme ? { }
|
||||
, wrapNeovim
|
||||
, neovim-unwrapped
|
||||
, tree-sitter
|
||||
, vimPlugins
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
lib = import ./lib.nix;
|
||||
|
||||
pluginParams = vimPlugins // { inherit lib; };
|
||||
|
||||
callPlugin = op: if builtins.isFunction op then op pluginParams else import op pluginParams;
|
||||
callPlugins = list: builtins.map callPlugin list;
|
||||
|
||||
plugins = callPlugins [
|
||||
./plugins/lsp
|
||||
];
|
||||
|
||||
basePlugins = [ vimPlugins.plenary-nvim ];
|
||||
customPlugins = builtins.catAttrs "plugins" plugins;
|
||||
allPlugins = basePlugins ++ customPlugins;
|
||||
|
||||
basicConfigs = builtins.map builtins.readFile [ ./config/basic.lua ];
|
||||
pluginConfigs = builtins.catAttrs "luaConfig" plugins;
|
||||
allConfigs = basicConfigs ++ pluginConfigs;
|
||||
in
|
||||
wrapNeovim neovim-unwrapped {
|
||||
inherit viAlias;
|
||||
inherit vimAlias;
|
||||
|
||||
withPython3 = false;
|
||||
withNodeJs = false;
|
||||
withRuby = false;
|
||||
|
||||
configure = {
|
||||
customRC = lib.mkLuaRc allConfigs;
|
||||
|
||||
packages.myVimPackages = { start = allPlugins; };
|
||||
};
|
||||
}
|
||||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = builtins.fetchGit ./.;
|
||||
}).defaultNix
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
let is-hello-world = true; in { }
|
437
flake.lock
437
flake.lock
|
@ -1,29 +1,222 @@
|
|||
{
|
||||
"nodes": {
|
||||
"cmp-luasnip": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1666943769,
|
||||
"narHash": "sha256-Z5SPy3j2oHFxJ7bK8DP8Q/oRyLEMlnWyIfDaQcNVIS0=",
|
||||
"owner": "saadparwaiz1",
|
||||
"repo": "cmp_luasnip",
|
||||
"rev": "18095520391186d634a0045dacaa346291096566",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "saadparwaiz1",
|
||||
"repo": "cmp_luasnip",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cmp-nvim-lsp": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1687494203,
|
||||
"narHash": "sha256-mU0soCz79erJXMMqD/FyrJZ0mu2n6fE0deymPzQlxts=",
|
||||
"owner": "hrsh7th",
|
||||
"repo": "cmp-nvim-lsp",
|
||||
"rev": "44b16d11215dce86f253ce0c30949813c0a90765",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hrsh7th",
|
||||
"repo": "cmp-nvim-lsp",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cmp-tabby": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1681450408,
|
||||
"narHash": "sha256-0swK9LV91SeZO0SQl8zVs7GmQNMYwQm7XyQE0iPbc/w=",
|
||||
"owner": "nzlov",
|
||||
"repo": "cmp-tabby",
|
||||
"rev": "c0cb81024ee1500a722b3c35f64dd282c11bc7ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nzlov",
|
||||
"repo": "cmp-tabby",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"editorconfig-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673364897,
|
||||
"narHash": "sha256-pR57tITdVGF4luEmmRYv/XFb35E3KDfcgYRijkPAc+Y=",
|
||||
"owner": "gpanders",
|
||||
"repo": "editorconfig.nvim",
|
||||
"rev": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gpanders",
|
||||
"repo": "editorconfig.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-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"
|
||||
}
|
||||
},
|
||||
"gitsigns-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695571272,
|
||||
"narHash": "sha256-VJCtDnPSo5RgSC+czSIOvqGhpUT0dzvCzbLtup+Ctyo=",
|
||||
"owner": "lewis6991",
|
||||
"repo": "gitsigns.nvim",
|
||||
"rev": "bdeba1cec3faddd89146690c10b9a87949c0ee66",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lewis6991",
|
||||
"repo": "gitsigns.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hop-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1694283445,
|
||||
"narHash": "sha256-SnuFeD/lrMxKtpBRPgIwdG0kVF7BWe02PiV7URVDASI=",
|
||||
"owner": "phaazon",
|
||||
"repo": "hop.nvim",
|
||||
"rev": "1a1eceafe54b5081eae4cb91c723abd1d450f34b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "phaazon",
|
||||
"repo": "hop.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lspsaga-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1664704370,
|
||||
"narHash": "sha256-f0pwssdEI5mAO/Ov8E9DpT/E+5Xi3DvMjo4ui+TX3go=",
|
||||
"lastModified": 1665291018,
|
||||
"narHash": "sha256-jkoEP5jeIZDAK/27gpNTXtW10/Ev9nB5RqUahPhja2Y=",
|
||||
"owner": "glepnir",
|
||||
"repo": "lspsaga.nvim",
|
||||
"rev": "381900d932db058aa3236ba66cc9f45747c0df71",
|
||||
"rev": "f33bc99d0ed3ed691a58b3339decf4e1933c3f9e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "glepnir",
|
||||
"repo": "lspsaga.nvim",
|
||||
"rev": "381900d932db058aa3236ba66cc9f45747c0df71",
|
||||
"rev": "f33bc99d0ed3ed691a58b3339decf4e1933c3f9e",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lualine-lsp-progress": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1634947677,
|
||||
"narHash": "sha256-8HMtydFDzTxsuKvce+bIra9vZ9zHfEBHyR346W635b8=",
|
||||
"owner": "arkav",
|
||||
"repo": "lualine-lsp-progress",
|
||||
"rev": "56842d097245a08d77912edf5f2a69ba29f275d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "arkav",
|
||||
"repo": "lualine-lsp-progress",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lualine-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1691046210,
|
||||
"narHash": "sha256-v8finXk+sLNaFMA7pSHhEu0WF5mhPYWHEKhl0IKBv8c=",
|
||||
"owner": "nvim-lualine",
|
||||
"repo": "lualine.nvim",
|
||||
"rev": "45e27ca739c7be6c49e5496d14fcf45a303c3a63",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-lualine",
|
||||
"repo": "lualine.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"luasnip": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695621384,
|
||||
"narHash": "sha256-5rr5F1PJMqKvIgGPqYx27Id0xW97lZZU1FoEA1rVfjI=",
|
||||
"owner": "L3MON4D3",
|
||||
"repo": "LuaSnip",
|
||||
"rev": "480b032f6708573334f4437d3f83307d143f1a72",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "L3MON4D3",
|
||||
"repo": "LuaSnip",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neoformat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695341413,
|
||||
"narHash": "sha256-b1IHXoRvQu4QCTR+A+KQAhj6wUD5jinjdkxu9w8ukyY=",
|
||||
"owner": "sbdchd",
|
||||
"repo": "neoformat",
|
||||
"rev": "aedb6f9d3f53d5da229095f7d761d749f8c5c7e0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "sbdchd",
|
||||
"repo": "neoformat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix2lua": {
|
||||
"locked": {
|
||||
"lastModified": 1709128456,
|
||||
"narHash": "sha256-tRduS+XFI6VceWPQzjkuvlyn/Oe5NsQUS/wyEC69dvk=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "f152767145e61fea96eddb1b550ab3f25701e0ad",
|
||||
"revCount": 18,
|
||||
"type": "git",
|
||||
"url": "https://git.pleshevski.ru/mynix/nix2lua"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pleshevski.ru/mynix/nix2lua"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1663146586,
|
||||
"narHash": "sha256-VCGdyEc5TF0uq+gdU+jesjZcNxptomDunvGtElmAD9I=",
|
||||
"lastModified": 1701237617,
|
||||
"narHash": "sha256-Ryd8xpNDY9MJnBFDYhB37XSFIxCPVVVXAbInNPa95vs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "125efbd96af28ea5d60e00a3eed832ea3f49a93b",
|
||||
"rev": "85306ef2470ba705c97ce72741d56e42d0264015",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -33,31 +226,143 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nlsp-settings-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1692758329,
|
||||
"narHash": "sha256-Jj74rwBpqdXXykNuvJfESUOL+ntPLtzSSHqh2NcUzDo=",
|
||||
"owner": "tamago324",
|
||||
"repo": "nlsp-settings.nvim",
|
||||
"rev": "2a52e793d4f293c0e1d61ee5794e3ff62bfbbb5d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "tamago324",
|
||||
"repo": "nlsp-settings.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-cmp": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1693063902,
|
||||
"narHash": "sha256-WGck3By9GhnBUmzLGi2wnKjDreQx5kBOmHCbC5BZhfo=",
|
||||
"owner": "hrsh7th",
|
||||
"repo": "nvim-cmp",
|
||||
"rev": "5dce1b778b85c717f6614e3f4da45e9f19f54435",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hrsh7th",
|
||||
"repo": "nvim-cmp",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-colorizer": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1591879145,
|
||||
"narHash": "sha256-6YrnItxExL2C8pNIdLd+hXCjsB2MbZANwWkah6dreD8=",
|
||||
"owner": "norcalli",
|
||||
"repo": "nvim-colorizer.lua",
|
||||
"rev": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "norcalli",
|
||||
"repo": "nvim-colorizer.lua",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1663921594,
|
||||
"narHash": "sha256-uCFhwcR4oW+4wrSt6rx5G8k75dOLeqmYzW1G1CYlLkM=",
|
||||
"lastModified": 1695879754,
|
||||
"narHash": "sha256-eUyyB/P52AZz3rl2n9ntGIp3b0x0s/TF/fQZ/30UeC0=",
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"rev": "d4eb971db353ccf78cefb3be1b05483b69ec1e69",
|
||||
"rev": "c7077400d004c1a424d210af76ce198250db72fd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"rev": "d4eb971db353ccf78cefb3be1b05483b69ec1e69",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-orgmode": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669843678,
|
||||
"narHash": "sha256-zut3orH6okjb9NLvpoQ/S0jDTKGEe41ULXOKjBPqYO0=",
|
||||
"owner": "nvim-orgmode",
|
||||
"repo": "orgmode",
|
||||
"rev": "fc9bb0f5823d01e4008e4b86663772d4148aa9ce",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-orgmode",
|
||||
"repo": "orgmode",
|
||||
"rev": "fc9bb0f5823d01e4008e4b86663772d4148aa9ce",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-tree-lua": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695716495,
|
||||
"narHash": "sha256-Fkchn7UuIHPmVFFrx1kzsE2lviJrAFAe9tHu73HnS/w=",
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-tree.lua",
|
||||
"rev": "934469b9b6df369e198fb3016969e56393b0dc07",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-tree.lua",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695598844,
|
||||
"narHash": "sha256-k1oq5TBF0ZAfC1aihw/HLrvOHwZSX8ToDU3aZ3YXdzE=",
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-web-devicons",
|
||||
"rev": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-web-devicons",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"org-bullets-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1679902360,
|
||||
"narHash": "sha256-x6S4WdgfUr7HGEHToSDy3pSHEwOPQalzWhBUipqMtnw=",
|
||||
"owner": "akinsho",
|
||||
"repo": "org-bullets.nvim",
|
||||
"rev": "6e0d60e901bb939eb526139cb1f8d59065132fd9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "akinsho",
|
||||
"repo": "org-bullets.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plenary-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1663402373,
|
||||
"narHash": "sha256-d06QP5JGhpH6UUVF9STYzfJMzvg5HrJfDqlAoVXaLeM=",
|
||||
"lastModified": 1694526433,
|
||||
"narHash": "sha256-s3qsKf05X5W1VdZT1vYXGQNK0UaiI+umWUf06Spe4hw=",
|
||||
"owner": "nvim-lua",
|
||||
"repo": "plenary.nvim",
|
||||
"rev": "62dc2a7acd2fb2581871a36c1743b29e26c60390",
|
||||
"rev": "9ce85b0f7dcfe5358c0be937ad23e456907d410b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -68,25 +373,111 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"cmp-luasnip": "cmp-luasnip",
|
||||
"cmp-nvim-lsp": "cmp-nvim-lsp",
|
||||
"cmp-tabby": "cmp-tabby",
|
||||
"editorconfig-nvim": "editorconfig-nvim",
|
||||
"flake-utils": "flake-utils",
|
||||
"gitsigns-nvim": "gitsigns-nvim",
|
||||
"hop-nvim": "hop-nvim",
|
||||
"lspsaga-nvim": "lspsaga-nvim",
|
||||
"lualine-lsp-progress": "lualine-lsp-progress",
|
||||
"lualine-nvim": "lualine-nvim",
|
||||
"luasnip": "luasnip",
|
||||
"neoformat": "neoformat",
|
||||
"nix2lua": "nix2lua",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nlsp-settings-nvim": "nlsp-settings-nvim",
|
||||
"nvim-cmp": "nvim-cmp",
|
||||
"nvim-colorizer": "nvim-colorizer",
|
||||
"nvim-lspconfig": "nvim-lspconfig",
|
||||
"nvim-orgmode": "nvim-orgmode",
|
||||
"nvim-tree-lua": "nvim-tree-lua",
|
||||
"nvim-web-devicons": "nvim-web-devicons",
|
||||
"org-bullets-nvim": "org-bullets-nvim",
|
||||
"plenary-nvim": "plenary-nvim",
|
||||
"utils": "utils"
|
||||
"tabby-nvim": "tabby-nvim",
|
||||
"telescope-live-grep-args-nvim": "telescope-live-grep-args-nvim",
|
||||
"telescope-nvim": "telescope-nvim",
|
||||
"theme": "theme"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"tabby-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695278537,
|
||||
"narHash": "sha256-yzFOD1ERAcZx+PQmBC/aMhHTBUBCccOxRF3x0S6c9nM=",
|
||||
"owner": "nanozuki",
|
||||
"repo": "tabby.nvim",
|
||||
"rev": "9e537762cbb7647357eab22c61c7c5dda00138dd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nanozuki",
|
||||
"repo": "tabby.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"telescope-live-grep-args-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1693245982,
|
||||
"narHash": "sha256-L2STMQude8DalHF4fYaJZNjvQHB1UtnQx8Gx2fPKcDA=",
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope-live-grep-args.nvim",
|
||||
"rev": "851c0997d55601f2afd7290db0f90dc364e29f58",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope-live-grep-args.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"telescope-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695796462,
|
||||
"narHash": "sha256-ZNkDZLR3oHe/tkAOpWwN3CF5M+3xooYlUuBT2Hndauw=",
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope.nvim",
|
||||
"rev": "84d53dfdbefbdf84e861a288abc71ef8ccafd04e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"theme": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695478950,
|
||||
"narHash": "sha256-SV5DTVwcVv6YIb7TGNYwq6rtIG5pFKubK07snXhV7z8=",
|
||||
"owner": "catppuccin",
|
||||
"repo": "nvim",
|
||||
"rev": "3d9a5ed556e289bce6c1fb0af89ec838360641b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "catppuccin",
|
||||
"repo": "nvim",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
|
|
289
flake.nix
289
flake.nix
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
nix2lua.url = "git+https://git.pleshevski.ru/mynix/nix2lua";
|
||||
|
||||
# Plenary (required by crates-nvim)
|
||||
plenary-nvim = {
|
||||
|
@ -9,73 +11,318 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# config
|
||||
|
||||
# https://github.com/gpanders/editorconfig.nvim
|
||||
editorconfig-nvim = {
|
||||
url = "github:gpanders/editorconfig.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# explorer
|
||||
|
||||
# https://github.com/kyazdani42/nvim-tree.lua
|
||||
nvim-tree-lua = {
|
||||
url = "github:kyazdani42/nvim-tree.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/nvim-telescope/telescope.nvim
|
||||
telescope-nvim = {
|
||||
url = "github:nvim-telescope/telescope.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/nvim-telescope/telescope-live-grep-args.nvim
|
||||
telescope-live-grep-args-nvim = {
|
||||
url = "github:nvim-telescope/telescope-live-grep-args.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# formatter
|
||||
|
||||
# https://github.com/sbdchd/neoformat
|
||||
neoformat = {
|
||||
url = "github:sbdchd/neoformat";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# git
|
||||
|
||||
# https://github.com/lewis6991/gitsigns.nvim
|
||||
gitsigns-nvim = {
|
||||
url = "github:lewis6991/gitsigns.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# lsp
|
||||
|
||||
# https://github.com/neovim/nvim-lspconfig
|
||||
nvim-lspconfig = {
|
||||
url = "github:neovim/nvim-lspconfig?rev=d4eb971db353ccf78cefb3be1b05483b69ec1e69";
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/tamago324/nlsp-settings.nvim
|
||||
nlsp-settings-nvim = {
|
||||
url = "github:tamago324/nlsp-settings.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/glepnir/lspsaga.nvim
|
||||
lspsaga-nvim = {
|
||||
url = "github:glepnir/lspsaga.nvim?rev=381900d932db058aa3236ba66cc9f45747c0df71";
|
||||
url = "github:glepnir/lspsaga.nvim?rev=f33bc99d0ed3ed691a58b3339decf4e1933c3f9e";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/L3MON4D3/LuaSnip
|
||||
luasnip = {
|
||||
url = "github:L3MON4D3/LuaSnip";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/hrsh7th/nvim-cmp
|
||||
nvim-cmp = {
|
||||
url = "github:hrsh7th/nvim-cmp";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/hrsh7th/cmp-nvim-lsp
|
||||
cmp-nvim-lsp = {
|
||||
url = "github:hrsh7th/cmp-nvim-lsp";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/saadparwaiz1/cmp_luasnip
|
||||
cmp-luasnip = {
|
||||
url = "github:saadparwaiz1/cmp_luasnip";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# theme
|
||||
|
||||
# https://github.com/nanozuki/tabby.nvim
|
||||
tabby-nvim = {
|
||||
url = "github:nanozuki/tabby.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/nvim-lualine/lualine.nvim
|
||||
lualine-nvim = {
|
||||
url = "github:nvim-lualine/lualine.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/arkav/lualine-lsp-progress
|
||||
lualine-lsp-progress = {
|
||||
url = "github:/arkav/lualine-lsp-progress";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/kyazdani42/nvim-web-devicons
|
||||
nvim-web-devicons = {
|
||||
url = "github:kyazdani42/nvim-web-devicons";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/catppuccin/nvim
|
||||
theme = {
|
||||
url = "github:catppuccin/nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# ux
|
||||
|
||||
# https://github.com/phaazon/hop.nvim
|
||||
hop-nvim = {
|
||||
url = "github:phaazon/hop.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/nvim-orgmode/orgmode
|
||||
nvim-orgmode = {
|
||||
url = "github:nvim-orgmode/orgmode?rev=fc9bb0f5823d01e4008e4b86663772d4148aa9ce";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/akinsho/org-bullets.nvim
|
||||
org-bullets-nvim = {
|
||||
url = "github:akinsho/org-bullets.nvim";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/norcalli/nvim-colorizer.lua
|
||||
nvim-colorizer = {
|
||||
url = "github:norcalli/nvim-colorizer.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# https://github.com/nzlov/cmp-tabby
|
||||
cmp-tabby = {
|
||||
url = "github:nzlov/cmp-tabby";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, utils, ... }:
|
||||
outputs = inputs @ { self, nixpkgs, flake-utils, nix2lua, ... }:
|
||||
let
|
||||
inputPlugins = [
|
||||
"plenary-nvim"
|
||||
# config
|
||||
"editorconfig-nvim"
|
||||
# explorer
|
||||
"nvim-tree-lua"
|
||||
"telescope-nvim"
|
||||
"telescope-live-grep-args-nvim"
|
||||
# formatter
|
||||
"neoformat"
|
||||
# git
|
||||
"gitsigns-nvim"
|
||||
# lsp
|
||||
"nvim-lspconfig"
|
||||
"nlsp-settings-nvim"
|
||||
"lspsaga-nvim"
|
||||
"luasnip"
|
||||
"nvim-cmp"
|
||||
"cmp-nvim-lsp"
|
||||
"cmp-luasnip"
|
||||
# theme
|
||||
"tabby-nvim"
|
||||
"lualine-nvim"
|
||||
"lualine-lsp-progress"
|
||||
"nvim-web-devicons"
|
||||
"theme"
|
||||
# ux
|
||||
"hop-nvim"
|
||||
"nvim-orgmode"
|
||||
"org-bullets-nvim"
|
||||
"nvim-colorizer"
|
||||
"cmp-tabby"
|
||||
];
|
||||
|
||||
mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }:
|
||||
let
|
||||
inherit (builtins) getAttr;
|
||||
inherit (builtins) getAttr attrNames pathExists readDir;
|
||||
inherit (lib) listToAttrs nameValuePair;
|
||||
|
||||
buildPlugin = name: vimUtils.buildVimPluginFrom2Nix {
|
||||
buildPlugin = name: vimUtils.buildVimPlugin {
|
||||
name = name;
|
||||
src = getAttr name inputs;
|
||||
patches = lib.optional
|
||||
(pathExists ./patches/${name})
|
||||
(map
|
||||
(patchName: ./patches/${name}/${patchName})
|
||||
(attrNames (readDir ./patches/${name}))
|
||||
);
|
||||
};
|
||||
|
||||
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
|
||||
|
||||
customPlugins = listToAttrs (map buildPluginValuePair inputPlugins);
|
||||
neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // {
|
||||
inherit (vimPlugins) nvim-treesitter;
|
||||
};
|
||||
in
|
||||
{ vimPlugins = vimPlugins // customPlugins; };
|
||||
{
|
||||
inherit neovimPlugins;
|
||||
inherit nix2lua;
|
||||
};
|
||||
|
||||
mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs);
|
||||
in
|
||||
{
|
||||
overlays = {
|
||||
default = final: prev: {
|
||||
myneovim = prev.callPackage ./. (mkNvimPlugins prev);
|
||||
myneovim = mkNeovim prev;
|
||||
};
|
||||
};
|
||||
} //
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
inherit (builtins) mapAttrs;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
neovim = pkgs.callPackage ./. (mkNvimPlugins pkgs);
|
||||
in
|
||||
{
|
||||
apps.default = {
|
||||
type = "app";
|
||||
program = "${neovim}/bin/nvim";
|
||||
minimalNeovim = mkNeovim pkgs;
|
||||
|
||||
recommendedNeovim = (minimalNeovim.override {
|
||||
enableDevIcons = true;
|
||||
enableTabby = false;
|
||||
|
||||
plugins = with minimalNeovim.nix2lua; {
|
||||
nvimTree.settings = {
|
||||
renderer = {
|
||||
group_empty = true;
|
||||
full_name = true;
|
||||
};
|
||||
};
|
||||
lualine.settings = {
|
||||
options.ignore_focus = [ "NvimTree" ];
|
||||
sections = {
|
||||
lualine_a = [
|
||||
[ "filename" (mkNamedField "path" 1) ]
|
||||
];
|
||||
lualine_b = [ "branch" "diff" "diagnostics" ];
|
||||
lualine_c = [ "lsp_progress" ];
|
||||
lualine_x = [ "filesize" "filetype" ];
|
||||
lualine_y = [ "progress" ];
|
||||
lualine_z = [ "location" "mode" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
fullNeovim = recommendedNeovim.override {
|
||||
plugins = recommendedNeovim.plugins // (with minimalNeovim.nix2lua; {
|
||||
lspSaga.settings = {
|
||||
border_style = "rounded";
|
||||
symbol_in_winbar.enable = false;
|
||||
code_action_lightbulb.enable = false;
|
||||
code_action_keys = { quit = "<Esc>"; };
|
||||
definition_action_keys = { quit = "<Esc>"; };
|
||||
rename_action_quit = "<C-c>";
|
||||
};
|
||||
lspConfig = {
|
||||
servers = {
|
||||
nil_ls = { };
|
||||
tsserver = { };
|
||||
eslint = { };
|
||||
denols = {
|
||||
root_dir = mkLuaRaw "root_pattern(\"deno.json\", \"deno.jsonc\")";
|
||||
};
|
||||
rust_analyzer = {
|
||||
settings.rust-analyzer = {
|
||||
"server.path" = "rust-analyzer";
|
||||
"updates.prompt" = false;
|
||||
"updates.checkOnStartup" = false;
|
||||
"checkOnSave.enable" = true;
|
||||
"checkOnSave.command" = "clippy";
|
||||
"cargo.autoreload" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
tabbyml.enable = true;
|
||||
});
|
||||
};
|
||||
|
||||
packages.default = neovim;
|
||||
packages = {
|
||||
default = recommendedNeovim;
|
||||
recommended = recommendedNeovim;
|
||||
full = fullNeovim;
|
||||
minimal = minimalNeovim;
|
||||
};
|
||||
|
||||
mkApp = drv: {
|
||||
type = "app";
|
||||
program = "${drv}/bin/nvim";
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit packages;
|
||||
|
||||
apps = mapAttrs (name: mkApp) packages;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = [
|
||||
(neovim.override {
|
||||
enableDevIcons = true;
|
||||
enableTabby = true;
|
||||
})
|
||||
pkgs.stylua # lua formatter
|
||||
];
|
||||
};
|
||||
|
|
10
lib.nix
10
lib.nix
|
@ -1,3 +1,5 @@
|
|||
{ lib, substituteAll, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) length elemAt isList isString hasAttr getAttr;
|
||||
|
||||
|
@ -47,9 +49,17 @@ let
|
|||
|
||||
mkLuaRc = contents: concatMap mkLuaHeredoc contents;
|
||||
|
||||
############################################################################
|
||||
# Configs
|
||||
|
||||
readSubFile = src: params: builtins.readFile
|
||||
(substituteAll (params // { inherit src; }));
|
||||
|
||||
in
|
||||
{
|
||||
inherit (lib) importJSON attrByPath;
|
||||
inherit foldr concatMap;
|
||||
inherit optional getAttrOpt;
|
||||
inherit mkLuaHeredoc mkLuaRc;
|
||||
inherit readSubFile substituteAll;
|
||||
}
|
||||
|
|
89
neovim.nix
Normal file
89
neovim.nix
Normal file
|
@ -0,0 +1,89 @@
|
|||
{ enableDevIcons ? false
|
||||
, enableTabby ? false
|
||||
, enableOrgMode ? false
|
||||
, viAlias ? false
|
||||
, vimAlias ? false
|
||||
, extraConfig ? ""
|
||||
, extraLuaConfig ? ""
|
||||
, extraPlugins ? [ ]
|
||||
, theme ? { }
|
||||
, plugins ? { }
|
||||
, wrapNeovim
|
||||
, neovim-unwrapped
|
||||
, tree-sitter
|
||||
, neovimPlugins
|
||||
, lib
|
||||
, nix2lua
|
||||
, substituteAll
|
||||
, callPackage
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
plugins' = plugins;
|
||||
|
||||
mergeAttrs = v:
|
||||
if builtins.isList v then
|
||||
lib.foldl lib.recursiveUpdate { } (map mergeAttrs v)
|
||||
else if v ? _type then
|
||||
if v._type == "merge" then mergeAttrs v.contents
|
||||
else if v._type == "if" then lib.optionalAttrs v.condition v.content
|
||||
else builtins.abort "Unsupported attribute"
|
||||
else v;
|
||||
in
|
||||
let
|
||||
plugins = mergeAttrs plugins';
|
||||
inherit (builtins) catAttrs readFile;
|
||||
|
||||
myLib = import ./lib.nix { inherit lib substituteAll; } // {
|
||||
inherit (nix2lua.lib) toLua LuaNil;
|
||||
};
|
||||
|
||||
|
||||
pluginParams = neovimPlugins // {
|
||||
inherit tree-sitter plugins enableDevIcons enableTabby enableOrgMode;
|
||||
themeCfg = theme;
|
||||
lib = myLib;
|
||||
};
|
||||
|
||||
callPlugin = plugin: callPackage plugin pluginParams;
|
||||
callPlugins = list: map callPlugin list;
|
||||
|
||||
pluginsSettings = callPlugins [
|
||||
./plugins/config
|
||||
./plugins/syntax
|
||||
./plugins/git
|
||||
./plugins/explorer
|
||||
./plugins/theme
|
||||
./plugins/lsp
|
||||
./plugins/formatter
|
||||
./plugins/ux
|
||||
];
|
||||
|
||||
basePlugins = [ neovimPlugins.plenary-nvim ];
|
||||
customPlugins = catAttrs "plugins" pluginsSettings;
|
||||
allPlugins = basePlugins ++ customPlugins ++ extraPlugins;
|
||||
|
||||
basicConfigs = map readFile [ ./config/basic.lua ];
|
||||
pluginConfigs = catAttrs "luaConfig" pluginsSettings;
|
||||
allConfigs = basicConfigs ++ pluginConfigs ++ [ extraLuaConfig ];
|
||||
in
|
||||
(wrapNeovim neovim-unwrapped {
|
||||
inherit viAlias;
|
||||
inherit vimAlias;
|
||||
|
||||
withPython3 = false;
|
||||
withNodeJs = false;
|
||||
withRuby = false;
|
||||
|
||||
configure = {
|
||||
customRC = extraConfig + myLib.mkLuaRc allConfigs;
|
||||
|
||||
packages.myVimPackages = { start = allPlugins; };
|
||||
};
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
passthru = oldAttrs.passthru // {
|
||||
nix2lua = nix2lua.lib;
|
||||
inherit plugins;
|
||||
};
|
||||
})
|
85
patches/nvim-orgmode/remove_check_ts_grammar.patch
Normal file
85
patches/nvim-orgmode/remove_check_ts_grammar.patch
Normal file
|
@ -0,0 +1,85 @@
|
|||
diff --git a/lua/orgmode/init.lua b/lua/orgmode/init.lua
|
||||
index 3b72f78..046a02e 100644
|
||||
--- a/lua/orgmode/init.lua
|
||||
+++ b/lua/orgmode/init.lua
|
||||
@@ -1,11 +1,9 @@
|
||||
_G.orgmode = _G.orgmode or {}
|
||||
-local ts_revision = '081179c52b3e8175af62b9b91dc099d010c38770'
|
||||
-local setup_ts_grammar_used = false
|
||||
local instance = nil
|
||||
|
||||
---@class Org
|
||||
---@field initialized boolean
|
||||
---@field files Files
|
||||
---@field agenda Agenda
|
||||
---@field capture Capture
|
||||
---@field clock Clock
|
||||
@@ -60,52 +58,21 @@ function Org:setup_autocmds()
|
||||
pattern = 'org',
|
||||
group = org_augroup,
|
||||
callback = function()
|
||||
require('orgmode').reload(vim.fn.expand('<afile>:p'))
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
---- @param revision string?
|
||||
-local function setup_ts_grammar(revision)
|
||||
- setup_ts_grammar_used = true
|
||||
- local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
||||
- parser_config.org = {
|
||||
- install_info = {
|
||||
- url = 'https://github.com/milisims/tree-sitter-org',
|
||||
- revision = revision or ts_revision,
|
||||
- files = { 'src/parser.c', 'src/scanner.cc' },
|
||||
- },
|
||||
- filetype = 'org',
|
||||
- }
|
||||
-end
|
||||
-
|
||||
-local function check_ts_grammar()
|
||||
- vim.defer_fn(function()
|
||||
- if setup_ts_grammar_used then
|
||||
- return
|
||||
- end
|
||||
- local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
||||
- if parser_config and parser_config.org and parser_config.org.install_info.revision ~= ts_revision then
|
||||
- require('orgmode.utils').echo_error({
|
||||
- 'You are using outdated version of tree-sitter grammar for Orgmode.',
|
||||
- 'To use latest version, replace current grammar installation with "require(\'orgmode\').setup_ts_grammar()" and run :TSUpdate org.',
|
||||
- 'More info in setup section of readme: https://github.com/nvim-orgmode/orgmode#setup',
|
||||
- })
|
||||
- end
|
||||
- end, 200)
|
||||
-end
|
||||
-
|
||||
---@param opts? table
|
||||
---@return Org
|
||||
local function setup(opts)
|
||||
opts = opts or {}
|
||||
instance = Org:new()
|
||||
- check_ts_grammar()
|
||||
local config = require('orgmode.config'):extend(opts)
|
||||
vim.defer_fn(function()
|
||||
if config.notifications.enabled and #vim.api.nvim_list_uis() > 0 then
|
||||
require('orgmode.parser.files').load(vim.schedule_wrap(function()
|
||||
instance.notifications = require('orgmode.notifications'):new():start_timer()
|
||||
end))
|
||||
end
|
||||
config:setup_mappings('global')
|
||||
@@ -187,15 +154,14 @@ end
|
||||
function _G.orgmode.statusline()
|
||||
if not instance or not instance.initialized then
|
||||
return ''
|
||||
end
|
||||
return instance.statusline_debounced() or ''
|
||||
end
|
||||
|
||||
return {
|
||||
- setup_ts_grammar = setup_ts_grammar,
|
||||
setup = setup,
|
||||
reload = reload,
|
||||
action = action,
|
||||
cron = cron,
|
||||
instance = get_instance,
|
||||
}
|
5
plugins/config/default.nix
Normal file
5
plugins/config/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ editorconfig-nvim, ... }:
|
||||
|
||||
{
|
||||
plugins = [ editorconfig-nvim ];
|
||||
}
|
22
plugins/explorer/default.nix
Normal file
22
plugins/explorer/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ lib
|
||||
, plugins ? { }
|
||||
, nvim-tree-lua
|
||||
, telescope-nvim
|
||||
, telescope-live-grep-args-nvim
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
|
||||
nvimTreeLuaSettings = lib.toLua (lib.attrByPath [ "nvimTree" "settings" ] { } plugins);
|
||||
telescopeSettings = lib.toLua (lib.attrByPath [ "telescope" "settings" ] { } plugins);
|
||||
in
|
||||
{
|
||||
luaConfig =
|
||||
(readFile (lib.substituteAll { src = ./nvim-tree.lua; inherit nvimTreeLuaSettings; }))
|
||||
+ (readFile (lib.substituteAll { src = ./telescope-nvim.lua; inherit telescopeSettings; }));
|
||||
|
||||
plugins = [ nvim-tree-lua ]
|
||||
++ [ telescope-nvim telescope-live-grep-args-nvim ];
|
||||
}
|
26
plugins/explorer/nvim-tree.lua
Normal file
26
plugins/explorer/nvim-tree.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
-- See: https://github.com/kyazdani42/nvim-tree.lua/blob/master/doc/nvim-tree-lua.txt
|
||||
require("nvim-tree").setup(@nvimTreeLuaSettings@)
|
||||
|
||||
vim.keymap.set("n", "<leader>nt", "<Cmd>NvimTreeToggle<CR>")
|
||||
vim.keymap.set("n", "<leader>nf", "<Cmd>NvimTreeFindFile<CR>")
|
||||
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not no_name and not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
14
plugins/explorer/telescope-nvim.lua
Normal file
14
plugins/explorer/telescope-nvim.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
-- See: https://github.com/nvim-telescope/telescope.nvim
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup(@telescopeSettings@)
|
||||
telescope.load_extension("live_grep_args")
|
||||
|
||||
vim.keymap.set("n", "<leader>ff", "<Cmd>Telescope find_files hidden=true<CR>")
|
||||
vim.keymap.set("n", "<leader>fb", "<Cmd>Telescope buffers<CR>")
|
||||
vim.keymap.set("n", "<leader>fh", "<Cmd>Telescope help_tags<CR>")
|
||||
|
||||
-- required telescope-live-grep-args-nvim plugin
|
||||
vim.keymap.set("n", "<leader>fg", function()
|
||||
telescope.extensions.live_grep_args.live_grep_args()
|
||||
end)
|
10
plugins/formatter/default.nix
Normal file
10
plugins/formatter/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ neoformat, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
in
|
||||
{
|
||||
luaConfig = readFile ./neoformat.lua;
|
||||
|
||||
plugins = [ neoformat ];
|
||||
}
|
15
plugins/formatter/neoformat.lua
Normal file
15
plugins/formatter/neoformat.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
vim.g.neoformat_try_node_exe = 1
|
||||
vim.g.neoformat_only_msg_on_error = 1
|
||||
vim.g.neoformat_enabled_markdown = { "denofmt" }
|
||||
vim.g.neoformat_rust_rustfmt = {
|
||||
exe = "rustfmt",
|
||||
args = { "--edition 2021" },
|
||||
stdin = 1,
|
||||
}
|
||||
|
||||
vim.cmd([[
|
||||
aug fmt
|
||||
au!
|
||||
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
|
||||
aug END
|
||||
]])
|
10
plugins/git/default.nix
Normal file
10
plugins/git/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ gitsigns-nvim, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
in
|
||||
{
|
||||
luaConfig = readFile ./gitsigns-nvim.lua;
|
||||
|
||||
plugins = [ gitsigns-nvim ];
|
||||
}
|
52
plugins/git/gitsigns-nvim.lua
Normal file
52
plugins/git/gitsigns-nvim.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
function on_attach(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map("n", "]h", function()
|
||||
if vim.wo.diff then
|
||||
return "]h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
map("n", "[h", function()
|
||||
if vim.wo.diff then
|
||||
return "[h"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ "n", "v" }, "<leader>gs", ":Gitsigns stage_hunk<CR>")
|
||||
map({ "n", "v" }, "<leader>gr", ":Gitsigns reset_hunk<CR>")
|
||||
map("n", "<leader>gu", gs.undo_stage_hunk)
|
||||
map("n", "<leader>gp", gs.preview_hunk)
|
||||
map("n", "<leader>gb", function()
|
||||
gs.blame_line({ full = true })
|
||||
end)
|
||||
map("n", "<leader>gtb", gs.toggle_current_line_blame)
|
||||
map("n", "<leader>gd", gs.diffthis)
|
||||
map("n", "<leader>gD", function()
|
||||
gs.diffthis("~")
|
||||
end)
|
||||
|
||||
-- Text object
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||
end
|
||||
|
||||
-- See: https://github.com/lewis6991/gitsigns.nvim
|
||||
require("gitsigns").setup({
|
||||
on_attach = on_attach,
|
||||
})
|
3
plugins/lsp/cmp-tabby.lua
Normal file
3
plugins/lsp/cmp-tabby.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
local tabby = require('cmp_tabby.config')
|
||||
|
||||
tabby:setup(@tabbymlSettings@)
|
|
@ -1,13 +1,51 @@
|
|||
{ nvim-lspconfig
|
||||
{ lib
|
||||
, plugins
|
||||
, nvim-lspconfig
|
||||
, nlsp-settings-nvim
|
||||
, lspsaga-nvim
|
||||
, luasnip
|
||||
, nvim-cmp
|
||||
, cmp-nvim-lsp
|
||||
, cmp-luasnip
|
||||
, cmp-tabby
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
lsp = [ nvim-lspconfig lspsaga-nvim ];
|
||||
tabbymlEnable = lib.attrByPath [ "tabbyml" "enable" ] false plugins;
|
||||
tabbymlDefaultSettings = {
|
||||
host = "http://127.0.0.1:8080";
|
||||
max_lines = 100;
|
||||
};
|
||||
tabbymlSettings = lib.toLua (lib.attrByPath [ "tabbyml" "settings" ] tabbymlDefaultSettings plugins);
|
||||
tabbymlLuaConfig = lib.optional tabbymlEnable
|
||||
(lib.readSubFile ./cmp-tabby.lua { inherit tabbymlSettings; });
|
||||
|
||||
cmpSources = lib.toLua ([
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "orgmode"; }
|
||||
] ++ lib.optional tabbymlEnable [{ name = "cmp_tabby"; }]);
|
||||
cmpLuaConfig = lib.readSubFile ./nvim-cmp.lua { inherit cmpSources; };
|
||||
|
||||
lspconfigLuaConfig = lib.readSubFile ./lspconfig.lua
|
||||
{ inherit lspConfigServers lspSagaSettings; };
|
||||
|
||||
lsp = [ nvim-lspconfig nlsp-settings-nvim lspsaga-nvim ];
|
||||
snippets = [ luasnip ];
|
||||
completions = [
|
||||
nvim-cmp # Autocompletion
|
||||
cmp-nvim-lsp # LSP source for nvim-cmp
|
||||
cmp-luasnip # Snippets source for nvim-cmp
|
||||
] ++ lib.optional tabbymlEnable [ cmp-tabby ];
|
||||
|
||||
lspConfigServers = lib.toLua (lib.attrByPath [ "lspConfig" "servers" ] [ ] plugins);
|
||||
lspSagaSettings = lib.toLua (lib.attrByPath [ "lspSaga" "settings" ] { } plugins);
|
||||
in
|
||||
{
|
||||
luaConfig = (builtins.readFile ./lspconfig.lua);
|
||||
luaConfig = lspconfigLuaConfig + tabbymlLuaConfig + cmpLuaConfig;
|
||||
|
||||
plugins = lsp;
|
||||
plugins = lsp
|
||||
++ snippets
|
||||
++ completions;
|
||||
}
|
||||
|
|
|
@ -1,31 +1,81 @@
|
|||
local lsp_config = require("lspconfig")
|
||||
local saga = require("lspsaga")
|
||||
local nlsp_settings = require("nlspsettings")
|
||||
|
||||
-- See: https://github.com/glepnir/lspsaga.nvim#configuration
|
||||
saga.init_lsp_saga({
|
||||
code_action_lightbulb = { enable = false },
|
||||
symbol_in_winbar = { enable = false },
|
||||
})
|
||||
saga.init_lsp_saga(@lspSagaSettings@)
|
||||
|
||||
-- always show signcolumns
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", "<Cmd>Lspsaga diagnostic_jump_prev<CR>", opts)
|
||||
vim.keymap.set("n", "]d", "<Cmd>Lspsaga diagnostic_jump_next<CR>", opts)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Only jump to error
|
||||
vim.keymap.set("n", "[e", function()
|
||||
require("lspsaga.diagnostic").goto_prev({ severity = vim.diagnostic.severity.ERROR })
|
||||
end, opts)
|
||||
vim.keymap.set("n", "]e", function()
|
||||
require("lspsaga.diagnostic").goto_next({ severity = vim.diagnostic.severity.ERROR })
|
||||
end, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
-- vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set("n", "gy", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
|
||||
-- vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
-- vim.keymap.set("n", "<localleader>f", vim.lsp.buf.formatting, bufopts)
|
||||
vim.keymap.set("n", "<localleader>n", "<Cmd>Lspsaga rename<CR>", bufopts)
|
||||
vim.keymap.set('n', '<localleader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set({ "n", "v" }, "<localleader>a", "<Cmd>Lspsaga code_action<CR>", bufopts)
|
||||
vim.keymap.set("n", "K", "<Cmd>Lspsaga hover_doc<CR>", bufopts)
|
||||
vim.keymap.set("n", "co", "<Cmd>LSoutlineToggle<CR>", bufopts)
|
||||
end
|
||||
|
||||
-- nvim-cmp
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- for local configurations
|
||||
nlsp_settings.setup({})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
--
|
||||
|
||||
vim.g.markdown_fenced_languages = { "ts=typescript" }
|
||||
|
||||
-- Override the default configuration to be applied to all servers
|
||||
lsp_config.util.default_config = vim.tbl_extend("force", lsp_config.util.default_config, {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- nix
|
||||
lsp_config.nil_ls.setup({})
|
||||
local root_pattern = lsp_config.util.root_pattern
|
||||
|
||||
for name, settings in pairs(@lspConfigServers@) do
|
||||
lsp_config[name].setup(settings)
|
||||
|
||||
if name == "eslint" then
|
||||
vim.cmd([[
|
||||
aug eslint_fix
|
||||
au!
|
||||
au BufWritePre *.tsx,*.ts,*.jsx,*.js silent! EslintFixAll
|
||||
aug END
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
40
plugins/lsp/nvim-cmp.lua
Normal file
40
plugins/lsp/nvim-cmp.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources(@cmpSources@),
|
||||
})
|
184
plugins/syntax/default.nix
Normal file
184
plugins/syntax/default.nix
Normal file
|
@ -0,0 +1,184 @@
|
|||
{ runCommand
|
||||
, fetchFromGitea
|
||||
, ...
|
||||
} @ inputs:
|
||||
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
|
||||
extraGrammars = {
|
||||
tree-sitter-d2 = {
|
||||
language = "d2";
|
||||
version = "2023-06-21";
|
||||
src = fetchFromGitea {
|
||||
domain = "git.pleshevski.ru";
|
||||
owner = "pleshevskiy";
|
||||
repo = "tree-sitter-d2";
|
||||
rev = "8a9d50043d58eedf1e375b0e2059e43efd856902";
|
||||
sha256 = "sha256-ZhVjxo7Xi7DaHN3qabUcykflY74bUqPcOA410fA3zRk=";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
tree-sitter = (inputs.tree-sitter.override { inherit extraGrammars; });
|
||||
customGrammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]);
|
||||
|
||||
nvim-treesitter = (inputs.nvim-treesitter.withPlugins (g: [
|
||||
# g.agda
|
||||
# g.arduino
|
||||
# g.astro
|
||||
g.awk
|
||||
g.bash
|
||||
# g.beancount
|
||||
# g.bibtex
|
||||
# g.blueprint
|
||||
# g.c
|
||||
# g.c_sharp
|
||||
# g.clojure
|
||||
g.cmake
|
||||
g.comment
|
||||
g.commonlisp
|
||||
# g.cooklang
|
||||
# g.cpp
|
||||
g.css
|
||||
# g.cuda
|
||||
# g.d
|
||||
# g.d2
|
||||
# g.dart
|
||||
# g.devicetree
|
||||
g.diff
|
||||
g.dockerfile
|
||||
# g.dot
|
||||
# g.eex
|
||||
# g.elixir
|
||||
g.elm
|
||||
# g.elvish
|
||||
g.embedded_template
|
||||
# g.erlang
|
||||
# g.fennel
|
||||
# g.fish
|
||||
# g.foam
|
||||
# g.fortran
|
||||
# g.fusion
|
||||
# g.gdscript
|
||||
g.git_rebase
|
||||
g.gitattributes
|
||||
g.gitignore
|
||||
# g.gleam
|
||||
# g.glimmer
|
||||
# g.glsl
|
||||
# g.go
|
||||
# g.godot_resource
|
||||
# g.gomod
|
||||
# g.gowork
|
||||
g.graphql
|
||||
# g.hack
|
||||
g.haskell
|
||||
# g.hcl
|
||||
# g.heex
|
||||
# g.hjson
|
||||
# g.hlsl
|
||||
# g.hocon
|
||||
g.html
|
||||
g.http
|
||||
# g.java
|
||||
g.javascript
|
||||
g.jq
|
||||
g.jsdoc
|
||||
g.json
|
||||
g.json5
|
||||
g.jsonc
|
||||
# g.jsonnet
|
||||
# g.julia
|
||||
# g.kotlin
|
||||
# g.lalrpop
|
||||
# g.latex
|
||||
g.ledger
|
||||
# g.llvm
|
||||
g.lua
|
||||
# g.m68k
|
||||
g.make
|
||||
g.markdown
|
||||
g.markdown_inline
|
||||
# g.menhir
|
||||
# g.meson
|
||||
g.nickel
|
||||
# g.ninja
|
||||
g.nix
|
||||
# g.norg
|
||||
# g.ocaml
|
||||
# g.ocaml_interface
|
||||
# g.ocamllex
|
||||
g.org
|
||||
# g.pascal
|
||||
# g.perl
|
||||
# g.php
|
||||
# g.phpdoc
|
||||
# g.pioasm
|
||||
# g.prisma
|
||||
# g.proto
|
||||
g.pug
|
||||
g.python
|
||||
# g.ql
|
||||
# g.qmljs
|
||||
g.query
|
||||
# g.r
|
||||
# g.racket
|
||||
# g.rasi
|
||||
g.regex
|
||||
# g.rego
|
||||
# g.rnoweb
|
||||
# g.rst
|
||||
# g.ruby
|
||||
g.rust
|
||||
# g.scala
|
||||
g.scheme
|
||||
g.scss
|
||||
# g.slint
|
||||
# g.solidity
|
||||
# g.sparql
|
||||
g.sql
|
||||
# g.supercollider
|
||||
# g.surface
|
||||
# g.svelte
|
||||
# g.swift
|
||||
# g.sxhkdrc
|
||||
# g.teal
|
||||
# g.tiger
|
||||
# g.tlaplus
|
||||
g.todotxt
|
||||
g.toml
|
||||
g.tsx
|
||||
# g.turtle
|
||||
# g.twig
|
||||
g.typescript
|
||||
# g.v
|
||||
# g.vala
|
||||
# g.verilog
|
||||
# g.vhs
|
||||
g.vim
|
||||
g.vue
|
||||
# g.wgsl
|
||||
g.yaml
|
||||
# g.yang
|
||||
# g.zig
|
||||
])).overrideAttrs (oldAttrs: {
|
||||
passthru.dependencies = oldAttrs.passthru.dependencies ++ [
|
||||
(runCommand "nvim-treesitter-d2-grammar" { } ''
|
||||
mkdir -p $out/parser
|
||||
ln -s ${customGrammars}/d2.so $out/parser/d2.so
|
||||
'')
|
||||
];
|
||||
postPatch = ''
|
||||
ln -s ${extraGrammars.tree-sitter-d2.src}/queries queries/d2
|
||||
'';
|
||||
});
|
||||
in
|
||||
{
|
||||
luaConfig = readFile ./treesitter.lua;
|
||||
|
||||
plugins = [
|
||||
nvim-treesitter
|
||||
];
|
||||
}
|
11
plugins/syntax/tree-sitter-org-nvim.json
Normal file
11
plugins/syntax/tree-sitter-org-nvim.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"url": "https://github.com/milisims/tree-sitter-org",
|
||||
"rev": "081179c52b3e8175af62b9b91dc099d010c38770",
|
||||
"date": "2022-10-21T23:23:29-04:00",
|
||||
"path": "/nix/store/7jy3jqyd02kryfgz16k3zxg2kmjz0wqf-tree-sitter-org",
|
||||
"sha256": "0h9krbaq9j6ijf86sg0w221s0zbpbx5f7m1l0whzjahbrqpnqgxl",
|
||||
"fetchLFS": false,
|
||||
"fetchSubmodules": false,
|
||||
"deepClone": false,
|
||||
"leaveDotGit": false
|
||||
}
|
15
plugins/syntax/treesitter.lua
Normal file
15
plugins/syntax/treesitter.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
parser_config.d2 = {}
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {},
|
||||
sync_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
36
plugins/theme/default.nix
Normal file
36
plugins/theme/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ lib
|
||||
, plugins
|
||||
, theme
|
||||
, lualine-nvim
|
||||
, lualine-lsp-progress
|
||||
, nvim-web-devicons
|
||||
, tabby-nvim
|
||||
, enableDevIcons ? false
|
||||
, enableTabby ? false
|
||||
, themeCfg ? { }
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
|
||||
themeFlavour = if themeCfg ? flavour then theme.flavour else "frappe";
|
||||
themeConfig = if themeCfg ? config then theme.config else ''
|
||||
vim.g.catppuccin_flavour = "${themeFlavour}"
|
||||
require("catppuccin").setup()
|
||||
vim.cmd([[colorscheme catppuccin]])
|
||||
'';
|
||||
|
||||
lualineSettings = lib.toLua (lib.attrByPath [ "lualine" "settings" ] { } plugins);
|
||||
lualinePlugins = [ lualine-nvim lualine-lsp-progress ];
|
||||
in
|
||||
{
|
||||
luaConfig = themeConfig
|
||||
+ (readFile (lib.substituteAll { src = ./lualine.lua; inherit lualineSettings; }))
|
||||
+ (lib.optional enableTabby (readFile ./tabby-nvim.lua));
|
||||
|
||||
plugins = [ theme ]
|
||||
++ lualinePlugins
|
||||
++ (lib.optional enableDevIcons [ nvim-web-devicons ])
|
||||
++ (lib.optional enableTabby [ tabby-nvim ]);
|
||||
}
|
2
plugins/theme/lualine.lua
Normal file
2
plugins/theme/lualine.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- See: https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
||||
require("lualine").setup(@lualineSettings@)
|
5
plugins/theme/tabby-nvim.lua
Normal file
5
plugins/theme/tabby-nvim.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- always display tabline
|
||||
-- vim.o.showtabline = 2
|
||||
|
||||
-- See: https://github.com/nanozuki/tabby.nvim
|
||||
require("tabby.tabline").use_preset("tab_only")
|
32
plugins/ux/default.nix
Normal file
32
plugins/ux/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ lib
|
||||
, plugins
|
||||
, hop-nvim
|
||||
, nvim-orgmode
|
||||
, nvim-colorizer
|
||||
, org-bullets-nvim
|
||||
, enableOrgMode ? false
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (builtins) readFile;
|
||||
|
||||
hopLuaConfig = readFile ./hop-nvim.lua;
|
||||
|
||||
orgmodeEnable = lib.attrByPath [ "orgmode" "enable" ] enableOrgMode plugins;
|
||||
orgmodeSettings = lib.toLua (lib.attrByPath [ "orgmode" "settings" ] { } plugins);
|
||||
orgmodeLuaConfig = lib.optional orgmodeEnable
|
||||
(lib.readSubFile ./nvim-orgmode.lua { inherit orgmodeSettings; });
|
||||
|
||||
colorizerFiletypes = lib.toLua (lib.attrByPath [ "colorizer" "filetypes" ] lib.LuaNil plugins);
|
||||
colorizerSettings = lib.toLua (lib.attrByPath [ "colorizer" "settings" ] lib.LuaNil plugins);
|
||||
colorizerLuaConfig = lib.readSubFile ./nvim-colorizer.lua
|
||||
{ inherit colorizerFiletypes colorizerSettings; };
|
||||
|
||||
in
|
||||
{
|
||||
luaConfig = hopLuaConfig + orgmodeLuaConfig + colorizerLuaConfig;
|
||||
|
||||
plugins = [ hop-nvim nvim-colorizer ]
|
||||
++ lib.optional orgmodeEnable [ nvim-orgmode org-bullets-nvim ];
|
||||
}
|
67
plugins/ux/hop-nvim.lua
Normal file
67
plugins/ux/hop-nvim.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
-- See: https://github.com/phaazon/hop.nvim/wiki/Configuration
|
||||
local hop = require("hop")
|
||||
require("hop").setup({})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Keybindings
|
||||
|
||||
local hint = require("hop.hint")
|
||||
|
||||
vim.keymap.set("", "<leader>hc", "<Cmd>HopChar1<CR>")
|
||||
vim.keymap.set("", "<leader>hlc", function()
|
||||
hop.hint_char1({
|
||||
direction = hint.HintDirection.AFTER_CURSOR,
|
||||
current_line_only = true,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hhc", function()
|
||||
hop.hint_char1({
|
||||
direction = hint.HintDirection.BEFORE_CURSOR,
|
||||
current_line_only = true,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hjc", function()
|
||||
hop.hint_char1({
|
||||
direction = hint.HintDirection.AFTER_CURSOR,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hkc", function()
|
||||
hop.hint_char1({
|
||||
direction = hint.HintDirection.BEFORE_CURSOR,
|
||||
})
|
||||
end)
|
||||
|
||||
vim.keymap.set("", "<leader>hw", "<Cmd>HopWord<CR>")
|
||||
vim.keymap.set("", "<leader>hjw", function()
|
||||
hop.hint_words({
|
||||
direction = hint.HintDirection.AFTER_CURSOR,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hkw", function()
|
||||
hop.hint_words({
|
||||
direction = hint.HintDirection.BEFORE_CURSOR,
|
||||
})
|
||||
end)
|
||||
|
||||
vim.keymap.set("", "<leader>hp", "<Cmd>HopPattern<CR>")
|
||||
vim.keymap.set("", "<leader>hjp", function()
|
||||
hop.hint_patterns({
|
||||
direction = hint.HintDirection.AFTER_CURSOR,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hkp", function()
|
||||
hop.hint_patterns({
|
||||
direction = hint.HintDirection.BEFORE_CURSOR,
|
||||
})
|
||||
end)
|
||||
|
||||
vim.keymap.set("", "<leader>hjv", function()
|
||||
hop.hint_vertical({
|
||||
direction = hint.HintDirection.AFTER_CURSOR,
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("", "<leader>hkv", function()
|
||||
hop.hint_vertical({
|
||||
direction = hint.HintDirection.BEFORE_CURSOR,
|
||||
})
|
||||
end)
|
1
plugins/ux/nvim-colorizer.lua
Normal file
1
plugins/ux/nvim-colorizer.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("colorizer").setup(@colorizerFiletypes@, @colorizerSettings@)
|
3
plugins/ux/nvim-orgmode.lua
Normal file
3
plugins/ux/nvim-orgmode.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require("orgmode").setup(@orgmodeSettings@)
|
||||
|
||||
require("org-bullets").setup()
|
3
shell.nix
Normal file
3
shell.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
|
||||
src = builtins.fetchGit ./.;
|
||||
}).shellNix
|
Reference in a new issue