diff options
| author | Skladnayazebra <skladnayazebra@gmail.com> | 2026-04-04 21:18:45 +0200 |
|---|---|---|
| committer | Skladnayazebra <skladnayazebra@gmail.com> | 2026-04-04 21:18:45 +0200 |
| commit | 5938a465dbbf910ca0609a1db9ac13d52616af7e (patch) | |
| tree | 14d70b052e32edc190d7304555fc958eb0ed6ec0 /nvim/lua/config/plugins | |
| parent | feae0fffe6c39eb2732c7afbd16599f949a00b3d (diff) | |
nvim: refactor plugins config; add tree-sitter with proper config this time
Diffstat (limited to 'nvim/lua/config/plugins')
| -rw-r--r-- | nvim/lua/config/plugins/blink-cmp.lua | 42 | ||||
| -rw-r--r-- | nvim/lua/config/plugins/fzf.lua | 46 | ||||
| -rw-r--r-- | nvim/lua/config/plugins/tree-sitter.lua | 27 |
3 files changed, 115 insertions, 0 deletions
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', + -- <up>-<down> to navigate, <right> to accept + ['<C-j>'] = { 'select_next', 'fallback' }, + ['<C-k>'] = { 'select_prev', 'fallback' }, + ['<Tab>'] = { 'select_and_accept', 'fallback' }, + ['<C-l>'] = { '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', '<leader>ff', ':FzfLua files<CR>', { silent = true, desc = 'Fzf: Files' }) +vim.keymap.set('n', '<leader>fr', ':FzfLua resume<CR>', { silent = true, desc = 'Fzf: Resume (After Alt+Esc)' }) +vim.keymap.set('n', '<leader>fg', ':FzfLua live_grep<CR>', { silent = true, desc = 'Fzf: Live Grep' }) +vim.keymap.set('n', '<leader>fG', ':FzfLua grep<CR>', { silent = true, desc = 'Fzf: Grep' }) +vim.keymap.set('n', '<leader>fs', ':FzfLua git_status<CR>', { silent = true, desc = 'Fzf: git status' }) +vim.keymap.set('n', '<leader>fls', ':FzfLua lsp_workspace_symbols<CR>', { silent = true, desc = 'Fzf: LSP Symbols' }) +vim.keymap.set('n', '<leader>flr', ':FzfLua lsp_references<CR>', { silent = true, desc = 'Fzf: LSP - References' }) +vim.keymap.set('n', '<leader>flf', ':FzfLua lsp_finder<CR>', { silent = true, desc = 'Fzf: LSP - Finder' }) +vim.keymap.set('n', '<leader>fb', ':FzfLua buffers<CR>', { silent = true, desc = 'Fzf: Buffers' }) +vim.keymap.set('n', '<leader>fk', ':FzfLua keymaps<CR>', { silent = true, desc = 'Fzf: Keymaps' }) +vim.keymap.set('n', '<leader>fa', ':FzfLua args<CR>', { silent = true, desc = 'Fzf: Args' }) +vim.keymap.set('n', '<leader>fq', ':FzfLua quickfix<CR>', { 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 + } +} |
