Compare commits

...
2 Commits
3 changed files with 35 additions and 10 deletions

No files matched your search

+4 -5
View File
@@ -1,4 +1,3 @@
{ pkgs, ... }:
{
imports = [
./blink.nix
@@ -8,10 +7,10 @@
./treesitter.nix
./telescope.nix
./lualine.nix
./which-key.nix
];
extraPlugins = with pkgs.vimPlugins; [
vim-sleuth
];
plugins = {
sleuth.enable = true;
which-key.enable = true;
};
}
+31 -2
View File
@@ -2,11 +2,40 @@
{
plugins.treesitter = {
enable = true;
highlight.enable = true;
indent.enable = true;
nixGrammars = false;
};
extraConfigLua = ''
local function start(buf, lang)
if not vim.api.nvim_buf_is_valid(buf) then return end
if not pcall(vim.treesitter.start, buf, lang) then return end
-- indent (nvim-treesitter's indents.scm, experimental on main)
vim.bo[buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
-- folds (built into Neovim, uses folds.scm)
vim.api.nvim_buf_call(buf, function()
vim.wo[0][0].foldmethod = "expr"
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
end)
end
vim.api.nvim_create_autocmd("FileType", {
callback = function(args)
local lang = vim.treesitter.language.get_lang(args.match)
if not lang then return end
local ts = require("nvim-treesitter")
if vim.tbl_contains(ts.get_installed(), lang) then
start(args.buf, lang)
elseif vim.tbl_contains(ts.get_available(), lang) then
ts.install(lang):await(function() start(args.buf, lang) end)
end
end,
})
'';
extraPackages = with pkgs; [
gcc
tree-sitter
];
}
-3
View File
@@ -1,3 +0,0 @@
{
plugins.which-key.enable = true;
}