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

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!