From 3162bc0ebaf60873f3cdf5deca023100a7a2d472 Mon Sep 17 00:00:00 2001 From: moons Date: Mon, 3 Aug 2026 15:10:03 +0900 Subject: [PATCH] neovim --- modules/applications/vim/autocmds.nix | 8 + modules/applications/vim/colorscheme.nix | 6 + modules/applications/vim/home.nix | 467 ++---------------- modules/applications/vim/keymaps.nix | 231 ++++----- modules/applications/vim/language.nix | 13 + modules/applications/vim/lsp.nix | 65 +++ modules/applications/vim/options.nix | 50 ++ modules/applications/vim/plugins/default.nix | 5 + .../vim/plugins/editor/autopairs.nix | 3 + .../vim/plugins/editor/blink-cmp.nix | 56 +++ .../vim/plugins/editor/comment.nix | 3 + .../vim/plugins/editor/conform.nix | 27 + .../vim/plugins/editor/copilot.nix | 11 + .../vim/plugins/editor/default.nix | 21 + .../applications/vim/plugins/editor/flash.nix | 9 + .../vim/plugins/editor/git-conflict.nix | 9 + .../applications/vim/plugins/editor/git.nix | 11 + .../vim/plugins/editor/gitsigns.nix | 25 + .../vim/plugins/editor/glance.nix | 9 + .../vim/plugins/editor/lsp-signature.nix | 11 + .../vim/plugins/editor/snacks.nix | 32 ++ .../vim/plugins/editor/spectre.nix | 10 + .../vim/plugins/editor/surround.nix | 3 + .../vim/plugins/editor/todo-comments.nix | 9 + .../vim/plugins/editor/treesitter.nix | 17 + .../vim/plugins/editor/trouble.nix | 3 + .../vim/plugins/editor/wakatime.nix | 4 + .../applications/vim/plugins/ui/barbar.nix | 26 + .../applications/vim/plugins/ui/blankline.nix | 20 + .../applications/vim/plugins/ui/colorizer.nix | 26 + .../applications/vim/plugins/ui/default.nix | 18 + .../applications/vim/plugins/ui/dropbar.nix | 3 + .../applications/vim/plugins/ui/lightbulb.nix | 6 + .../applications/vim/plugins/ui/lualine.nix | 25 + .../applications/vim/plugins/ui/markview.nix | 9 + .../applications/vim/plugins/ui/neo-tree.nix | 37 ++ .../applications/vim/plugins/ui/scrollbar.nix | 9 + .../vim/plugins/ui/toggleterm.nix | 3 + .../vim/plugins/ui/treesitter.nix | 3 + modules/applications/vim/plugins/ui/ufo.nix | 24 + .../vim/plugins/ui/web-devicons.nix | 4 + .../applications/vim/plugins/ui/which-key.nix | 4 + .../applications/vim/plugins/ui/zen-mode.nix | 9 + 43 files changed, 811 insertions(+), 533 deletions(-) create mode 100644 modules/applications/vim/autocmds.nix create mode 100644 modules/applications/vim/colorscheme.nix create mode 100644 modules/applications/vim/language.nix create mode 100644 modules/applications/vim/lsp.nix create mode 100644 modules/applications/vim/options.nix create mode 100644 modules/applications/vim/plugins/default.nix create mode 100644 modules/applications/vim/plugins/editor/autopairs.nix create mode 100644 modules/applications/vim/plugins/editor/blink-cmp.nix create mode 100644 modules/applications/vim/plugins/editor/comment.nix create mode 100644 modules/applications/vim/plugins/editor/conform.nix create mode 100644 modules/applications/vim/plugins/editor/copilot.nix create mode 100644 modules/applications/vim/plugins/editor/default.nix create mode 100644 modules/applications/vim/plugins/editor/flash.nix create mode 100644 modules/applications/vim/plugins/editor/git-conflict.nix create mode 100644 modules/applications/vim/plugins/editor/git.nix create mode 100644 modules/applications/vim/plugins/editor/gitsigns.nix create mode 100644 modules/applications/vim/plugins/editor/glance.nix create mode 100644 modules/applications/vim/plugins/editor/lsp-signature.nix create mode 100644 modules/applications/vim/plugins/editor/snacks.nix create mode 100644 modules/applications/vim/plugins/editor/spectre.nix create mode 100644 modules/applications/vim/plugins/editor/surround.nix create mode 100644 modules/applications/vim/plugins/editor/todo-comments.nix create mode 100644 modules/applications/vim/plugins/editor/treesitter.nix create mode 100644 modules/applications/vim/plugins/editor/trouble.nix create mode 100644 modules/applications/vim/plugins/editor/wakatime.nix create mode 100644 modules/applications/vim/plugins/ui/barbar.nix create mode 100644 modules/applications/vim/plugins/ui/blankline.nix create mode 100644 modules/applications/vim/plugins/ui/colorizer.nix create mode 100644 modules/applications/vim/plugins/ui/default.nix create mode 100644 modules/applications/vim/plugins/ui/dropbar.nix create mode 100644 modules/applications/vim/plugins/ui/lightbulb.nix create mode 100644 modules/applications/vim/plugins/ui/lualine.nix create mode 100644 modules/applications/vim/plugins/ui/markview.nix create mode 100644 modules/applications/vim/plugins/ui/neo-tree.nix create mode 100644 modules/applications/vim/plugins/ui/scrollbar.nix create mode 100644 modules/applications/vim/plugins/ui/toggleterm.nix create mode 100644 modules/applications/vim/plugins/ui/treesitter.nix create mode 100644 modules/applications/vim/plugins/ui/ufo.nix create mode 100644 modules/applications/vim/plugins/ui/web-devicons.nix create mode 100644 modules/applications/vim/plugins/ui/which-key.nix create mode 100644 modules/applications/vim/plugins/ui/zen-mode.nix diff --git a/modules/applications/vim/autocmds.nix b/modules/applications/vim/autocmds.nix new file mode 100644 index 0000000..5b98f8b --- /dev/null +++ b/modules/applications/vim/autocmds.nix @@ -0,0 +1,8 @@ +_: { + programs.nixvim.autoCmd = [ + { + event = "TextYankPost"; + callback.__raw = "function() vim.highlight.on_yank() end"; + } + ]; +} diff --git a/modules/applications/vim/colorscheme.nix b/modules/applications/vim/colorscheme.nix new file mode 100644 index 0000000..7a4049d --- /dev/null +++ b/modules/applications/vim/colorscheme.nix @@ -0,0 +1,6 @@ +_: { + programs.nixvim.colorschemes.catppuccin = { + enable = true; + settings.transparent_background = true; + }; +} diff --git a/modules/applications/vim/home.nix b/modules/applications/vim/home.nix index 71b528f..f19f916 100644 --- a/modules/applications/vim/home.nix +++ b/modules/applications/vim/home.nix @@ -1,426 +1,49 @@ -{ pkgs, ... }: -let - keymaps = import ./keymaps.nix { }; -in -{ - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - - programs.nixvim = { - enable = true; - vimAlias = true; - viAlias = true; - withNodeJs = true; - - nixpkgs = { - source = pkgs.path; - config.allowUnfree = true; +{ pkgs, lib, ... }@args: +lib.mkMerge [ + (import ./autocmds.nix args) + (import ./colorscheme.nix args) + (import ./keymaps.nix args) + (import ./language.nix args) + (import ./lsp.nix args) + (import ./options.nix args) + (import ./plugins args) + { + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; }; - extraPackages = with pkgs; [ - git - ripgrep - fd - nodejs - zellij - vtsls - vscode-langservers-extracted - tailwindcss-language-server - prettierd - prettier - biome - stylua - shfmt - alejandra - nixfmt - lua-language-server - nixd - lazygit - ]; - - opts = { - number = true; - relativenumber = true; - signcolumn = "yes"; - termguicolors = true; - mouse = "a"; - clipboard = "unnamedplus"; - updatetime = 200; - timeoutlen = 300; - undofile = true; - wrap = false; - scrolloff = 8; - ignorecase = true; - smartcase = true; - splitright = true; - splitbelow = true; - tabstop = 2; - shiftwidth = 2; - expandtab = true; - encoding = "utf-8"; - fileencoding = "utf-8"; - fileencodings = "utf-8,sjis,euc-jp,iso-2022-jp"; - list = true; - listchars = "tab:»-,trail:-,extends:»,precedes:«,nbsp:%"; - jumpoptions = "stack"; - switchbuf = "useopen,uselast"; - foldcolumn = "1"; - foldlevel = 99; - foldlevelstart = 99; - foldenable = true; - }; - - globals = { - mapleader = " "; - maplocalleader = " "; - clipboard = "osc52"; - }; - - env = { - LANG = "ja_JP.UTF-8"; - LC_MESSAGES = "ja_JP.UTF-8"; - }; - - autoCmd = [ - { - event = "TextYankPost"; - callback.__raw = "function() vim.highlight.on_yank() end"; - } - ]; - - colorschemes.catppuccin = { + programs.nixvim = { enable = true; - settings.transparent_background = true; + vimAlias = true; + viAlias = true; + withNodeJs = true; + + nixpkgs = { + source = pkgs.path; + config.allowUnfree = true; + }; + + extraPackages = with pkgs; [ + git + ripgrep + fd + nodejs + zellij + vtsls + vscode-langservers-extracted + tailwindcss-language-server + prettierd + prettier + biome + stylua + shfmt + alejandra + nixfmt + lua-language-server + nixd + lazygit + ]; }; - - diagnostic.settings = { - virtual_text = true; - float = { - border = "rounded"; - source = true; - }; - }; - - plugins = { - lsp = { - enable = true; - servers = { - vtsls = { - enable = true; - packageFallback = true; - rootMarkers = [ - "pnpm-workspace.yaml" - "package.json" - "tsconfig.json" - "jsconfig.json" - ".git" - ]; - extraOptions.settings.typescript.locale = "ja"; - }; - biome = { - enable = true; - packageFallback = true; - rootMarkers = [ - "biome.json" - "biome.jsonc" - "package.json" - "pnpm-workspace.yaml" - ".git" - ]; - }; - tailwindcss.enable = true; - cssls.enable = true; - jsonls.enable = true; - yamlls.enable = true; - lua_ls.enable = true; - nixd.enable = true; - rust_analyzer = { - enable = true; - installCargo = true; - installRustc = true; - }; - svelte.enable = true; - ty.enable = true; - ruff.enable = true; - astro.enable = true; - gopls.enable = true; - }; - }; - - blink-cmp = { - enable = true; - setupLspCapabilities = true; - settings = { - keymap = { - preset = "enter"; - "" = [ "show" ]; - "" = [ "scroll_documentation_up" ]; - "" = [ "hide" ]; - "" = [ "scroll_documentation_down" ]; - "" = [ - "accept" - { - __raw = '' - function() - local ok, copilot = pcall(require, "copilot.suggestion") - if ok and copilot.is_visible() then - copilot.accept() - return true - end - end - ''; - } - "fallback" - ]; - "" = [ - "select_prev" - "fallback" - ]; - "" = [ - "select_next" - "fallback" - ]; - "" = [ - "select_prev" - "fallback" - ]; - }; - completion.list.selection = { - preselect = true; - auto_insert = false; - }; - sources.default = [ - "lsp" - "path" - "buffer" - ]; - }; - }; - - nvim-autopairs.enable = true; - comment.enable = true; - "conform-nvim" = { - enable = true; - settings = { - formatters_by_ft = { - javascript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; - javascriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; - typescript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; - typescriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; - json.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; - yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; - lua = [ "stylua" ]; - nix.__raw = ''{ "nix_fmt", "alejandra", stop_after_first = true }''; - sh = [ "shfmt" ]; - }; - formatters.nix_fmt.command = "nixfmt"; - format_on_save.__raw = '' - function(_) - return { timeout_ms = 1000, lsp_format = "fallback" } - end - ''; - }; - }; - copilot-lua = { - enable = true; - settings.suggestion = { - auto_trigger = true; - keymap.enabled = false; - }; - }; - lazygit.enable = true; - diffview.enable = true; - gitsigns = { - enable = true; - settings.signs = { - add.text = "+"; - change.text = "~"; - delete.text = "_"; - topdelete.text = "‾"; - changedelete.text = "~"; - }; - }; - lsp-signature = { - enable = true; - settings = { - hint_enable = true; - hint_prefix = " "; - floating_window = true; - bind = true; - }; - }; - nvim-surround.enable = true; - treesitter = { - enable = true; - settings = { - highlight.enable = true; - indent.enable = true; - }; - }; - trouble.enable = true; - barbar = { - enable = true; - settings = { - animation = false; - auto_hide = 1; - tabpages = true; - clickable = true; - focus_on_close = "left"; - icons = { - button = "󰅖"; - separator = { - left = "▎"; - right = ""; - }; - separator_at_end = false; - filetype.enabled = true; - }; - sidebar_filetypes.neo-tree = true; - }; - }; - indent-blankline = { - enable = true; - settings = { - scope = { - enabled = true; - show_start = true; - show_end = true; - }; - exclude.filetypes = [ - "help" - "neo-tree" - "toggleterm" - "lazy" - ]; - }; - }; - colorizer = { - enable = true; - settings = { - filetypes = [ - "*" - "!markdown" - ]; - user_commands = true; - options = { - parsers = { - css = true; - tailwind = { - enable = true; - lsp = true; - update_names = true; - }; - }; - display.mode = "background"; - }; - }; - }; - dropbar.enable = true; - nvim-lightbulb = { - enable = true; - settings.autocmd.enabled = true; - }; - lualine = { - enable = true; - settings.sections.lualine_x = [ - { - __raw = '' - function() - local ok, conform = pcall(require, "conform") - if not ok then return "" end - for _, formatter in ipairs(conform.list_formatters(0)) do - if formatter.available then return "󰛖 " .. formatter.name end - end - return "" - end - ''; - } - "encoding" - "fileformat" - "filetype" - ]; - }; - neo-tree = { - enable = true; - settings = { - close_if_last_window = true; - filesystem = { - follow_current_file = { - enabled = true; - leave_dirs_open = true; - }; - filtered_items = { - visible = true; - hide_dotfiles = false; - hide_gitignored = true; - hide_ignored = false; - hide_hidden = false; - never_show = [ - ".DS_Store" - "thumbs.db" - ]; - }; - }; - }; - }; - toggleterm.enable = true; - "treesitter-context".enable = true; - web-devicons.enable = true; - which-key.enable = true; - }; - - extraPlugins = with pkgs.vimPlugins; [ - flash-nvim - git-conflict-nvim - glance-nvim - snacks-nvim - nvim-spectre - todo-comments-nvim - nvim-ts-autotag - vim-wakatime - markview-nvim - nvim-scrollbar - nvim-ufo - promise-async - zen-mode-nvim - ]; - - extraConfigLua = '' - vim.cmd.language("ja_JP.utf8") - vim.opt.helplang = { "ja", "en" } - - require("flash").setup() - require("git-conflict").setup() - require("glance").setup() - require("spectre").setup() - require("todo-comments").setup() - require("nvim-ts-autotag").setup() - require("markview").setup({ initial_state = false }) - require("scrollbar").setup() - require("zen-mode").setup() - require("ufo").setup({ - provider_selector = function() - return { "treesitter", "indent" } - end, - }) - require("snacks").setup({ - picker = { - enabled = true, - actions = require("trouble.sources.snacks").actions, - win = { input = { keys = { - [""] = { "trouble_open", mode = { "n", "i" } }, - } } }, - }, - notifier = { enabled = true }, - words = { enabled = true }, - scroll = { enabled = true }, - dim = { enabled = true }, - }) - ''; - - inherit keymaps; - }; -} + } +] diff --git a/modules/applications/vim/keymaps.nix b/modules/applications/vim/keymaps.nix index 83faccc..c14a0a4 100644 --- a/modules/applications/vim/keymaps.nix +++ b/modules/applications/vim/keymaps.nix @@ -53,138 +53,147 @@ let }; }; in -[ - # Search - (mk "" "nohlsearch" "検索ハイライトを解除") +{ + programs.nixvim = { + opts = { + jumpoptions = "stack"; + switchbuf = "useopen,uselast"; + }; - # Screen line movement - (mkExpr "j" "function() return vim.v.count == 0 and 'gj' or 'j' end" "下へ移動(画面行優先)") - (mkExpr "k" "function() return vim.v.count == 0 and 'gk' or 'k' end" "上へ移動(画面行優先)") + keymaps = [ + # Search + (mk "" "nohlsearch" "検索ハイライトを解除") - # LSP: hover / direct jump - (mkRaw "K" "vim.lsp.buf.hover" "シンボル情報を表示") - (mkRaw "gd" "vim.lsp.buf.definition" "定義へジャンプ") - (mkRaw "grr" "vim.lsp.buf.references" "参照一覧を開く") - (mkRaw "gri" "vim.lsp.buf.implementation" "実装一覧を開く") - (mkRaw "grt" "vim.lsp.buf.type_definition" "型定義一覧を開く") - (mkRaw "grn" "vim.lsp.buf.rename" "シンボル名を一括変換") - (mkRaw "gra" "vim.lsp.buf.code_action" "コードアクション") - (mkRaw "gO" "vim.lsp.buf.document_symbol" "現在ファイルのシンボル一覧") + # Screen line movement + (mkExpr "j" "function() return vim.v.count == 0 and 'gj' or 'j' end" "下へ移動(画面行優先)") + (mkExpr "k" "function() return vim.v.count == 0 and 'gk' or 'k' end" "上へ移動(画面行優先)") - # Glance: preview / peek - (mk "gD" "Glance definitions" "定義をプレビュー") - (mk "gR" "Glance references" "参照をプレビュー") - (mk "gM" "Glance implementations" "実装をプレビュー") - (mk "gY" "Glance type_definitions" "型定義をプレビュー") - (mk "g." "Glance resume" "直前のGlanceを再開") + # LSP: hover / direct jump + (mkRaw "K" "vim.lsp.buf.hover" "シンボル情報を表示") + (mkRaw "gd" "vim.lsp.buf.definition" "定義へジャンプ") + (mkRaw "grr" "vim.lsp.buf.references" "参照一覧を開く") + (mkRaw "gri" "vim.lsp.buf.implementation" "実装一覧を開く") + (mkRaw "grt" "vim.lsp.buf.type_definition" "型定義一覧を開く") + (mkRaw "grn" "vim.lsp.buf.rename" "シンボル名を一括変換") + (mkRaw "gra" "vim.lsp.buf.code_action" "コードアクション") + (mkRaw "gO" "vim.lsp.buf.document_symbol" "現在ファイルのシンボル一覧") - # Convenience aliases - (mkRaw "rn" "vim.lsp.buf.rename" "シンボル名を一括変換") - (mkRaw "cf" - "function() require('conform').format({ timeout_ms = 1000, lsp_format = 'fallback' }) end" - "コードをフォーマット" - ) - (mkRaw "ca" "vim.lsp.buf.code_action" "コードアクション") + # Glance: preview / peek + (mk "gD" "Glance definitions" "定義をプレビュー") + (mk "gR" "Glance references" "参照をプレビュー") + (mk "gM" "Glance implementations" "実装をプレビュー") + (mk "gY" "Glance type_definitions" "型定義をプレビュー") + (mk "g." "Glance resume" "直前のGlanceを再開") - # Diagnostics - (mkRaw "]d" "vim.diagnostic.goto_next" "次の診断へ移動") - (mkRaw "[d" "vim.diagnostic.goto_prev" "前の診断へ移動") - (mkRaw "dl" "vim.diagnostic.open_float" "診断の詳細を表示") + # Convenience aliases + (mkRaw "rn" "vim.lsp.buf.rename" "シンボル名を一括変換") + (mkRaw "cf" + "function() require('conform').format({ timeout_ms = 1000, lsp_format = 'fallback' }) end" + "コードをフォーマット" + ) + (mkRaw "ca" "vim.lsp.buf.code_action" "コードアクション") - # File tree - (mk "e" "Neotree toggle left" "ファイルツリー") + # Diagnostics + (mkRaw "]d" "vim.diagnostic.goto_next" "次の診断へ移動") + (mkRaw "[d" "vim.diagnostic.goto_prev" "前の診断へ移動") + (mkRaw "dl" "vim.diagnostic.open_float" "診断の詳細を表示") - # Terminal - (mk "tt" "ToggleTerm direction=float" "ターミナル") + # File tree + (mk "e" "Neotree toggle left" "ファイルツリー") - # Trouble - (mk "xx" "Trouble diagnostics toggle" "診断一覧") - (mk "xq" "Trouble qflist toggle" "Quickfix一覧") - (mk "xl" "Trouble loclist toggle" "Location List一覧") - (mk "xs" "Trouble symbols toggle" "シンボル一覧") - (mk "xw" "Trouble lsp toggle" "LSP一覧") + # Terminal + (mk "tt" "ToggleTerm direction=float" "ターミナル") - # Quickfix / Location list navigation - (mk "]q" "cnext" "次のQuickfixへ") - (mk "[q" "cprev" "前のQuickfixへ") - (mk "]l" "lnext" "次のLocation Listへ") - (mk "[l" "lprev" "前のLocation Listへ") + # Trouble + (mk "xx" "Trouble diagnostics toggle" "診断一覧") + (mk "xq" "Trouble qflist toggle" "Quickfix一覧") + (mk "xl" "Trouble loclist toggle" "Location List一覧") + (mk "xs" "Trouble symbols toggle" "シンボル一覧") + (mk "xw" "Trouble lsp toggle" "LSP一覧") - # Window navigation - (mkSmartWindowNav "" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)") - (mkSmartWindowNav "" "j" "down" "下のウィンドウへ(端ならZellijペインへ)") - (mkSmartWindowNav "" "k" "up" "上のウィンドウへ(端ならZellijペインへ)") - (mkSmartWindowNav "" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)") - (mkSmartWindowNav "" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)") - (mkSmartWindowNav "" "j" "down" "下のウィンドウへ(端ならZellijペインへ)") - (mkSmartWindowNav "" "k" "up" "上のウィンドウへ(端ならZellijペインへ)") - (mkSmartWindowNav "" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)") + # Quickfix / Location list navigation + (mk "]q" "cnext" "次のQuickfixへ") + (mk "[q" "cprev" "前のQuickfixへ") + (mk "]l" "lnext" "次のLocation Listへ") + (mk "[l" "lprev" "前のLocation Listへ") - # Alternate file / previous file - (mk "" "" "直前のファイルへ戻る") - (mk "w-" "" "直前のファイルをsplitで開く") + # Window navigation + (mkSmartWindowNav "" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)") + (mkSmartWindowNav "" "j" "down" "下のウィンドウへ(端ならZellijペインへ)") + (mkSmartWindowNav "" "k" "up" "上のウィンドウへ(端ならZellijペインへ)") + (mkSmartWindowNav "" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)") + (mkSmartWindowNav "" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)") + (mkSmartWindowNav "" "j" "down" "下のウィンドウへ(端ならZellijペインへ)") + (mkSmartWindowNav "" "k" "up" "上のウィンドウへ(端ならZellijペインへ)") + (mkSmartWindowNav "" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)") - # Buffer Bar - (mk "[b" "BufferPrevious" "前のバッファーに移動") - (mk "]b" "BufferNext" "次のバッファーに移動") - (mk "bc" "BufferClose" "バッファーを閉じる") + # Alternate file / previous file + (mk "" "" "直前のファイルへ戻る") + (mk "w-" "" "直前のファイルをsplitで開く") - # Git Conflict - (mk "gco" "GitConflictChooseOurs" "現在のブランチを選択") - (mk "gct" "GitConflictChooseTheirs" "相手のブランチを選択") - (mk "gcb" "GitConflictChooseBoth" "両方を選択") - (mk "gcx" "GitConflictListQf" "コンフリクト一覧") - (mk "]x" "GitConflictNextConflict" "次のコンフリクト") - (mk "[x" "GitConflictPrevConflict" "前のコンフリクト") + # Buffer Bar + (mk "[b" "BufferPrevious" "前のバッファーに移動") + (mk "]b" "BufferNext" "次のバッファーに移動") + (mk "bc" "BufferClose" "バッファーを閉じる") - # Git - (mk "gl" "LazyGit" "LazyGitを開く") - (mk "gd" "DiffviewOpen" "差分を開く") - (mk "gH" "DiffviewFileHistory" "リポジトリ履歴") - (mk "gh" "DiffviewFileHistory %" "現在ファイルの履歴") - (mk "gq" "DiffviewClose" "差分を閉じる") + # Git Conflict + (mk "gco" "GitConflictChooseOurs" "現在のブランチを選択") + (mk "gct" "GitConflictChooseTheirs" "相手のブランチを選択") + (mk "gcb" "GitConflictChooseBoth" "両方を選択") + (mk "gcx" "GitConflictListQf" "コンフリクト一覧") + (mk "]x" "GitConflictNextConflict" "次のコンフリクト") + (mk "[x" "GitConflictPrevConflict" "前のコンフリクト") - # Markview - (mk "mp" "Markview splitToggle" "Markdownプレビュー") + # Git + (mk "gl" "LazyGit" "LazyGitを開く") + (mk "gd" "DiffviewOpen" "差分を開く") + (mk "gH" "DiffviewFileHistory" "リポジトリ履歴") + (mk "gh" "DiffviewFileHistory %" "現在ファイルの履歴") + (mk "gq" "DiffviewClose" "差分を閉じる") - # Zen Mode - (mk "zz" "ZenMode" "Zen Modeを開く/閉じる") + # Markview + (mk "mp" "Markview splitToggle" "Markdownプレビュー") - # UFO (folding) - (mkRaw "zR" "require('ufo').openAllFolds" "全て展開") - (mkRaw "zM" "require('ufo').closeAllFolds" "全て折りたたむ") + # Zen Mode + (mk "zz" "ZenMode" "Zen Modeを開く/閉じる") - # Dropbar - (mkRaw "dp" "function() require('dropbar.api').pick() end" "dropbarでナビゲート") + # UFO (folding) + (mkRaw "zR" "require('ufo').openAllFolds" "全て展開") + (mkRaw "zM" "require('ufo').closeAllFolds" "全て折りたたむ") - # Snacks - (mkRaw "sd" "function() Snacks.dim.toggle() end" "Dimモードをトグル") + # Dropbar + (mkRaw "dp" "function() require('dropbar.api').pick() end" "dropbarでナビゲート") - # Flash - (mkRaw "s" "function() require('flash').jump() end" "Flashジャンプ") - (mkRaw "S" "function() require('flash').treesitter() end" "Flashツリーシッタ選択") + # Snacks + (mkRaw "sd" "function() Snacks.dim.toggle() end" "Dimモードをトグル") - # Todo Comments - (mk "]t" "TodoNext" "次のTODO") - (mk "[t" "TodoPrev" "前のTODO") - (mkRaw "ft" "function() Snacks.picker.todo_comments() end" "TODO一覧") + # Flash + (mkRaw "s" "function() require('flash').jump() end" "Flashジャンプ") + (mkRaw "S" "function() require('flash').treesitter() end" "Flashツリーシッタ選択") - # Spectre - (mkRaw "sr" "function() require('spectre').toggle() end" "検索・置換") + # Todo Comments + (mk "]t" "TodoNext" "次のTODO") + (mk "[t" "TodoPrev" "前のTODO") + (mkRaw "ft" "function() Snacks.picker.todo_comments() end" "TODO一覧") - # Snacks Picker: generic - (mkRaw "ff" "function() Snacks.picker.files() end" "ファイルを探す") - (mkRaw "fg" "function() Snacks.picker.grep() end" "文字列を全文検索") - (mkRaw "fb" "function() Snacks.picker.buffers() end" "開いているバッファを探す") - (mkRaw "fh" "function() Snacks.picker.help() end" "ヘルプ項目を探す") - (mkRaw "fk" "function() Snacks.picker.keymaps() end" "キーマップを探す") - (mkRaw "fc" "function() Snacks.picker.commands() end" "コマンドを探す") + # Spectre + (mkRaw "sr" "function() require('spectre').toggle() end" "検索・置換") - # Snacks Picker: code navigation - (mkRaw "fs" "function() Snacks.picker.lsp_symbols() end" "現在ファイルのシンボルを探す") - (mkRaw "fS" "function() Snacks.picker.lsp_workspace_symbols() end" "ワークスペース全体のシンボルを探す") - (mkRaw "fr" "function() Snacks.picker.registers() end" "レジスタを探す") - (mkRaw "fj" "function() Snacks.picker.jumps() end" "ジャンプ履歴を探す") - (mkRaw "fq" "function() Snacks.picker.qflist() end" "Quickfixを探す") - (mkRaw "fl" "function() Snacks.picker.loclist() end" "Location Listを探す") -] + # Snacks Picker: generic + (mkRaw "ff" "function() Snacks.picker.files() end" "ファイルを探す") + (mkRaw "fg" "function() Snacks.picker.grep() end" "文字列を全文検索") + (mkRaw "fb" "function() Snacks.picker.buffers() end" "開いているバッファを探す") + (mkRaw "fh" "function() Snacks.picker.help() end" "ヘルプ項目を探す") + (mkRaw "fk" "function() Snacks.picker.keymaps() end" "キーマップを探す") + (mkRaw "fc" "function() Snacks.picker.commands() end" "コマンドを探す") + + # Snacks Picker: code navigation + (mkRaw "fs" "function() Snacks.picker.lsp_symbols() end" "現在ファイルのシンボルを探す") + (mkRaw "fS" "function() Snacks.picker.lsp_workspace_symbols() end" "ワークスペース全体のシンボルを探す") + (mkRaw "fr" "function() Snacks.picker.registers() end" "レジスタを探す") + (mkRaw "fj" "function() Snacks.picker.jumps() end" "ジャンプ履歴を探す") + (mkRaw "fq" "function() Snacks.picker.qflist() end" "Quickfixを探す") + (mkRaw "fl" "function() Snacks.picker.loclist() end" "Location Listを探す") + ]; + }; +} diff --git a/modules/applications/vim/language.nix b/modules/applications/vim/language.nix new file mode 100644 index 0000000..10faa21 --- /dev/null +++ b/modules/applications/vim/language.nix @@ -0,0 +1,13 @@ +_: { + programs.nixvim = { + env = { + LANG = "ja_JP.UTF-8"; + LC_MESSAGES = "ja_JP.UTF-8"; + }; + + extraConfigLua = '' + vim.cmd.language("ja_JP.utf8") + vim.opt.helplang = { "ja", "en" } + ''; + }; +} diff --git a/modules/applications/vim/lsp.nix b/modules/applications/vim/lsp.nix new file mode 100644 index 0000000..5761b87 --- /dev/null +++ b/modules/applications/vim/lsp.nix @@ -0,0 +1,65 @@ +_: { + programs.nixvim = { + plugins.lsp = { + enable = true; + + servers = { + # TypeScript / JavaScript + vtsls = { + enable = true; + packageFallback = true; + rootMarkers = [ + "pnpm-workspace.yaml" + "package.json" + "tsconfig.json" + "jsconfig.json" + ".git" + ]; + extraOptions.settings.typescript.locale = "ja"; + }; + + # Biome for lint / format + biome = { + enable = true; + packageFallback = true; + rootMarkers = [ + "biome.json" + "biome.jsonc" + "package.json" + "pnpm-workspace.yaml" + ".git" + ]; + }; + + # Frontend / config languages + tailwindcss.enable = true; + cssls.enable = true; + jsonls.enable = true; + yamlls.enable = true; + lua_ls.enable = true; + nixd.enable = true; + + # Other languages + rust_analyzer = { + enable = true; + installCargo = true; + installRustc = true; + }; + svelte.enable = true; + ty.enable = true; + ruff.enable = true; + astro.enable = true; + gopls.enable = true; + }; + }; + + # Diagnostic UI + diagnostic.settings = { + virtual_text = true; + float = { + border = "rounded"; + source = true; + }; + }; + }; +} diff --git a/modules/applications/vim/options.nix b/modules/applications/vim/options.nix new file mode 100644 index 0000000..2470b1c --- /dev/null +++ b/modules/applications/vim/options.nix @@ -0,0 +1,50 @@ +_: { + programs.nixvim = { + opts = { + # display + number = true; + relativenumber = true; + signcolumn = "yes"; + termguicolors = true; + + # action + mouse = "a"; + clipboard = "unnamedplus"; + updatetime = 200; + timeoutlen = 300; + undofile = true; + + # display + wrap = false; + scrolloff = 8; + + # search + ignorecase = true; + smartcase = true; + + # window split + splitright = true; + splitbelow = true; + + # indent + tabstop = 2; + shiftwidth = 2; + expandtab = true; + + # file encoding + encoding = "utf-8"; + fileencoding = "utf-8"; + fileencodings = "utf-8,sjis,euc-jp,iso-2022-jp"; + + # invisible characters + list = true; + listchars = "tab:»-,trail:-,extends:»,precedes:«,nbsp:%"; + }; + + globals = { + mapleader = " "; + maplocalleader = " "; + clipboard = "osc52"; + }; + }; +} diff --git a/modules/applications/vim/plugins/default.nix b/modules/applications/vim/plugins/default.nix new file mode 100644 index 0000000..0248346 --- /dev/null +++ b/modules/applications/vim/plugins/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }@args: +lib.mkMerge [ + (import ./editor args) + (import ./ui args) +] diff --git a/modules/applications/vim/plugins/editor/autopairs.nix b/modules/applications/vim/plugins/editor/autopairs.nix new file mode 100644 index 0000000..3802ad6 --- /dev/null +++ b/modules/applications/vim/plugins/editor/autopairs.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.nvim-autopairs.enable = true; +} diff --git a/modules/applications/vim/plugins/editor/blink-cmp.nix b/modules/applications/vim/plugins/editor/blink-cmp.nix new file mode 100644 index 0000000..9d114cf --- /dev/null +++ b/modules/applications/vim/plugins/editor/blink-cmp.nix @@ -0,0 +1,56 @@ +_: { + programs.nixvim.plugins.blink-cmp = { + enable = true; + setupLspCapabilities = true; + + settings = { + keymap = { + preset = "enter"; + + "" = [ "show" ]; + "" = [ "scroll_documentation_up" ]; + "" = [ "hide" ]; + "" = [ "scroll_documentation_down" ]; + + "" = [ + "accept" + { + __raw = '' + function() + local ok, copilot = pcall(require, "copilot.suggestion") + if ok and copilot.is_visible() then + copilot.accept() + return true + end + end + ''; + } + "fallback" + ]; + "" = [ + "select_prev" + "fallback" + ]; + "" = [ + "select_next" + "fallback" + ]; + "" = [ + "select_prev" + "fallback" + ]; + }; + + completion.list.selection = { + preselect = true; + auto_insert = false; + }; + + sources.default = [ + "lsp" + "path" + "buffer" + ]; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/comment.nix b/modules/applications/vim/plugins/editor/comment.nix new file mode 100644 index 0000000..c6a216d --- /dev/null +++ b/modules/applications/vim/plugins/editor/comment.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.comment.enable = true; +} diff --git a/modules/applications/vim/plugins/editor/conform.nix b/modules/applications/vim/plugins/editor/conform.nix new file mode 100644 index 0000000..6f4bb62 --- /dev/null +++ b/modules/applications/vim/plugins/editor/conform.nix @@ -0,0 +1,27 @@ +_: { + programs.nixvim.plugins."conform-nvim" = { + enable = true; + settings = { + formatters_by_ft = { + javascript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + javascriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + json.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; + markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; + lua = [ "stylua" ]; + nix.__raw = ''{ "nix_fmt", "alejandra", stop_after_first = true }''; + sh = [ "shfmt" ]; + }; + formatters.nix_fmt = { + command = "nixfmt"; + }; + format_on_save.__raw = '' + function(_) + return { timeout_ms = 1000, lsp_format = "fallback" } + end + ''; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/copilot.nix b/modules/applications/vim/plugins/editor/copilot.nix new file mode 100644 index 0000000..4bbb86f --- /dev/null +++ b/modules/applications/vim/plugins/editor/copilot.nix @@ -0,0 +1,11 @@ +_: { + programs.nixvim.plugins.copilot-lua = { + enable = true; + settings = { + suggestion = { + auto_trigger = true; + keymap.enabled = false; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/default.nix b/modules/applications/vim/plugins/editor/default.nix new file mode 100644 index 0000000..22917a1 --- /dev/null +++ b/modules/applications/vim/plugins/editor/default.nix @@ -0,0 +1,21 @@ +{ lib, ... }@args: +lib.mkMerge [ + (import ./autopairs.nix args) + (import ./blink-cmp.nix args) + (import ./comment.nix args) + (import ./conform.nix args) + (import ./copilot.nix args) + (import ./flash.nix args) + (import ./git-conflict.nix args) + (import ./git.nix args) + (import ./gitsigns.nix args) + (import ./glance.nix args) + (import ./lsp-signature.nix args) + (import ./snacks.nix args) + (import ./spectre.nix args) + (import ./surround.nix args) + (import ./todo-comments.nix args) + (import ./treesitter.nix args) + (import ./trouble.nix args) + (import ./wakatime.nix args) +] diff --git a/modules/applications/vim/plugins/editor/flash.nix b/modules/applications/vim/plugins/editor/flash.nix new file mode 100644 index 0000000..d899445 --- /dev/null +++ b/modules/applications/vim/plugins/editor/flash.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.flash-nvim ]; + extraConfigLua = '' + require("flash").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/git-conflict.nix b/modules/applications/vim/plugins/editor/git-conflict.nix new file mode 100644 index 0000000..8c8663c --- /dev/null +++ b/modules/applications/vim/plugins/editor/git-conflict.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.git-conflict-nvim ]; + extraConfigLua = '' + require("git-conflict").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/git.nix b/modules/applications/vim/plugins/editor/git.nix new file mode 100644 index 0000000..cd904cb --- /dev/null +++ b/modules/applications/vim/plugins/editor/git.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPackages = [ pkgs.lazygit ]; + + plugins = { + lazygit.enable = true; + diffview.enable = true; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/gitsigns.nix b/modules/applications/vim/plugins/editor/gitsigns.nix new file mode 100644 index 0000000..6a7e881 --- /dev/null +++ b/modules/applications/vim/plugins/editor/gitsigns.nix @@ -0,0 +1,25 @@ +_: { + # git change view + programs.nixvim.plugins.gitsigns = { + enable = true; + settings = { + signs = { + add = { + text = "+"; + }; + change = { + text = "~"; + }; + delete = { + text = "_"; + }; + topdelete = { + text = "‾"; + }; + changedelete = { + text = "~"; + }; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/glance.nix b/modules/applications/vim/plugins/editor/glance.nix new file mode 100644 index 0000000..bea6bd3 --- /dev/null +++ b/modules/applications/vim/plugins/editor/glance.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.glance-nvim ]; + extraConfigLua = '' + require("glance").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/lsp-signature.nix b/modules/applications/vim/plugins/editor/lsp-signature.nix new file mode 100644 index 0000000..361bb67 --- /dev/null +++ b/modules/applications/vim/plugins/editor/lsp-signature.nix @@ -0,0 +1,11 @@ +_: { + programs.nixvim.plugins.lsp-signature = { + enable = true; + settings = { + hint_enable = true; + hint_prefix = " "; + floating_window = true; + bind = true; + }; + }; +} diff --git a/modules/applications/vim/plugins/editor/snacks.nix b/modules/applications/vim/plugins/editor/snacks.nix new file mode 100644 index 0000000..86ace40 --- /dev/null +++ b/modules/applications/vim/plugins/editor/snacks.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.snacks-nvim ]; + + extraConfigLua = '' + require("snacks").setup({ + picker = { + enabled = true, + + actions = require("trouble.sources.snacks").actions, + + win = { + input = { + keys = { + [""] = { + "trouble_open", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + + notifier = { enabled = true }, + words = { enabled = true }, + scroll = { enabled = true }, + dim = { enabled = true }, + }) + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/spectre.nix b/modules/applications/vim/plugins/editor/spectre.nix new file mode 100644 index 0000000..60c2e4c --- /dev/null +++ b/modules/applications/vim/plugins/editor/spectre.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPackages = [ pkgs.ripgrep ]; + extraPlugins = [ pkgs.vimPlugins.nvim-spectre ]; + extraConfigLua = '' + require("spectre").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/surround.nix b/modules/applications/vim/plugins/editor/surround.nix new file mode 100644 index 0000000..83276b4 --- /dev/null +++ b/modules/applications/vim/plugins/editor/surround.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.nvim-surround.enable = true; +} diff --git a/modules/applications/vim/plugins/editor/todo-comments.nix b/modules/applications/vim/plugins/editor/todo-comments.nix new file mode 100644 index 0000000..fa3303a --- /dev/null +++ b/modules/applications/vim/plugins/editor/todo-comments.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.todo-comments-nvim ]; + extraConfigLua = '' + require("todo-comments").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/treesitter.nix b/modules/applications/vim/plugins/editor/treesitter.nix new file mode 100644 index 0000000..32208b1 --- /dev/null +++ b/modules/applications/vim/plugins/editor/treesitter.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + plugins.treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + }; + }; + + extraPlugins = [ pkgs.vimPlugins.nvim-ts-autotag ]; + extraConfigLua = '' + require("nvim-ts-autotag").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/editor/trouble.nix b/modules/applications/vim/plugins/editor/trouble.nix new file mode 100644 index 0000000..c7ce674 --- /dev/null +++ b/modules/applications/vim/plugins/editor/trouble.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.trouble.enable = true; +} diff --git a/modules/applications/vim/plugins/editor/wakatime.nix b/modules/applications/vim/plugins/editor/wakatime.nix new file mode 100644 index 0000000..04dc233 --- /dev/null +++ b/modules/applications/vim/plugins/editor/wakatime.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + programs.nixvim.extraPlugins = [ pkgs.vimPlugins.vim-wakatime ]; +} diff --git a/modules/applications/vim/plugins/ui/barbar.nix b/modules/applications/vim/plugins/ui/barbar.nix new file mode 100644 index 0000000..474a5a0 --- /dev/null +++ b/modules/applications/vim/plugins/ui/barbar.nix @@ -0,0 +1,26 @@ +_: { + programs.nixvim.plugins.barbar = { + enable = true; + settings = { + animation = false; + auto_hide = 1; + tabpages = true; + clickable = true; + focus_on_close = "left"; + + icons = { + button = "󰅖"; + separator = { + left = "▎"; + right = ""; + }; + separator_at_end = false; + filetype.enabled = true; + }; + + sidebar_filetypes = { + neo-tree = true; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/ui/blankline.nix b/modules/applications/vim/plugins/ui/blankline.nix new file mode 100644 index 0000000..3439350 --- /dev/null +++ b/modules/applications/vim/plugins/ui/blankline.nix @@ -0,0 +1,20 @@ +_: { + programs.nixvim.plugins.indent-blankline = { + enable = true; + settings = { + scope = { + enabled = true; + show_start = true; + show_end = true; + }; + exclude = { + filetypes = [ + "help" + "neo-tree" + "toggleterm" + "lazy" + ]; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/ui/colorizer.nix b/modules/applications/vim/plugins/ui/colorizer.nix new file mode 100644 index 0000000..54b6c4e --- /dev/null +++ b/modules/applications/vim/plugins/ui/colorizer.nix @@ -0,0 +1,26 @@ +_: { + programs.nixvim.plugins.colorizer = { + enable = true; + + settings = { + filetypes = [ + "*" + "!markdown" + ]; + user_commands = true; + + options = { + parsers = { + css = true; + tailwind = { + enable = true; + lsp = true; + update_names = true; + }; + }; + + display.mode = "background"; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/ui/default.nix b/modules/applications/vim/plugins/ui/default.nix new file mode 100644 index 0000000..6055700 --- /dev/null +++ b/modules/applications/vim/plugins/ui/default.nix @@ -0,0 +1,18 @@ +{ lib, ... }@args: +lib.mkMerge [ + (import ./barbar.nix args) + (import ./blankline.nix args) + (import ./colorizer.nix args) + (import ./dropbar.nix args) + (import ./lightbulb.nix args) + (import ./lualine.nix args) + (import ./markview.nix args) + (import ./neo-tree.nix args) + (import ./scrollbar.nix args) + (import ./toggleterm.nix args) + (import ./treesitter.nix args) + (import ./ufo.nix args) + (import ./web-devicons.nix args) + (import ./which-key.nix args) + (import ./zen-mode.nix args) +] diff --git a/modules/applications/vim/plugins/ui/dropbar.nix b/modules/applications/vim/plugins/ui/dropbar.nix new file mode 100644 index 0000000..d6eea7d --- /dev/null +++ b/modules/applications/vim/plugins/ui/dropbar.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.dropbar.enable = true; +} diff --git a/modules/applications/vim/plugins/ui/lightbulb.nix b/modules/applications/vim/plugins/ui/lightbulb.nix new file mode 100644 index 0000000..fd887e3 --- /dev/null +++ b/modules/applications/vim/plugins/ui/lightbulb.nix @@ -0,0 +1,6 @@ +_: { + programs.nixvim.plugins.nvim-lightbulb = { + enable = true; + settings.autocmd.enabled = true; + }; +} diff --git a/modules/applications/vim/plugins/ui/lualine.nix b/modules/applications/vim/plugins/ui/lualine.nix new file mode 100644 index 0000000..8c7a508 --- /dev/null +++ b/modules/applications/vim/plugins/ui/lualine.nix @@ -0,0 +1,25 @@ +_: { + programs.nixvim.plugins.lualine = { + enable = true; + settings.sections.lualine_x = [ + { + __raw = '' + function() + local ok, conform = pcall(require, "conform") + if not ok then return "" end + local formatters = conform.list_formatters(0) + for _, f in ipairs(formatters) do + if f.available then + return "󰛖 " .. f.name + end + end + return "" + end + ''; + } + "encoding" + "fileformat" + "filetype" + ]; + }; +} diff --git a/modules/applications/vim/plugins/ui/markview.nix b/modules/applications/vim/plugins/ui/markview.nix new file mode 100644 index 0000000..a67adc1 --- /dev/null +++ b/modules/applications/vim/plugins/ui/markview.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.markview-nvim ]; + extraConfigLua = '' + require("markview").setup({ initial_state = false }) + ''; + }; +} diff --git a/modules/applications/vim/plugins/ui/neo-tree.nix b/modules/applications/vim/plugins/ui/neo-tree.nix new file mode 100644 index 0000000..f3fe5e8 --- /dev/null +++ b/modules/applications/vim/plugins/ui/neo-tree.nix @@ -0,0 +1,37 @@ +_: { + programs.nixvim = { + plugins.neo-tree = { + enable = true; + settings = { + close_if_last_window = true; + + filesystem = { + follow_current_file = { + enabled = true; + leave_dirs_open = true; + }; + + filtered_items = { + visible = true; + hide_dotfiles = false; + hide_gitignored = true; + hide_ignored = false; + hide_hidden = false; + + hide_by_name = [ ]; + hide_by_pattern = [ ]; + + always_show = [ ]; + always_show_by_pattern = [ ]; + + never_show = [ + ".DS_Store" + "thumbs.db" + ]; + never_show_by_pattern = [ ]; + }; + }; + }; + }; + }; +} diff --git a/modules/applications/vim/plugins/ui/scrollbar.nix b/modules/applications/vim/plugins/ui/scrollbar.nix new file mode 100644 index 0000000..c7c53b5 --- /dev/null +++ b/modules/applications/vim/plugins/ui/scrollbar.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.nvim-scrollbar ]; + extraConfigLua = '' + require("scrollbar").setup() + ''; + }; +} diff --git a/modules/applications/vim/plugins/ui/toggleterm.nix b/modules/applications/vim/plugins/ui/toggleterm.nix new file mode 100644 index 0000000..123dde3 --- /dev/null +++ b/modules/applications/vim/plugins/ui/toggleterm.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.toggleterm.enable = true; +} diff --git a/modules/applications/vim/plugins/ui/treesitter.nix b/modules/applications/vim/plugins/ui/treesitter.nix new file mode 100644 index 0000000..9a3f85e --- /dev/null +++ b/modules/applications/vim/plugins/ui/treesitter.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins."treesitter-context".enable = true; +} diff --git a/modules/applications/vim/plugins/ui/ufo.nix b/modules/applications/vim/plugins/ui/ufo.nix new file mode 100644 index 0000000..d59f54c --- /dev/null +++ b/modules/applications/vim/plugins/ui/ufo.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + opts = { + foldcolumn = "1"; + foldlevel = 99; + foldlevelstart = 99; + foldenable = true; + }; + + extraPlugins = [ + pkgs.vimPlugins.nvim-ufo + pkgs.vimPlugins.promise-async + ]; + + extraConfigLua = '' + require("ufo").setup({ + provider_selector = function() + return { "treesitter", "indent" } + end, + }) + ''; + }; +} diff --git a/modules/applications/vim/plugins/ui/web-devicons.nix b/modules/applications/vim/plugins/ui/web-devicons.nix new file mode 100644 index 0000000..12d195f --- /dev/null +++ b/modules/applications/vim/plugins/ui/web-devicons.nix @@ -0,0 +1,4 @@ +_: { + # icon set preview + programs.nixvim.plugins.web-devicons.enable = true; +} diff --git a/modules/applications/vim/plugins/ui/which-key.nix b/modules/applications/vim/plugins/ui/which-key.nix new file mode 100644 index 0000000..7f0441d --- /dev/null +++ b/modules/applications/vim/plugins/ui/which-key.nix @@ -0,0 +1,4 @@ +_: { + # key map help + programs.nixvim.plugins.which-key.enable = true; +} diff --git a/modules/applications/vim/plugins/ui/zen-mode.nix b/modules/applications/vim/plugins/ui/zen-mode.nix new file mode 100644 index 0000000..23c7a5f --- /dev/null +++ b/modules/applications/vim/plugins/ui/zen-mode.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.zen-mode-nvim ]; + extraConfigLua = '' + require("zen-mode").setup() + ''; + }; +}