Added more plugins

This commit is contained in:
Wojciech Pietraszuk 2025-05-09 17:55:33 +02:00
parent d350db2449
commit 9e5256058d
8 changed files with 260 additions and 42 deletions

View File

@ -73,7 +73,7 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's
<details><summary> Linux and Mac </summary>
```sh
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
git clone https://github.com/wojtek0123/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
```
</details>

100
init.lua
View File

@ -154,7 +154,7 @@ vim.opt.inccommand = 'split'
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
vim.opt.scrolloff = 99999999
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
@ -399,11 +399,19 @@ require('lazy').setup({
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
defaults = {
mappings = {
i = { ['<c-enter>'] = 'to_fuzzy_refine' },
n = {
-- I'm used to closing buffers with "d" from bufexplorer
['d'] = require('telescope.actions').delete_buffer,
-- I'm also used to quitting bufexplorer with q instead of escape
['q'] = require('telescope.actions').close,
['v'] = require('telescope.actions').select_vertical,
['h'] = require('telescope.actions').select_horizontal,
},
},
},
-- pickers = {}
extensions = {
['ui-select'] = {
@ -827,7 +835,9 @@ require('lazy').setup({
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = 'default',
preset = 'enter',
['<S-Tab>'] = { 'select_prev', 'fallback' },
['<Tab>'] = { 'select_next', 'fallback' },
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
@ -868,25 +878,13 @@ require('lazy').setup({
},
},
{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
{
'catppuccin/nvim',
lazy = false,
name = 'catppuccin',
priority = 1000,
config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = false }, -- Disable italics in comments
},
}
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
vim.cmd.colorscheme 'catppuccin-frappe'
end,
},
@ -916,7 +914,41 @@ require('lazy').setup({
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_nerd_font }
statusline.setup { use_icons = true }
local function get_winbar_path()
local full_path = vim.fn.expand '%:p'
return full_path:gsub(vim.fn.expand '$HOME', '~')
end
-- Function to get the number of open buffers using the :ls command
local function get_buffer_count()
local buffers = vim.fn.execute 'ls'
local count = 0
-- Match only lines that represent buffers, typically starting with a number followed by a space
for line in string.gmatch(buffers, '[^\r\n]+') do
if string.match(line, '^%s*%d+') then
count = count + 1
end
end
return count
end
-- Function to update the winbar
local function update_winbar()
local home_replaced = get_winbar_path()
local buffer_count = get_buffer_count()
local path = '%#WinBar2#(' .. buffer_count .. ') ' .. '%#WinBar1#' .. home_replaced .. '%*%=%#WinBar2#'
-- Override the section_filename function to disable file path
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_filename = function()
return path
end
end
-- Autocmd to update the winbar on BufEnter and WinEnter events
vim.api.nvim_create_autocmd({ 'BufEnter', 'WinEnter' }, {
callback = update_winbar,
})
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
@ -944,9 +976,9 @@ require('lazy').setup({
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
additional_vim_regex_highlighting = false,
},
indent = { enable = true, disable = { 'ruby' } },
indent = { enable = true },
},
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
@ -966,17 +998,17 @@ require('lazy').setup({
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lint',
require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!

View File

@ -0,0 +1,28 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
dependencies = {
'hrsh7th/nvim-cmp',
},
config = function()
local autopairs = require 'nvim-autopairs'
autopairs.setup {
check_ts = true, -- enable treesitter
ts_config = {
lua = { 'string' }, -- don't add pairs in lua string treesitter nodes
javascript = { 'template_string' }, -- don't add pairs in javscript template_string treesitter nodes
java = false, -- don't check treesitter on java
},
}
-- import nvim-autopairs completion functionality
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
-- import nvim-cmp plugin (completions plugin)
local cmp = require 'cmp'
-- make autopairs and completion work together
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View File

@ -0,0 +1,14 @@
return {
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "gs", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "gS", 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" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}

View File

@ -2,4 +2,8 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}
return {
require 'custom.plugins.flash',
require 'custom.plugins.autopairs',
require 'custom.plugins.wilder',
}

View File

@ -0,0 +1,19 @@
return {
'kdheepak/lazygit.nvim',
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 = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'Open [L]azy[G]it' },
},
}

View File

@ -0,0 +1,56 @@
return {
{
'gelguy/wilder.nvim',
keys = {
':',
'/',
'?',
},
dependencies = {
'catppuccin/nvim',
},
config = function()
local wilder = require 'wilder'
local macchiato = require('catppuccin.palettes').get_palette 'macchiato'
-- Create a highlight group for the popup menu
local text_highlight = wilder.make_hl('WilderText', { { a = 1 }, { a = 1 }, { foreground = macchiato.text } })
local mauve_highlight = wilder.make_hl('WilderMauve', { { a = 1 }, { a = 1 }, { foreground = macchiato.mauve } })
-- Enable wilder when pressing :, / or ?
wilder.setup { modes = { ':', '/', '?' } }
-- Enable fuzzy matching for commands and buffers
-- wilder.set_option("pipeline", {
-- wilder.branch(
-- wilder.cmdline_pipeline({
-- fuzzy = 1,
-- }),
-- wilder.vim_search_pipeline({
-- fuzzy = 1,
-- })
-- ),
-- })
wilder.set_option(
'renderer',
wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
highlighter = wilder.basic_highlighter(),
highlights = {
default = text_highlight,
border = mauve_highlight,
accent = mauve_highlight,
},
pumblend = 5,
min_height = '25%',
max_height = '25%',
border = 'rounded',
left = { ' ', wilder.popupmenu_devicons() },
right = { ' ', wilder.popupmenu_scrollbar() },
})
)
end,
build = ':UpdateRemotePlugins',
},
}

View File

@ -1,25 +1,90 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
cmd = 'Neotree',
init = function()
vim.api.nvim_create_autocmd('VimEnter', {
pattern = '*',
command = 'Neotree current',
})
end,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
{ '<leader>e', ':Neotree toggle<CR>', { desc = 'NeoTree toggle' } },
},
opts = {
event_handlers = {
{
event = 'neo_tree_buffer_enter',
handler = function()
vim.opt.relativenumber = true
end,
},
{
event = 'file_opened',
handler = function()
require('neo-tree.command').execute { action = 'close' }
end,
},
},
filesystem = {
bind_to_cwd = false,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
hijack_netrw_behavior = 'open_current',
window = {
mappings = {
['\\'] = 'close_window',
['<space>'] = 'none',
['<leader>E'] = 'close_window',
['J'] = function(state)
local tree = state.tree
local node = tree:get_node()
local siblings = tree:get_nodes(node:get_parent_id())
local renderer = require 'neo-tree.ui.renderer'
renderer.focus_node(state, siblings[#siblings]:get_id())
end,
['K'] = function(state)
local tree = state.tree
local node = tree:get_node()
local siblings = tree:get_nodes(node:get_parent_id())
local renderer = require 'neo-tree.ui.renderer'
renderer.focus_node(state, siblings[1]:get_id())
end,
['l'] = 'open',
['h'] = 'close_node',
},
},
filtered_items = {
hide_dotfiles = false,
hide_gitignored = false,
},
},
},
}
-- return {
-- 'nvim-neo-tree/neo-tree.nvim',
-- version = '*',
-- dependencies = {
-- 'nvim-lua/plenary.nvim',
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
-- 'MunifTanjim/nui.nvim',
-- },
-- cmd = 'Neotree',
-- keys = {
-- { '<leader>e', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
-- },
-- opts = {
-- filesystem = {
-- window = {
-- mappings = {
-- ['<leader>e'] = 'close_window',
-- },
-- },
-- },
-- },
-- }