diff --git a/init.lua b/init.lua index 46566a12..5ad5320e 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` @@ -123,6 +123,12 @@ vim.o.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.o.showmode = false +-- Hide the command line when not in use +vim.o.cmdheight = 1 + +-- Hide the default tab line since we're using bufferline +vim.o.showtabline = 0 + -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -362,6 +368,7 @@ require('lazy').setup({ { 's', group = '[S]earch' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 'b', group = '[B]uffer' }, }, }, }, diff --git a/lua/custom/plugins/bufdelete.lua b/lua/custom/plugins/bufdelete.lua new file mode 100644 index 00000000..12de6884 --- /dev/null +++ b/lua/custom/plugins/bufdelete.lua @@ -0,0 +1,18 @@ +-- filepath: /home/kali/.config/nvim/lua/custom/plugins/bufdelete.lua +-- Bufdelete for properly closing buffers +-- https://github.com/famiu/bufdelete.nvim + +return { + 'famiu/bufdelete.nvim', + event = "VeryLazy", -- lazy load + config = function() + -- Key mappings to delete buffers + vim.keymap.set('n', 'bd', function() + require("bufdelete").bufdelete(0, false) + end, {noremap = true, desc = "Delete buffer"}) + + vim.keymap.set('n', 'bD', function() + require("bufdelete").bufdelete(0, true) + end, {noremap = true, desc = "Delete buffer (force)"}) + end +} diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua new file mode 100644 index 00000000..ba9d54a0 --- /dev/null +++ b/lua/custom/plugins/bufferline.lua @@ -0,0 +1,87 @@ +-- filepath: /home/kali/.config/nvim/lua/custom/plugins/bufferline.lua +-- Bufferline configuration +-- https://github.com/akinsho/bufferline.nvim + +return { + 'akinsho/bufferline.nvim', + version = "*", -- use the latest stable version + event = "VeryLazy", -- lazy load for better startup + dependencies = { + 'nvim-tree/nvim-web-devicons', -- for file icons + }, + opts = { + options = { + -- Themes and appearance + indicator = { + style = 'icon', + icon = '▎', + }, + buffer_close_icon = '󰅖', + modified_icon = '●', + close_icon = '', + left_trunc_marker = '', + right_trunc_marker = '', + max_name_length = 18, + max_prefix_length = 15, + truncate_names = true, + tab_size = 18, + diagnostics = "nvim_lsp", -- Use LSP diagnostics + diagnostics_update_in_insert = false, + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local icon = level:match("error") and " " or " " + return " " .. icon .. count + end, + offsets = { + { + filetype = "neo-tree", + text = "File Explorer", + text_align = "center", + separator = true + } + }, + color_icons = true, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + separator_style = "thin", + enforce_regular_tabs = false, + always_show_bufferline = true, + hover = { + enabled = true, + delay = 200, + reveal = {'close'} + }, + }, + -- Colorscheme integration + highlights = { + -- These are automatically integrated with your colorscheme + }, + }, + config = function(_, opts) + require("bufferline").setup(opts) + + -- Key mappings for navigating between buffers + vim.keymap.set('n', 'bp', 'BufferLinePick', {noremap = true, desc = "Pick buffer"}) + vim.keymap.set('n', 'bc', 'BufferLinePickClose', {noremap = true, desc = "Pick buffer to close"}) + vim.keymap.set('n', 'bh', 'BufferLineCyclePrev', {noremap = true, desc = "Previous buffer"}) + vim.keymap.set('n', 'bl', 'BufferLineCycleNext', {noremap = true, desc = "Next buffer"}) + vim.keymap.set('n', 'bH', 'BufferLineMovePrev', {noremap = true, desc = "Move buffer left"}) + vim.keymap.set('n', 'bL', 'BufferLineMoveNext', {noremap = true, desc = "Move buffer right"}) + vim.keymap.set('n', 'b1', 'BufferLineGoToBuffer 1', {noremap = true, desc = "Go to buffer 1"}) + vim.keymap.set('n', 'b2', 'BufferLineGoToBuffer 2', {noremap = true, desc = "Go to buffer 2"}) + vim.keymap.set('n', 'b3', 'BufferLineGoToBuffer 3', {noremap = true, desc = "Go to buffer 3"}) + vim.keymap.set('n', 'b4', 'BufferLineGoToBuffer 4', {noremap = true, desc = "Go to buffer 4"}) + vim.keymap.set('n', 'b5', 'BufferLineGoToBuffer 5', {noremap = true, desc = "Go to buffer 5"}) + vim.keymap.set('n', 'b6', 'BufferLineGoToBuffer 6', {noremap = true, desc = "Go to buffer 6"}) + vim.keymap.set('n', 'b7', 'BufferLineGoToBuffer 7', {noremap = true, desc = "Go to buffer 7"}) + vim.keymap.set('n', 'b8', 'BufferLineGoToBuffer 8', {noremap = true, desc = "Go to buffer 8"}) + vim.keymap.set('n', 'b9', 'BufferLineGoToBuffer 9', {noremap = true, desc = "Go to buffer 9"}) + + -- Additional keymaps for Alt+number to switch buffers quickly + for i = 1, 9 do + vim.keymap.set('n', string.format('', i), string.format('BufferLineGoToBuffer %s', i), + {noremap = true, desc = string.format("Go to buffer %s", i)}) + end + end, +} diff --git a/lua/custom/plugins/catppuccin.lua b/lua/custom/plugins/catppuccin.lua new file mode 100644 index 00000000..08bdf4a1 --- /dev/null +++ b/lua/custom/plugins/catppuccin.lua @@ -0,0 +1,80 @@ +-- In your plugins configuration file (e.g., lua/plugins/catppuccin.lua or similar) +return { + { + 'catppuccin/nvim', + name = 'catppuccin', -- Optional, but can be useful for referring to the plugin + priority = 1000, -- Ensure it loads early to apply the colorscheme + lazy = false, -- Load on startup if you want it as your default theme + config = function() + -- Load the colorscheme here + -- vim.cmd.colorscheme "catppuccin" -- Default is "mocha" if no flavour is specified + + -- Or, to specify a flavour and set up integrations: + require('catppuccin').setup { + flavour = 'mocha', -- latte, frappe, macchiato, mocha + background = { -- :h background + light = 'latte', + dark = 'mocha', + }, + transparent_background = false, -- useful if you want the underlying terminal colors to show through + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = true, -- Toggles Neovim terminal colors for the Catppuccin palette. + dim_inactive = { + enabled = false, -- dims inactive windows + shade = 'dark', + percentage = 0.15, + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { 'italic' }, + conditionals = { 'italic' }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Custom groups for miscellaneous items specific to firmware development + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + telescope = true, + notify = true, + mini = { + enabled = true, + indentscope_color = '', + }, + -- For more plugins integrations please check integration table in the README project + native_lsp = { + enabled = true, + underlines = { + errors = { 'undercurl' }, + hints = { 'undercurl' }, + warnings = { 'undercurl' }, + information = { 'undercurl' }, + }, + }, + headlines = true, + indent_blankline = { + enabled = true, + scope_color = 'mauve', -- catppuccin color a available flavor + -- Also a vailable: latte, frappe, macchiato, mocha + }, + }, + } + + -- After setting up, set the colorscheme + vim.cmd.colorscheme 'catppuccin' + end, + }, +} diff --git a/lua/custom/plugins/code_runner_guide.md b/lua/custom/plugins/code_runner_guide.md deleted file mode 100644 index e69de29b..00000000 diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 00000000..a8b379c0 --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,87 @@ +-- Trouble - A pretty diagnostics, references, telescope results, quickfix and location list +-- https://github.com/folke/trouble.nvim + +return { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + event = { "BufReadPost", "BufNewFile" }, + cmd = { "TroubleToggle", "Trouble" }, + opts = { + position = "bottom", -- position of the list can be: bottom, top, left, right + height = 12, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + group = true, -- group results by file + padding = true, -- add an extra new line on top of the list + action_keys = { -- key mappings for actions in the trouble list + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "", "<2-leftmouse>" }, -- jump to the diagnostic or open / close folds + open_split = { "" }, -- open buffer in new split + open_vsplit = { "" }, -- open buffer in new vsplit + open_tab = { "" }, -- open buffer in new tab + jump_close = {"o"}, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + switch_severity = "s", -- switch "diagnostics" severity filter + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + open_code_href = "c", -- if present, open a URI with more information about the diagnostic error + close_folds = {"zM", "zm"}, -- close all folds + open_folds = {"zR", "zr"}, -- open all folds + toggle_fold = {"zA", "za"}, -- toggle fold of current file + previous = "k", -- previous item + next = "j", -- next item + help = "?" -- help menu + }, + multiline = true, -- render multi-line messages + indent_lines = true, -- add an indent guide below the fold icons + win_config = { border = "rounded" }, -- window configuration for floating windows + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false, -- automatically fold a file trouble list at creation + auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result + signs = { + -- icons / text used for a diagnostic + error = "", + warning = "", + hint = "", + information = "", + other = "", + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + }, + keys = { + { "xx", "TroubleToggle document_diagnostics", desc = "Document Diagnostics (Trouble)" }, + { "xX", "TroubleToggle workspace_diagnostics", desc = "Workspace Diagnostics (Trouble)" }, + { "xL", "TroubleToggle loclist", desc = "Location List (Trouble)" }, + { "xQ", "TroubleToggle quickfix", desc = "Quickfix List (Trouble)" }, + { "gR", "TroubleToggle lsp_references", desc = "LSP References (Trouble)" }, + { "gD", "TroubleToggle lsp_definitions", desc = "LSP Definitions (Trouble)" }, + { "xT", "TodoTrouble", desc = "TODOs (Trouble)", cond = function() return require("lazy.core.config").spec.plugins["todo-comments"] ~= nil end }, + }, + config = function(_, opts) + require("trouble").setup(opts) + + -- Add which-key group + local ok, which_key = pcall(require, "which-key") + if ok then + which_key.register({ + ["x"] = { + name = "Trouble/Diagnostics", + x = { "TroubleToggle document_diagnostics", "Document Diagnostics" }, + X = { "TroubleToggle workspace_diagnostics", "Workspace Diagnostics" }, + L = { "TroubleToggle loclist", "Location List" }, + Q = { "TroubleToggle quickfix", "Quickfix List" }, + T = { "TodoTrouble", "TODOs" }, + }, + }) + end + end, +}