From 53a821411ff945eeb7100913eb344e417ffc0bda Mon Sep 17 00:00:00 2001 From: Albin Chaboissier Date: Fri, 5 Dec 2025 18:37:07 +0100 Subject: [PATCH] Working treesitter, gruvboxmaterial, flash.nvim --- lua/config/set.lua | 7 ++++ lua/plugins/colors.lua | 75 ++++++++++++++++++++++---------------- lua/plugins/flash.lua | 21 +++++++++++ lua/plugins/lsp.lua | 2 + lua/plugins/metals.lua | 1 - lua/plugins/noconf.lua | 12 ++++-- lua/plugins/r.lua | 47 ------------------------ lua/plugins/rust.lua | 4 -- lua/plugins/treesitter.lua | 42 +++++++++++++++++++++ 9 files changed, 124 insertions(+), 87 deletions(-) create mode 100644 lua/plugins/flash.lua delete mode 100644 lua/plugins/metals.lua delete mode 100644 lua/plugins/r.lua create mode 100644 lua/plugins/treesitter.lua diff --git a/lua/config/set.lua b/lua/config/set.lua index 067dadf..ba0d3a2 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -28,3 +28,10 @@ vim.opt.updatetime = 50 vim.cmd("highlight Normal ctermbg=NONE") vim.cmd("highlight NonText ctermbg=NONE") + +vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { + pattern = "*.wgsl", + callback = function() + vim.bo.filetype = "wgsl" + end, + }) diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua index 16b6e5d..3bd8e28 100644 --- a/lua/plugins/colors.lua +++ b/lua/plugins/colors.lua @@ -1,34 +1,45 @@ return { - { - "ellisonleao/gruvbox.nvim", - priority = 1000, - config = function() - -- Default options: - require("gruvbox").setup({ - terminal_colors = true, -- add neovim terminal colors - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - emphasis = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "hard", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = {}, - dim_inactive = false, - transparent_mode = false, - }) - vim.cmd("colorscheme gruvbox") - end, - }, + "sainnhe/gruvbox-material", + lazy = false, + priority = 1000, + config = function() + vim.g.gruvbox_material_enable_italic = true + vim.g.gruvbox_material_background = "medium" + vim.g.gruvbox_material_better_performance = 1 + vim.cmd.colorscheme("gruvbox-material") + end } +-- return { +-- { +-- "ellisonleao/gruvbox.nvim", +-- priority = 1000, +-- config = function() +-- -- Default options: +-- require("gruvbox").setup({ +-- terminal_colors = true, -- add neovim terminal colors +-- undercurl = true, +-- underline = true, +-- bold = true, +-- italic = { +-- strings = true, +-- emphasis = true, +-- comments = true, +-- operators = false, +-- folds = true, +-- }, +-- strikethrough = true, +-- invert_selection = false, +-- invert_signs = false, +-- invert_tabline = false, +-- invert_intend_guides = false, +-- inverse = true, -- invert background for search, diffs, statuslines and errors +-- contrast = "hard", -- can be "hard", "soft" or empty string +-- palette_overrides = {}, +-- overrides = {}, +-- dim_inactive = false, +-- transparent_mode = false, +-- }) +-- vim.cmd("colorscheme gruvbox") +-- end, +-- }, +-- } diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua new file mode 100644 index 0000000..d4cce87 --- /dev/null +++ b/lua/plugins/flash.lua @@ -0,0 +1,21 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = { + modes = + { + search = + { + enabled = true + } + } + }, + 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/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index ba30d41..ec995d7 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -94,6 +94,8 @@ return { vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "a", vim.lsp.buf.code_action, opts) + vim.keymap.set("v", "a", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "f", function() vim.lsp.buf.format({ async = true }) end, opts) diff --git a/lua/plugins/metals.lua b/lua/plugins/metals.lua deleted file mode 100644 index a564707..0000000 --- a/lua/plugins/metals.lua +++ /dev/null @@ -1 +0,0 @@ -return {} diff --git a/lua/plugins/noconf.lua b/lua/plugins/noconf.lua index 2097c95..6530188 100644 --- a/lua/plugins/noconf.lua +++ b/lua/plugins/noconf.lua @@ -1,3 +1,9 @@ -return { - "nvim-treesitter/nvim-treesitter" -} +return {} +-- return { +-- {"nvim-treesitter/nvim-treesitter", lazy = false, branch = "master", build = ":TSUpdate", +-- config = function() +-- local parsers = require "nvim-treesitter.parsers" +-- local parser_config = parsers.get_parser_configs() +-- parser_config.wgsl_bevy.filetype_to_parsername = "wgsl" +-- end} +-- } diff --git a/lua/plugins/r.lua b/lua/plugins/r.lua deleted file mode 100644 index 324777a..0000000 --- a/lua/plugins/r.lua +++ /dev/null @@ -1,47 +0,0 @@ -return { - "R-nvim/R.nvim", - -- Only required if you also set defaults.lazy = true - lazy = false, - -- R.nvim is still young and we may make some breaking changes from time - -- to time (but also bug fixes all the time). If configuration stability - -- is a high priority for you, pin to the latest minor version, but unpin - -- it and try the latest version before reporting an issue: - -- version = "~0.1.0" - config = function() - -- Create a table with the options to be passed to setup() - ---@type RConfigUserOpts - local opts = { - hook = { - on_filetype = function() - vim.api.nvim_buf_set_keymap(0, "n", "", "RDSendLine", {}) - vim.api.nvim_buf_set_keymap(0, "v", "", "RSendSelection", {}) - end, - }, - R_args = { "--quiet", "--no-save" }, - min_editor_width = 72, - rconsole_width = 78, - objbr_mappings = { -- Object browser keymap - c = "class", -- Call R functions - ["gg"] = "head({object}, n = 15)", -- Use {object} notation to write arbitrary R code. - v = function() - -- Run lua functions - require("r.browser").toggle_view() - end, - }, - disable_cmds = { - "RClearConsole", - "RCustomStart", - "RSPlot", - "RSaveClose", - }, - } - -- Check if the environment variable "R_AUTO_START" exists. - -- If using fish shell, you could put in your config.fish: - -- alias r "R_AUTO_START=true nvim" - -- if vim.env.R_AUTO_START == "true" then - opts.auto_start = "on startup" - opts.objbr_auto_start = true - -- end - require("r").setup(opts) - end, -} diff --git a/lua/plugins/rust.lua b/lua/plugins/rust.lua index 16d6326..be798a6 100644 --- a/lua/plugins/rust.lua +++ b/lua/plugins/rust.lua @@ -19,10 +19,6 @@ return { }, on_attach = function(client, bufnr) -- you can also put keymaps in here - vim.keymap.set("n", "ca", function() - vim.cmd.RustLsp("codeAction") -- supports rust-analyzer's grouping - -- or vim.lsp.buf.codeAction() if you don't want grouping. - end, { silent = true, buffer = bufnr }) vim.keymap.set( "n", "t", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..0316a91 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,42 @@ +return { + "nvim-treesitter/nvim-treesitter", + lazy = false, + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + opts = { + ensure_installed = { + "bash", + "c", + "diff", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "rust", + "toml", + "vim", + "vimdoc", + "yaml", + "wgsl", + }, + + sync_install = false, + auto_install = true, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + + indent = { enable = true }, + }, + + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, +}