-- Plugin configurations -- All plugin-specific settings are configured here -------------------------------- -- TELESCOPE -------------------------------- local function setup_telescope() local actions = require("telescope.actions") -- Function to open selected file in external program local function open_in_external_program(prompt_bufnr) local entry = require('telescope.actions.state').get_selected_entry() local file_path = entry.path or entry.filename if file_path then os.execute(string.format('start "" "%s"', file_path)) else print("No file selected") end actions.close(prompt_bufnr) end require('telescope').setup({ defaults = { layout_config = { vertical = { width = 0.5 } }, mappings = { n = { ["q"] = actions.close, ["o"] = open_in_external_program, }, i = { [""] = actions.close, [""] = actions.cycle_history_next, [""] = actions.cycle_history_prev, [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = open_in_external_program, } }, }, pickers = { live_grep = { file_ignore_patterns = { 'node_modules', '.git', '.venv' }, additional_args = function(_) return { "--hidden" } end }, find_files = { file_ignore_patterns = { 'node_modules', '.git', '.venv' }, hidden = true } } }) end -------------------------------- -- HARPOON -------------------------------- local function setup_harpoon() local harpoon = require("harpoon") -- Initialize harpoon harpoon:setup({ settings = { save_on_toggle = true, sync_on_ui_close = true, } }) end -------------------------------- -- OIL -------------------------------- local function setup_oil() require("oil").setup({ -- Default file explorer settings default_file_explorer = true, -- Columns to display columns = { "icon" }, -- Buffer options buf_options = { buflisted = false, bufhidden = "hide", }, -- Window options win_options = { wrap = false, signcolumn = "no", cursorcolumn = false, foldcolumn = "0", spell = false, list = false, conceallevel = 3, concealcursor = "nvic", }, -- File operations delete_to_trash = true, skip_confirm_for_simple_edits = false, prompt_save_on_select_new_entry = true, cleanup_delay_ms = 2000, -- UI behavior constrain_cursor = "editable", watch_for_changes = false, -- Custom keymaps keymaps = { ["g?"] = "actions.show_help", [""] = "actions.select", [""] = { "actions.select", opts = { vertical = true } }, [""] = { "actions.select", opts = { horizontal = true } }, [""] = "actions.preview", [""] = "actions.close", [""] = "actions.refresh", ["-"] = "actions.parent", ["_"] = "actions.open_cwd", ["`"] = "actions.cd", ["~"] = { "actions.cd", opts = { scope = "tab" } }, ["gs"] = "actions.change_sort", [""] = "actions.open_external", ["g."] = "actions.toggle_hidden", ["g\\"] = "actions.toggle_trash", ['yp'] = { desc = 'Copy filepath to system clipboard', callback = function () require('oil.actions').copy_entry_path.callback() vim.fn.setreg("+", vim.fn.getreg(vim.v.register)) end, }, }, -- Disable default keymaps use_default_keymaps = false, -- View options view_options = { show_hidden = false, natural_order = true, case_insensitive = false, sort = { { "type", "asc" }, { "name", "asc" }, }, }, -- Preview window settings preview = { max_width = 0.9, min_width = { 40, 0.4 }, max_height = 0.9, min_height = { 5, 0.1 }, border = "rounded", win_options = { winblend = 0 }, }, -- Floating window settings float = { padding = 2, max_width = 0, max_height = 0, border = "rounded", win_options = { winblend = 0 }, }, }) end -------------------------------- -- TOGGLETERM -------------------------------- local function setup_toggleterm() require("toggleterm").setup({ -- Shell to use in the terminal shell = "pwsh.exe -NoLogo", -- Display options direction = "float", float_opts = { border = "rounded", }, -- Window appearance winbar = { enabled = false }, -- Behavior start_in_insert = true, close_on_exit = true, -- Integration with tmux persist_size = true, persist_mode = true, }) end -------------------------------- -- TREESITTER -------------------------------- local function setup_treesitter() require('nvim-treesitter.configs').setup({ ensure_installed = { "c", "lua", "vim", "vimdoc", "cpp", "python" }, sync_install = false, auto_install = false, highlight = { enable = true }, indent = { enable = true }, }) end -------------------------------- -- COMMENTS -------------------------------- local function setup_comments() require('Comment').setup({ padding = true, sticky = true, ignore = nil, toggler = { line = '/', block = 'gbc', }, opleader = { line = '/', block = 'gb', } }) end -------------------------------- -- LSP Configuration -------------------------------- local function setup_lsp() -- Configure Mason LSP installer/manager require('mason').setup({ ensure_installed = { 'lua_ls', -- Lua 'clangd', -- C/C++ 'pyright', -- Python 'marksman', -- Markdown }, handlers = { -- Lua LSP settings lua_ls = function() require('lspconfig').lua_ls.setup({}) end, -- C/C++ LSP settings (clangd) clangd = function() require('lspconfig').clangd.setup({}) end, -- Markdown LSP settings marksman = function() require('lspconfig').marksman.setup({}) end, } }) require("mason-lspconfig").setup {} -- Configure diagnostics appearance vim.diagnostic.config({ virtual_lines=true, signs = true, underline = true, update_in_insert = false, severity_sort = true, }) end -------------------------------- -- INITIALIZE ALL CONFIGS -------------------------------- -- Set up all plugin configurations setup_telescope() setup_harpoon() setup_oil() setup_toggleterm() setup_treesitter() setup_comments() setup_lsp()