From 006947064134f331260361bb193a46ae093bb514 Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 26 Jan 2025 14:00:07 +0000 Subject: [PATCH] feat(nvim): Apperance and Cursor Movement --- tools/fish/conf.d/colorscheme.fish | 1 + tools/nvim/init.lua | 1 + tools/nvim/lazy-lock.json | 7 +++++-- tools/nvim/lua/config/diagnostics.lua | 11 +++++++++++ tools/nvim/lua/config/servers.lua | 15 +++++++++++++++ tools/nvim/lua/plugins/appearance.lua | 13 +++++++++++++ tools/nvim/lua/plugins/fileutils.lua | 22 ++++++++++++++++++---- tools/nvim/lua/plugins/misc.lua | 14 ++++++++++++++ tools/nvim/lua/plugins/mod/bufferline.lua | 7 +++++++ tools/nvim/lua/plugins/mod/winbar-nvim.lua | 3 ++- 10 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 tools/fish/conf.d/colorscheme.fish create mode 100644 tools/nvim/lua/config/diagnostics.lua diff --git a/tools/fish/conf.d/colorscheme.fish b/tools/fish/conf.d/colorscheme.fish new file mode 100644 index 0000000..51f18f4 --- /dev/null +++ b/tools/fish/conf.d/colorscheme.fish @@ -0,0 +1 @@ +fish_config theme choose "Catppuccin Mocha" diff --git a/tools/nvim/init.lua b/tools/nvim/init.lua index 820a3f2..b7b83ff 100644 --- a/tools/nvim/init.lua +++ b/tools/nvim/init.lua @@ -10,3 +10,4 @@ require("config.options") require("config.plugins") require("config.colorscheme") require("config.keymaps") +require("config.diagnostics") diff --git a/tools/nvim/lazy-lock.json b/tools/nvim/lazy-lock.json index b5803e2..39f7b93 100644 --- a/tools/nvim/lazy-lock.json +++ b/tools/nvim/lazy-lock.json @@ -13,21 +13,23 @@ "code_runner.nvim": { "branch": "main", "commit": "65218f8f646fe61e506090522df357539642ae83" }, "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" }, "hover.nvim": { "branch": "main", "commit": "140c4d0ae9397b76baa46b87c574f5377de09309" }, "kanagawa.nvim": { "branch": "master", "commit": "988082eb00b845e4afbcaa4fd8e903da8a3ab3b9" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, + "lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "luasnip-latex-snippets.nvim": { "branch": "main", "commit": "cab134611eb755abe9ba95f5d86969f5cece448d" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, "nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" }, - "nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" }, + "nvim-lspconfig": { "branch": "master", "commit": "e5bf88e5ea1c4cea5ea96b1e970cb264f7a401a1" }, "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, "nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" }, - "nvim-treesitter": { "branch": "master", "commit": "f3d7c0dafcbc86c4d63f765649c884a03bc1360a" }, + "nvim-treesitter": { "branch": "master", "commit": "d34e62afd3e483fe0fa2f24b6323f3bb1d35ddcc" }, "nvim-treesitter-context": { "branch": "master", "commit": "bece284c5322ddf6946fa4bdc383a2bc033269d7" }, "nvim-web-devicons": { "branch": "master", "commit": "37334adf4517fecfd97c0b44e1d4718e377e9e52" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, @@ -37,6 +39,7 @@ "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, "telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-just": { "branch": "main", "commit": "d07978c23c967c54c04a4dff9b25bcd6de5e91e0" }, diff --git a/tools/nvim/lua/config/diagnostics.lua b/tools/nvim/lua/config/diagnostics.lua new file mode 100644 index 0000000..cdc7bef --- /dev/null +++ b/tools/nvim/lua/config/diagnostics.lua @@ -0,0 +1,11 @@ +local signs = { + Error = "", + Warning = "", + Hint = "", + Information = "", +} + +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) +end diff --git a/tools/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua index e11a6ec..ecaaebf 100644 --- a/tools/nvim/lua/config/servers.lua +++ b/tools/nvim/lua/config/servers.lua @@ -3,15 +3,30 @@ --- for available server and name local M = {} M.servers = { + "ast_grep", + "bashls", -- Bash "clangd", -- C/C++ + "cssls", -- CSS + "denols", -- Deno -- "cmake", -- CMake "eslint", -- JavaScript + "gopls", -- Go + "hls", -- Haskell "html", -- HTML + "jsonls", -- JSON "lua_ls", -- Lua + "markdown_oxide", -- Markdown "omnisharp", -- C# & F# "powershell_es", -- PowerShell "pyright", -- Python + "rust_analyzer", -- Rust + "svelte", -- Svelte + "svlangserver", -- SystemVerilog + "tailwindcss", -- TailwindCSS + "taplo", -- TOML + "ts_ls", -- TypeScript "vimls", -- vimscript + "yamlls", -- YAML } M.server_config = { diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 8557752..af98536 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -25,4 +25,17 @@ return { { import = "plugins.mod.alpha-nvim" }, { import = "plugins.mod.winbar-nvim" }, { import = "plugins.mod.bufferline" }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup({ + current_line_blame = true, + }) + end, + }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + }, } diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index b299de4..75b0457 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -47,9 +47,23 @@ return { end, }, { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - end, + "kdheepak/lazygit.nvim", + lazy = true, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "gg", "LazyGit", desc = "LazyGit" }, + }, }, } diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 9a7bd8f..1ee5a99 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -12,4 +12,18 @@ return { "github/copilot.vim", lazy = false, }, + { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, + }, } diff --git a/tools/nvim/lua/plugins/mod/bufferline.lua b/tools/nvim/lua/plugins/mod/bufferline.lua index c02f345..0993078 100644 --- a/tools/nvim/lua/plugins/mod/bufferline.lua +++ b/tools/nvim/lua/plugins/mod/bufferline.lua @@ -4,6 +4,13 @@ return { config = function() require("bufferline").setup({ options = { + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local icon = level:match("error") and " " or " " + return " " .. icon .. count + end, + + show_buffer_icons = true, numbers = "ordinal", -- 显示 buffer 序号 close_command = "bdelete! %d", -- 关闭 buffer 的命令 right_mouse_command = "bdelete! %d", -- 右键关闭 diff --git a/tools/nvim/lua/plugins/mod/winbar-nvim.lua b/tools/nvim/lua/plugins/mod/winbar-nvim.lua index 496ce0c..f0f676e 100644 --- a/tools/nvim/lua/plugins/mod/winbar-nvim.lua +++ b/tools/nvim/lua/plugins/mod/winbar-nvim.lua @@ -7,7 +7,7 @@ return { show_file_path = true, show_symbols = true, colors = { - path = "#9c1d91", + path = "", file_name = "", symbols = "", }, @@ -31,6 +31,7 @@ return { "spectre_panel", "toggleterm", "qf", + "floaterm", }, }) end,