build:neotree

fix:highlight
fix:nvim_fmt
fix:stop_autofmt
fix:update_notice
fix:niri_scroll
This commit is contained in:
dichgrem
2025-11-14 16:58:48 +08:00
parent 02da5c19e2
commit e02cfc5dcd
7 changed files with 152 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
input {
disable-power-key-handling
focus-follows-mouse
focus-follows-mouse max-scroll-amount="0%"
warp-mouse-to-focus
mouse {

View File

@@ -3,27 +3,25 @@
lib,
pkgs,
...
}: let
neo-tree-nvim-main = pkgs.vimUtils.buildVimPlugin {
pname = "neo-tree-nvim-main";
version = "3.35.2+6";
src = pkgs.fetchFromGitHub {
owner = "nvim-neo-tree";
repo = "neo-tree.nvim";
rev = "8dd9f08ff086d09d112f1873f88dc0f74b598cdb";
sha256 = "sha256-edthaqznGTJ+VFVORK7gfHI9J14PLAghG9prsWlzXtc=";
};
doCheck = false;
meta.homepage = "https://github.com/nvim-neo-tree/neo-tree.nvim/";
meta.hydraPlatforms = [];
};
in {
}: {
programs.neovim = {
enable = true;
extraPackages = with pkgs; [
# LazyVim
black
ruff
google-java-format
jdt-language-server
prettierd
nodePackages.prettier
clang-tools
rustfmt
jq
yamlfmt
taplo
shfmt
lua-language-server
stylua
nixpkgs-fmt
];
plugins = with pkgs.vimPlugins; [
@@ -41,10 +39,7 @@ in {
friendly-snippets
gitsigns-nvim
lualine-nvim
{
name = "neo-tree.nvim";
path = neo-tree-nvim-main;
}
neo-tree-nvim
neoconf-nvim
neodev-nvim
noice-nvim
@@ -55,7 +50,6 @@ in {
nvim-spectre
nvim-treesitter
nvim-treesitter-context
nvim-treesitter-textobjects
nvim-ts-autotag
nvim-ts-context-commentstring
nvim-web-devicons
@@ -199,7 +193,4 @@ in {
# Normal LazyVim config here, see https://github.com/LazyVim/starter/tree/main/lua
xdg.configFile."nvim/lua".source = ./lua;
# Set default editor
home.sessionVariables.EDITOR = "nvim";
}

View File

@@ -1,3 +1,4 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
vim.g.autoformat = false

View File

@@ -0,0 +1,44 @@
return {
{
"stevearc/conform.nvim",
opts = function(_, opts)
opts.format_on_save = nil
opts.formatters = opts.formatters or {}
opts.formatters.nixpkgs_fmt = {
command = "nixpkgs-fmt",
args = function(ctx)
return {}
end,
stdin = true,
exit_codes = { 0 },
}
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.nix = { "nixpkgs_fmt", stop_after_first = true }
opts.formatters_by_ft.lua = { "stylua" }
opts.formatters_by_ft.python = { "black", "ruff_format" }
opts.formatters_by_ft.sh = { "shfmt" }
opts.formatters_by_ft.javascript = { "prettier" }
opts.formatters_by_ft.typescript = { "prettier" }
opts.formatters_by_ft.javascriptreact = { "prettier" }
opts.formatters_by_ft.typescriptreact = { "prettier" }
opts.formatters_by_ft.vue = { "prettier" }
opts.formatters_by_ft.go = { "gofmt" }
opts.formatters_by_ft.c = { "clang_format" }
opts.formatters_by_ft.cpp = { "clang_format" }
opts.formatters_by_ft.rust = { "rustfmt" }
opts.formatters_by_ft.java = { "google-java-format" }
opts.formatters_by_ft.json = { "jq" }
opts.formatters_by_ft.yaml = { "yamlfmt" }
opts.formatters_by_ft.toml = { "taplo" }
opts.default_format_opts = {
timeout_ms = 1000,
lsp_format = "fallback",
stop_after_first = false,
}
opts.log_level = vim.log.levels.ERROR
opts.notify_on_error = true
opts.notify_no_formatters = true
return opts
end,
},
}

View File

@@ -1,11 +1,11 @@
return {
"ojroques/nvim-osc52",
config = function()
require("osc52").setup {
require("osc52").setup({
max_length = 0, -- 不限制长度
silent = false,
trim = false,
}
})
local function copy()
if vim.v.event.operator == "y" and vim.v.event.regname == "" then

View File

@@ -0,0 +1,30 @@
return {
{
"LazyVim/LazyVim",
opts = {
treesitter = false,
},
},
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
opts = {
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
}