From c5bd8f63fbc26951ca409f10643b13c12fee2270 Mon Sep 17 00:00:00 2001 From: jasonhilder Date: Tue, 7 Apr 2026 09:49:07 +0200 Subject: [PATCH] Update config/nvim/lua/plugins/init.lua --- config/nvim/lua/plugins/init.lua | 98 ++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/config/nvim/lua/plugins/init.lua b/config/nvim/lua/plugins/init.lua index b976298..45249bd 100644 --- a/config/nvim/lua/plugins/init.lua +++ b/config/nvim/lua/plugins/init.lua @@ -4,46 +4,60 @@ vim.pack.add({ { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "master" }, }) --- Required funny setup for cleaning up output in godot projects. -require("fzf-lua").setup({ - files = { - cmd = (function() - if vim.fn.findfile("project.godot", vim.fn.getcwd() .. ";") ~= "" then - return "fdfind --type f -e gd -e gdshader -e gdshaderinc -e tres -e tscn -e cfg -e json -e toml -e txt -e md --exclude={.godot,.git}" - else - return "fdfind --exclude={.git,.cache,.xmake,.zig-cache,build,tmp,node_modules,elpa} --type f -H" - end - end)(), - }, -}) +local map = vim.keymap.set -require("nvim-treesitter.configs").setup({ - ensure_installed = { - -- Godot - "gdscript", - "godot_resource", - -- Go - "go", - "gomod", - "gosum", - "gowork", - -- Web (common) - "html", - "css", - "javascript", - "typescript", - -- General - "lua", - "python", - "bash", - "json", - "toml", - "yaml", - "markdown", - "markdown_inline", - "vim", - "vimdoc", - }, - highlight = { enable = true }, - indent = { enable = true }, -}) +local ok_fzf, fzf = pcall(require, "fzf-lua") +if ok_fzf then + fzf.setup({ + files = { + cmd = (function() + if vim.fn.findfile("project.godot", vim.fn.getcwd() .. ";") ~= "" then + return "fdfind --type f -e gd -e gdshader -e gdshaderinc -e tres -e tscn -e cfg -e json -e toml -e txt -e md --exclude={.godot,.git}" + else + return "fdfind --exclude={.git,.cache,.xmake,.zig-cache,build,tmp,node_modules,elpa} --type f -H" + end + end)(), + }, + }) + + map("n", "ff", function() fzf.files() end) + map("n", "fo", function() fzf.buffers() end) + map("n", "sp", function() fzf.grep_project() end) + map("n", "sf", function() fzf.grep_curbuf() end) + map("n", "sw", function() fzf.grep_cword() end) + map("n", "sh", function() fzf.help_tags() end) +end + +local ok_ts, ts = pcall(require, "nvim-treesitter.configs") +if ok_ts then + ts.setup({ + ensure_installed = { + -- Godot + "gdscript", + "godot_resource", + -- Go + "go", + "gomod", + "gosum", + "gowork", + -- Web (common) + "html", + "css", + "javascript", + "typescript", + -- General + "lua", + "python", + "bash", + "json", + "toml", + "yaml", + "markdown", + "markdown_inline", + "vim", + "vimdoc", + }, + highlight = { enable = true }, + indent = { enable = true }, + }) +end