Compare commits

..

75 commits

Author SHA1 Message Date
6bbb562216
add support of lib.mkMerge 2024-04-16 16:23:17 +03:00
40bc84d1f8
fixup: use LuaNil instead of deprecated one 2024-03-28 13:42:55 +03:00
d280679b14
flake.lock: update nix2lua 2024-02-28 16:57:10 +03:00
dfef2d38b1
plugins/syntax: add missed tsx 2023-12-08 13:06:16 +03:00
542364e035
flake.lock: update nixpkgs to latest master 2023-11-30 15:00:48 +03:00
ddc7c23ef6
enable nickel syntax 2023-10-31 16:38:37 +03:00
41585809d7
flake.lock: bump all plugins 2023-09-28 12:50:57 +03:00
e4411e7378
lsp: ignore eslint errors 2023-06-21 12:39:58 +03:00
c414c1d302
syntax: update d2 grammar 2023-06-21 12:25:48 +03:00
23a3e4c52e
syntax: add missed toml grammar 2023-06-16 07:51:28 +03:00
c4374c0037
deps: bump tree-sitter-d2 2023-06-16 07:46:15 +03:00
c3a3fe588f
deps: bump nixpkgs 2023-06-16 01:11:48 +03:00
e572ba6d78
deps: bump tree-sitter-d2 2023-06-16 01:11:48 +03:00
b4a93f588f
fix tabbyml plugin 2023-06-09 15:32:03 +03:00
91b9f31c3f
add tabbyml 2023-06-09 14:37:41 +03:00
45117804e7
lsp: change key mappings 2023-05-29 10:29:20 +03:00
3717b5002d
some cleanup 2023-05-23 00:19:13 +03:00
54333ac0a6
ux/colorize: use nil by default 2023-05-22 15:17:52 +03:00
ecd458f1d3
ux: configure colorize plugin via props 2023-05-22 14:15:44 +03:00
dc2181a344
ux: add colorizer.lua plugin 2023-05-22 13:45:55 +03:00
06b4e995bf
syntax: exclude unused grammars 2023-04-14 17:46:12 +03:00
b7a44b014a
deps: update all deps 2023-04-14 17:46:10 +03:00
db6fc1b83b
flake.lock: update plugins to latest version 2023-03-27 23:59:52 +03:00
904a97ea5f
bump all plugins to latest version 2023-02-03 02:22:57 +03:00
6942284275
plugins/explorer: bump nvim-tree and telescope plugins 2023-01-08 15:53:19 +03:00
020520b007
config!: add extraConfig
BREAKING: rename extraConfig to extraLuaConfig
2023-01-08 15:40:53 +03:00
ecd8cd11ed
config: use nvim-treesitter for folding 2022-12-14 16:09:11 +03:00
2a44c3e661
plugins/syntax: bump tree-sitter-d2 to latest version 2022-12-13 16:47:08 +03:00
5c5878a64f
plugins/syntax: bump tree-sitter-d2 to latest version 2022-12-13 15:55:18 +03:00
a84098dd91
update lock file 2022-12-13 10:09:12 +03:00
efd4f06e0d
plugins/syntax: fix tree-sitter parsers 2022-12-13 00:05:40 +03:00
6dd623dd38
plugins/syntax: fix tree-sitter parsers 2022-12-13 00:00:47 +03:00
69355e6429
plugins/syntax: fix tree-sitter parsers 2022-12-12 23:28:26 +03:00
d576379760
add d2 tree-sitter grammar 2022-12-12 21:50:03 +03:00
70c85a004f
plugins/explorer: bump nvim-tree plugin 2022-12-12 00:49:03 +03:00
ad87fe9316
use nvim-treesitter with all grammars 2022-12-09 22:55:50 +03:00
1504ad1ad0
plugins/formatter: bump neoformat plugin to latest version 2022-12-02 02:59:28 +03:00
d317a7c665
bump orgmode plugin and update patch 2022-12-01 10:18:47 +03:00
99e095d919
add options to configure extra plugins 2022-11-30 22:52:01 +03:00
437e0e05cf
add flake compat 2022-11-30 22:49:32 +03:00
005ddc0b9e
bump orgmode plugin 2022-11-30 22:42:36 +03:00
2de32b283e
bump tabby plugin 2022-11-30 22:41:33 +03:00
d991c749c2
nix: use nvim-treesitter from nixpkgs 2022-11-26 13:25:19 +03:00
dc805ab062
plugins/formatter: use latest edition for rustfmt 2022-11-23 22:50:16 +03:00
ae6faa78c5
bump nix2lua to latest version 2022-11-22 11:10:10 +03:00
7d91e495dc
update treesitter and nixpkgs 2022-11-19 23:59:09 +03:00
aa9f2ccb68
plugins/lsp: move eslint fix command to lsp section 2022-11-19 21:02:45 +03:00
4edf3f4d64
add nix2lua to passthru 2022-11-19 19:52:39 +03:00
465f27ac0c
update neovim 2022-11-19 16:38:31 +03:00
ea2231f615
integrate with nix2lua 2022-11-19 00:56:53 +03:00
42e6ef422f
plugins/lsp: change deno root_dir pattern 2022-11-18 14:04:39 +03:00
1067059290
plugins/lsp: configure deno ls 2022-11-18 00:03:44 +03:00
4811c8054c
use only plugins from flake config 2022-11-17 23:44:45 +03:00
93b5f04284
plugins/explorer: bump nvim-tree plugin 2022-11-17 23:37:46 +03:00
91e0909ac6
plugins/lsp: add nlsp-settings plugin 2022-11-10 00:01:34 +03:00
a44c17c95a
plugins/ux: add more hotkeys for navigation 2022-11-08 12:12:18 +03:00
f8d8c99ac5
bump editoconfig plugin 2022-11-08 11:31:10 +03:00
2b24da8720
fixup: rename orgmode patch 2022-11-02 04:11:18 +03:00
3463a6c419
fixup: use lib.optional instead of lib.mkIf 2022-11-02 04:04:35 +03:00
23fce1be6c
fixup: fix patches folder 2022-11-02 04:00:12 +03:00
0d27956624
plugins/ux: don't check tree-sitter orgmode 2022-11-02 01:14:06 +03:00
019d8ae991
fix luasnip plugins 2022-11-01 11:23:55 +03:00
621f99403b
update nvim-tree plugin version 2022-10-31 10:54:24 +03:00
9dca04d9b2
plugins/explorer: add usefull renderer parameters to nvim-tree 2022-10-25 22:33:29 +03:00
b6f33bfb03
ux: add orgmode plugin 2022-10-22 23:35:27 +03:00
116764c3a0
plugins/syntax: config ts grammar file types via override 2022-10-19 11:53:12 +03:00
cf97347ae5
plugins/explorer: bump nvim-tree plugin 2022-10-19 11:37:08 +03:00
5225154c6c
deps: revert nvim-tree-lua 2022-10-11 21:55:26 +03:00
8957cc62e6
deps: bump lspsaga-nvim, nvim-tree-lua, telescope-nvim 2022-10-11 08:19:36 +03:00
b22dfff883
plugins/explorer: bump nvim-tree 2022-10-04 21:42:41 +03:00
ccc489bbbd
plugins/lsp: bump lspsaga 2022-10-04 14:39:30 +03:00
1e9bae6c7b
plugins/explorer: remove nvim-tree recommended opts to fix spell 2022-10-03 13:55:34 +03:00
89665d9a4a
plugins/lsp: change binding for lspsaga-rename-quit 2022-10-03 10:09:32 +03:00
27b6718d38
plugins/lsp: bump lspsaga 2022-10-03 09:46:58 +03:00
6f09704969
plugins/lsp: bump lspsaga 2022-10-03 09:23:18 +03:00
31 changed files with 1700 additions and 103 deletions

View file

@ -1,3 +1,179 @@
-------------------------------------------------------------------------------
--
-- Basic Settings
--
vim.cmd("filetype off")
-- Leaders -- Leaders
vim.g.mapleader = "," vim.g.mapleader = ","
vim.g.maplocalleader = "-" 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")

View file

@ -1,47 +1,3 @@
{ enableDevIcons ? false (import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
, enableBarBar ? false src = builtins.fetchGit ./.;
, enableTabby ? false }).defaultNix
, 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; };
};
}

View file

@ -1 +0,0 @@
let is-hello-world = true; in { }

View file

@ -1,29 +1,222 @@
{ {
"nodes": { "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": { "lspsaga-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1664704370, "lastModified": 1665291018,
"narHash": "sha256-f0pwssdEI5mAO/Ov8E9DpT/E+5Xi3DvMjo4ui+TX3go=", "narHash": "sha256-jkoEP5jeIZDAK/27gpNTXtW10/Ev9nB5RqUahPhja2Y=",
"owner": "glepnir", "owner": "glepnir",
"repo": "lspsaga.nvim", "repo": "lspsaga.nvim",
"rev": "381900d932db058aa3236ba66cc9f45747c0df71", "rev": "f33bc99d0ed3ed691a58b3339decf4e1933c3f9e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "glepnir", "owner": "glepnir",
"repo": "lspsaga.nvim", "repo": "lspsaga.nvim",
"rev": "381900d932db058aa3236ba66cc9f45747c0df71", "rev": "f33bc99d0ed3ed691a58b3339decf4e1933c3f9e",
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1663146586, "lastModified": 1701237617,
"narHash": "sha256-VCGdyEc5TF0uq+gdU+jesjZcNxptomDunvGtElmAD9I=", "narHash": "sha256-Ryd8xpNDY9MJnBFDYhB37XSFIxCPVVVXAbInNPa95vs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "125efbd96af28ea5d60e00a3eed832ea3f49a93b", "rev": "85306ef2470ba705c97ce72741d56e42d0264015",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -33,31 +226,143 @@
"type": "github" "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": { "nvim-lspconfig": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1663921594, "lastModified": 1695879754,
"narHash": "sha256-uCFhwcR4oW+4wrSt6rx5G8k75dOLeqmYzW1G1CYlLkM=", "narHash": "sha256-eUyyB/P52AZz3rl2n9ntGIp3b0x0s/TF/fQZ/30UeC0=",
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"rev": "d4eb971db353ccf78cefb3be1b05483b69ec1e69", "rev": "c7077400d004c1a424d210af76ce198250db72fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "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" "type": "github"
} }
}, },
"plenary-nvim": { "plenary-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1663402373, "lastModified": 1694526433,
"narHash": "sha256-d06QP5JGhpH6UUVF9STYzfJMzvg5HrJfDqlAoVXaLeM=", "narHash": "sha256-s3qsKf05X5W1VdZT1vYXGQNK0UaiI+umWUf06Spe4hw=",
"owner": "nvim-lua", "owner": "nvim-lua",
"repo": "plenary.nvim", "repo": "plenary.nvim",
"rev": "62dc2a7acd2fb2581871a36c1743b29e26c60390", "rev": "9ce85b0f7dcfe5358c0be937ad23e456907d410b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,25 +373,111 @@
}, },
"root": { "root": {
"inputs": { "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", "lspsaga-nvim": "lspsaga-nvim",
"lualine-lsp-progress": "lualine-lsp-progress",
"lualine-nvim": "lualine-nvim",
"luasnip": "luasnip",
"neoformat": "neoformat",
"nix2lua": "nix2lua",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nlsp-settings-nvim": "nlsp-settings-nvim",
"nvim-cmp": "nvim-cmp",
"nvim-colorizer": "nvim-colorizer",
"nvim-lspconfig": "nvim-lspconfig", "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", "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": { "locked": {
"lastModified": 1659877975, "lastModified": 1681028828,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "numtide", "owner": "nix-systems",
"repo": "flake-utils", "repo": "default",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "nix-systems",
"repo": "flake-utils", "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" "type": "github"
} }
} }

289
flake.nix
View file

@ -1,7 +1,9 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 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 (required by crates-nvim)
plenary-nvim = { plenary-nvim = {
@ -9,73 +11,318 @@
flake = false; 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 # lsp
# https://github.com/neovim/nvim-lspconfig # https://github.com/neovim/nvim-lspconfig
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; flake = false;
}; };
# https://github.com/glepnir/lspsaga.nvim # https://github.com/glepnir/lspsaga.nvim
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; flake = false;
}; };
}; };
outputs = inputs @ { self, nixpkgs, utils, ... }: outputs = inputs @ { self, nixpkgs, flake-utils, nix2lua, ... }:
let let
inputPlugins = [ inputPlugins = [
"plenary-nvim" "plenary-nvim"
# config
"editorconfig-nvim"
# explorer
"nvim-tree-lua"
"telescope-nvim"
"telescope-live-grep-args-nvim"
# formatter
"neoformat"
# git
"gitsigns-nvim"
# lsp # lsp
"nvim-lspconfig" "nvim-lspconfig"
"nlsp-settings-nvim"
"lspsaga-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, ... }: mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }:
let let
inherit (builtins) getAttr; inherit (builtins) getAttr attrNames pathExists readDir;
inherit (lib) listToAttrs nameValuePair; inherit (lib) listToAttrs nameValuePair;
buildPlugin = name: vimUtils.buildVimPluginFrom2Nix { buildPlugin = name: vimUtils.buildVimPlugin {
name = name; name = name;
src = getAttr name inputs; 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); buildPluginValuePair = n: nameValuePair n (buildPlugin n);
customPlugins = listToAttrs (map buildPluginValuePair inputPlugins); neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // {
inherit (vimPlugins) nvim-treesitter;
};
in in
{ vimPlugins = vimPlugins // customPlugins; }; {
inherit neovimPlugins;
inherit nix2lua;
};
mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs);
in in
{ {
overlays = { overlays = {
default = final: prev: { default = final: prev: {
myneovim = prev.callPackage ./. (mkNvimPlugins prev); myneovim = mkNeovim prev;
}; };
}; };
} // } //
utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
inherit (builtins) mapAttrs;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
neovim = pkgs.callPackage ./. (mkNvimPlugins pkgs); minimalNeovim = mkNeovim pkgs;
in
{ recommendedNeovim = (minimalNeovim.override {
apps.default = { enableDevIcons = true;
type = "app"; enableTabby = false;
program = "${neovim}/bin/nvim";
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 { devShells.default = pkgs.mkShell {
packages = [ packages = [
(neovim.override {
enableDevIcons = true;
enableTabby = true;
})
pkgs.stylua # lua formatter pkgs.stylua # lua formatter
]; ];
}; };

10
lib.nix
View file

@ -1,3 +1,5 @@
{ lib, substituteAll, ... }:
let let
inherit (builtins) length elemAt isList isString hasAttr getAttr; inherit (builtins) length elemAt isList isString hasAttr getAttr;
@ -47,9 +49,17 @@ let
mkLuaRc = contents: concatMap mkLuaHeredoc contents; mkLuaRc = contents: concatMap mkLuaHeredoc contents;
############################################################################
# Configs
readSubFile = src: params: builtins.readFile
(substituteAll (params // { inherit src; }));
in in
{ {
inherit (lib) importJSON attrByPath;
inherit foldr concatMap; inherit foldr concatMap;
inherit optional getAttrOpt; inherit optional getAttrOpt;
inherit mkLuaHeredoc mkLuaRc; inherit mkLuaHeredoc mkLuaRc;
inherit readSubFile substituteAll;
} }

89
neovim.nix Normal file
View 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;
};
})

View 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,
}

View file

@ -0,0 +1,5 @@
{ editorconfig-nvim, ... }:
{
plugins = [ editorconfig-nvim ];
}

View 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 ];
}

View 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 })

View 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)

View file

@ -0,0 +1,10 @@
{ neoformat, ... }:
let
inherit (builtins) readFile;
in
{
luaConfig = readFile ./neoformat.lua;
plugins = [ neoformat ];
}

View 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
View file

@ -0,0 +1,10 @@
{ gitsigns-nvim, ... }:
let
inherit (builtins) readFile;
in
{
luaConfig = readFile ./gitsigns-nvim.lua;
plugins = [ gitsigns-nvim ];
}

View 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,
})

View file

@ -0,0 +1,3 @@
local tabby = require('cmp_tabby.config')
tabby:setup(@tabbymlSettings@)

View file

@ -1,13 +1,51 @@
{ nvim-lspconfig { lib
, plugins
, nvim-lspconfig
, nlsp-settings-nvim
, lspsaga-nvim , lspsaga-nvim
, luasnip
, nvim-cmp
, cmp-nvim-lsp
, cmp-luasnip
, cmp-tabby
, ... , ...
}: }:
let 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 in
{ {
luaConfig = (builtins.readFile ./lspconfig.lua); luaConfig = lspconfigLuaConfig + tabbymlLuaConfig + cmpLuaConfig;
plugins = lsp; plugins = lsp
++ snippets
++ completions;
} }

View file

@ -1,31 +1,81 @@
local lsp_config = require("lspconfig") local lsp_config = require("lspconfig")
local saga = require("lspsaga") local saga = require("lspsaga")
local nlsp_settings = require("nlspsettings")
-- See: https://github.com/glepnir/lspsaga.nvim#configuration -- See: https://github.com/glepnir/lspsaga.nvim#configuration
saga.init_lsp_saga({ saga.init_lsp_saga(@lspSagaSettings@)
code_action_lightbulb = { enable = false },
symbol_in_winbar = { enable = false },
})
-- always show signcolumns -- always show signcolumns
vim.opt.signcolumn = "yes" 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 -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) 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 } 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>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 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 -- 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 -- Override the default configuration to be applied to all servers
lsp_config.util.default_config = vim.tbl_extend("force", lsp_config.util.default_config, { lsp_config.util.default_config = vim.tbl_extend("force", lsp_config.util.default_config, {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities,
}) })
-- nix local root_pattern = lsp_config.util.root_pattern
lsp_config.nil_ls.setup({})
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
View 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
View 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
];
}

View 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
}

View 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
View 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 ]);
}

View file

@ -0,0 +1,2 @@
-- See: https://github.com/nvim-lualine/lualine.nvim#default-configuration
require("lualine").setup(@lualineSettings@)

View 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
View 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
View 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)

View file

@ -0,0 +1 @@
require("colorizer").setup(@colorizerFiletypes@, @colorizerSettings@)

View file

@ -0,0 +1,3 @@
require("orgmode").setup(@orgmodeSettings@)
require("org-bullets").setup()

3
shell.nix Normal file
View file

@ -0,0 +1,3 @@
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).shellNix