From 5938a465dbbf910ca0609a1db9ac13d52616af7e Mon Sep 17 00:00:00 2001 From: Skladnayazebra Date: Sat, 4 Apr 2026 21:18:45 +0200 Subject: nvim: refactor plugins config; add tree-sitter with proper config this time --- nvim/lua/config/plugins/blink-cmp.lua | 42 ++++++++++++++++++++++++++++++ nvim/lua/config/plugins/fzf.lua | 46 +++++++++++++++++++++++++++++++++ nvim/lua/config/plugins/tree-sitter.lua | 27 +++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 nvim/lua/config/plugins/blink-cmp.lua create mode 100644 nvim/lua/config/plugins/fzf.lua create mode 100644 nvim/lua/config/plugins/tree-sitter.lua (limited to 'nvim/lua/config/plugins') diff --git a/nvim/lua/config/plugins/blink-cmp.lua b/nvim/lua/config/plugins/blink-cmp.lua new file mode 100644 index 0000000..c9c0447 --- /dev/null +++ b/nvim/lua/config/plugins/blink-cmp.lua @@ -0,0 +1,42 @@ +return { + 'saghen/blink.cmp', + dependencies = { 'rafamadriz/friendly-snippets' }, + + version = '1.*', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + keymap = { + preset = 'default', + -- - to navigate, to accept + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_and_accept', 'fallback' }, + [''] = { 'select_and_accept', 'fallback' }, + }, + + appearance = { + nerd_font_variant = 'mono' + }, + + completion = { documentation = { auto_show = true } }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + providers = { + snippets = { + opts = { + friendly_snippets = true, + extended_filetypes = { + typescript = { 'javascript' }, + } + } + } + } + }, + + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" } +} diff --git a/nvim/lua/config/plugins/fzf.lua b/nvim/lua/config/plugins/fzf.lua new file mode 100644 index 0000000..d50ca35 --- /dev/null +++ b/nvim/lua/config/plugins/fzf.lua @@ -0,0 +1,46 @@ +local file_edit_or_argadd = function(selected, opts) + if #selected > 1 then + FzfLua.actions.arg_add(selected, opts) + FzfLua.args() + else + return FzfLua.actions.file_edit(selected, opts) + end +end + +require('fzf-lua').setup({ + winopts = { + height = 1, + width = 0.7, + border = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + col = 1, -- right-aligned + border = 'none', + preview = { + wrap = true, + border = 'none', + scrollbar = false, + }, + }, + grep = { + hidden = true, -- show hidden files by default + }, + files = { + actions = { + ["enter"] = file_edit_or_argadd + } + }, +}) + +local opts = { silent = true } + +vim.keymap.set('n', 'ff', ':FzfLua files', { silent = true, desc = 'Fzf: Files' }) +vim.keymap.set('n', 'fr', ':FzfLua resume', { silent = true, desc = 'Fzf: Resume (After Alt+Esc)' }) +vim.keymap.set('n', 'fg', ':FzfLua live_grep', { silent = true, desc = 'Fzf: Live Grep' }) +vim.keymap.set('n', 'fG', ':FzfLua grep', { silent = true, desc = 'Fzf: Grep' }) +vim.keymap.set('n', 'fs', ':FzfLua git_status', { silent = true, desc = 'Fzf: git status' }) +vim.keymap.set('n', 'fls', ':FzfLua lsp_workspace_symbols', { silent = true, desc = 'Fzf: LSP Symbols' }) +vim.keymap.set('n', 'flr', ':FzfLua lsp_references', { silent = true, desc = 'Fzf: LSP - References' }) +vim.keymap.set('n', 'flf', ':FzfLua lsp_finder', { silent = true, desc = 'Fzf: LSP - Finder' }) +vim.keymap.set('n', 'fb', ':FzfLua buffers', { silent = true, desc = 'Fzf: Buffers' }) +vim.keymap.set('n', 'fk', ':FzfLua keymaps', { silent = true, desc = 'Fzf: Keymaps' }) +vim.keymap.set('n', 'fa', ':FzfLua args', { silent = true, desc = 'Fzf: Args' }) +vim.keymap.set('n', 'fq', ':FzfLua quickfix', { silent = true, desc = 'Fzf: Quickfix list' }) diff --git a/nvim/lua/config/plugins/tree-sitter.lua b/nvim/lua/config/plugins/tree-sitter.lua new file mode 100644 index 0000000..d37f98b --- /dev/null +++ b/nvim/lua/config/plugins/tree-sitter.lua @@ -0,0 +1,27 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + branch = 'master', + lazy = false, + build = ":TSUpdate", + config = function() + require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the listed parsers MUST always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" }, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + } + end + } +} -- cgit v1.3.1