From 4e334f52eee476fea74c4aebc137c067f3e9c162 Mon Sep 17 00:00:00 2001 From: Gamunu Balagalla Date: Sat, 3 Jan 2026 00:21:41 +0530 Subject: [PATCH] feat: simplify plugin and lualine configuration Signed-off-by: Gamunu Balagalla --- README.md | 25 +- init.lua | 17 +- lua/coldboot/config.lua | 3 + lua/coldboot/config/dap.lua | 87 +++++++ lua/coldboot/config/format.lua | 24 ++ lua/coldboot/config/init.lua | 9 + lua/coldboot/config/lint.lua | 24 ++ lua/coldboot/config/lsp.lua | 163 +++++++++++++ lua/coldboot/config/mason.lua | 29 +++ lua/coldboot/config/ui.lua | 93 +++++++ lua/coldboot/config/util.lua | 45 ++++ lua/coldboot/plugins.lua | 5 + lua/coldboot/plugins/coc_ale.lua | 172 ------------- lua/coldboot/plugins/copilot.lua | 56 ----- lua/coldboot/plugins/debug.lua | 43 ---- lua/coldboot/plugins/init.lua | 365 ++++++++++++++++++++++++++-- lua/coldboot/plugins/mason.lua | 66 ----- lua/coldboot/plugins/oil.lua | 38 --- lua/coldboot/plugins/telescope.lua | 93 ------- lua/coldboot/plugins/toggleterm.lua | 26 -- lua/coldboot/plugins/treesitter.lua | 103 -------- lua/coldboot/plugins_compat.lua | 5 + lua/coldboot/settings.lua | 113 +++++++++ 23 files changed, 958 insertions(+), 646 deletions(-) create mode 100644 lua/coldboot/config.lua create mode 100644 lua/coldboot/config/dap.lua create mode 100644 lua/coldboot/config/format.lua create mode 100644 lua/coldboot/config/init.lua create mode 100644 lua/coldboot/config/lint.lua create mode 100644 lua/coldboot/config/lsp.lua create mode 100644 lua/coldboot/config/mason.lua create mode 100644 lua/coldboot/config/ui.lua create mode 100644 lua/coldboot/config/util.lua create mode 100644 lua/coldboot/plugins.lua delete mode 100644 lua/coldboot/plugins/coc_ale.lua delete mode 100644 lua/coldboot/plugins/copilot.lua delete mode 100644 lua/coldboot/plugins/debug.lua delete mode 100644 lua/coldboot/plugins/mason.lua delete mode 100644 lua/coldboot/plugins/oil.lua delete mode 100644 lua/coldboot/plugins/telescope.lua delete mode 100644 lua/coldboot/plugins/toggleterm.lua delete mode 100644 lua/coldboot/plugins/treesitter.lua create mode 100644 lua/coldboot/plugins_compat.lua create mode 100644 lua/coldboot/settings.lua diff --git a/README.md b/README.md index 1262eb8..e7ff152 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,8 @@ Distribution Alternatives: > [Backup](#FAQ) your previous configuration (if any exists) Requirements: -* Make sure to review the readmes of the plugins if you are experiencing errors. In particular: - * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. -* See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` +* Make sure to review the readmes of the plugins if you are experiencing errors. + * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for `fzf-lua` live grep. Neovim's configurations are located under the following paths, depending on your OS: @@ -68,10 +67,9 @@ nvim --headless "+Lazy! sync" +qa * Inside of your copy, feel free to modify any file you like! It's your copy! * Feel free to change any of the default options in `init.lua` to better suit your needs. -* For adding plugins, there are 3 primary options: - * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this) - * Modify `init.lua` with additional plugins. - * Include the `lua/coldboot/plugins/*` files in your configuration. +* For adding plugins, there are 2 primary options: + * Add new configuration in `lua/custom/plugins/*` files (if you enable that import) + * Edit the single plugin spec entrypoint: `lua/coldboot/plugins/init.lua` You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration. @@ -151,14 +149,5 @@ Each PR, especially those which increase the line count, should have a descripti ### Windows Installation -Installation may require installing build tools, and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake, and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` +Some plugins may require build tools (e.g. CMake) on Windows. +If you run into install/build errors, check the plugin's README and ensure you have the required toolchain installed. diff --git a/init.lua b/init.lua index f28b0c4..dffa988 100644 --- a/init.lua +++ b/init.lua @@ -84,8 +84,6 @@ vim.opt.rtp:prepend(lazypath) -- You can also configure plugins after the setup call, -- as they will be available in your neovim runtime. require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration - -- import pure neovim plugins { import = 'coldboot.plugins', cond = function() @@ -98,13 +96,6 @@ require('lazy').setup({ return vim.g.vscode end, }, - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the coldboot repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins { import = 'custom.plugins' }, }, {}) @@ -115,6 +106,8 @@ require('lazy').setup({ -- Prepend mason bin to PATH vim.env.PATH = vim.fn.stdpath 'data' .. '/mason/bin' .. ':' .. vim.env.PATH +-- NOTE: LSP config is in lua/coldboot/config/lsp.lua + -- Set highlight on search vim.o.hlsearch = false @@ -149,6 +142,8 @@ vim.wo.signcolumn = 'yes' -- Decrease update time vim.o.updatetime = 250 vim.o.timeoutlen = 300 +vim.o.ttimeout = true +vim.o.ttimeoutlen = 100 -- Set completeopt to have a better completion experience vim.o.completeopt = 'menuone,noselect' @@ -194,7 +189,7 @@ else vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - -- LSP configuration is now handled in the plugin files + require 'coldboot.config' -- document existing key chains require('which-key').add { @@ -215,8 +210,6 @@ else { 't', group = '[T]erminal' }, { 't_', hidden = true }, } - - -- LSP configuration is now handled in the plugin files end -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/coldboot/config.lua b/lua/coldboot/config.lua new file mode 100644 index 0000000..87d6a68 --- /dev/null +++ b/lua/coldboot/config.lua @@ -0,0 +1,3 @@ +-- Convenience entrypoint for configuration modules. +-- Loaded from init.lua (non-vscode only). +return require 'coldboot.config.init' diff --git a/lua/coldboot/config/dap.lua b/lua/coldboot/config/dap.lua new file mode 100644 index 0000000..88cc222 --- /dev/null +++ b/lua/coldboot/config/dap.lua @@ -0,0 +1,87 @@ +if vim.g.vscode then + return +end + +local ok_dap, dap = pcall(require, 'dap') +if not ok_dap then + return +end + +local ok_ui, dapui = pcall(require, 'dapui') +if ok_ui then + dapui.setup() + + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + dap.listeners.before.event_terminated['dapui_config'] = function() + dapui.close() + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + end +end + +pcall(function() + require('nvim-dap-virtual-text').setup() +end) + +pcall(function() + require('dap-go').setup() +end) + +pcall(function() + local js_debug_path = vim.fn.stdpath 'data' .. '/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js' + + dap.adapters['pwa-node'] = { + type = 'server', + host = '127.0.0.1', + port = '${port}', + executable = { + command = 'node', + args = { js_debug_path, '${port}' }, + }, + } + + dap.configurations.javascript = { + { + type = 'pwa-node', + request = 'launch', + name = 'Launch file', + program = '${file}', + cwd = '${workspaceFolder}', + }, + { + type = 'pwa-node', + request = 'attach', + name = 'Attach', + processId = require('dap.utils').pick_process, + cwd = '${workspaceFolder}', + }, + } + + dap.configurations.typescript = dap.configurations.javascript + dap.configurations.javascriptreact = dap.configurations.javascript + dap.configurations.typescriptreact = dap.configurations.javascript +end) + +local map = function(lhs, rhs, desc) + vim.keymap.set('n', lhs, rhs, { desc = desc }) +end + +map('', dap.continue, 'DAP continue') +map('', dap.step_over, 'DAP step over') +map('', dap.step_into, 'DAP step into') +map('', dap.step_out, 'DAP step out') +map('db', dap.toggle_breakpoint, 'DAP toggle breakpoint') +map('dB', function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') +end, 'DAP conditional breakpoint') +map('dr', dap.repl.open, 'DAP open REPL') +map('dl', dap.run_last, 'DAP run last') + +if ok_ui then + map('du', dapui.toggle, 'DAP UI toggle') +end + +map('dt', dap.terminate, 'DAP terminate') diff --git a/lua/coldboot/config/format.lua b/lua/coldboot/config/format.lua new file mode 100644 index 0000000..c87790c --- /dev/null +++ b/lua/coldboot/config/format.lua @@ -0,0 +1,24 @@ +local settings = require 'coldboot.settings' + +if vim.g.vscode then + return +end + +local ok, conform = pcall(require, 'conform') +if not ok then + return +end + +conform.setup { + format_on_save = settings.format.format_on_save, + formatters_by_ft = settings.format.formatters_by_ft, +} + +vim.api.nvim_create_user_command('Format', function(args) + conform.format { + async = false, + lsp_format = 'fallback', + timeout_ms = settings.format.format_on_save.timeout_ms, + range = args.count > 0 and { start = { args.line1, 0 }, ['end'] = { args.line2, 0 } } or nil, + } +end, { range = true, desc = 'Format current buffer (Conform/LSP)' }) diff --git a/lua/coldboot/config/init.lua b/lua/coldboot/config/init.lua new file mode 100644 index 0000000..4b2c49f --- /dev/null +++ b/lua/coldboot/config/init.lua @@ -0,0 +1,9 @@ +if vim.g.vscode then + return +end + +require 'coldboot.config.ui' +require 'coldboot.config.mason' +require 'coldboot.config.lsp' +require 'coldboot.config.lint' +require 'coldboot.config.format' diff --git a/lua/coldboot/config/lint.lua b/lua/coldboot/config/lint.lua new file mode 100644 index 0000000..0fd989f --- /dev/null +++ b/lua/coldboot/config/lint.lua @@ -0,0 +1,24 @@ +local settings = require 'coldboot.settings' + +if vim.g.vscode then + return +end + +local ok, lint = pcall(require, 'lint') +if not ok then + return +end + +lint.linters_by_ft = settings.lint.linters_by_ft + +local group = vim.api.nvim_create_augroup('ColdbootLint', { clear = true }) +vim.api.nvim_create_autocmd(settings.lint.events, { + group = group, + callback = function() + lint.try_lint() + end, +}) + +vim.api.nvim_create_user_command('Lint', function() + lint.try_lint() +end, { desc = 'Run configured linters' }) diff --git a/lua/coldboot/config/lsp.lua b/lua/coldboot/config/lsp.lua new file mode 100644 index 0000000..f50c24c --- /dev/null +++ b/lua/coldboot/config/lsp.lua @@ -0,0 +1,163 @@ +local settings = require 'coldboot.settings' +local util = require 'coldboot.config.util' + +if vim.g.vscode then + return +end + +vim.diagnostic.config { + virtual_text = true, + underline = true, + signs = true, + update_in_insert = false, +} + +local function terraform_root(fname) + return util.root_dir(fname, { + prefer_git_root = settings.terraform.prefer_git_root, + fallback_markers = settings.terraform.fallback_markers, + }) +end + +-- Disable ts_ls (handled by typescript-tools.nvim). +if settings.lsp.disable and settings.lsp.disable.ts_ls then + vim.lsp.config.ts_ls = { cmd = { 'false' }, filetypes = {} } +end + +-- gopls: inlay hints +vim.lsp.config.gopls = vim.tbl_deep_extend('force', vim.lsp.config.gopls or {}, { + settings = { + gopls = { + hints = { + assignVariableTypes = true, + rangeVariableTypes = true, + constantValues = true, + }, + }, + }, +}) + +-- terraformls: root + diffview avoidance + freeze workspace folders +vim.lsp.config.terraformls = vim.tbl_deep_extend('force', vim.lsp.config.terraformls or {}, { + cmd = { 'terraform-ls', 'serve' }, + filetypes = { 'terraform', 'terraform-vars' }, + init_options = { + ignoreSingleFileWarning = true, + }, + root_dir = function(fname, bufnr) + if util.is_diffview_buffer(bufnr) then + return nil + end + if type(fname) == 'string' and fname:match '^diffview://' then + return nil + end + return terraform_root(fname) + end, +}) + +vim.lsp.config.tflint = vim.tbl_deep_extend('force', vim.lsp.config.tflint or {}, { + filetypes = { 'terraform' }, + root_dir = function(fname, bufnr) + if util.is_diffview_buffer(bufnr) then + return nil + end + if type(fname) == 'string' and fname:match '^diffview://' then + return nil + end + return terraform_root(fname) + end, +}) + +-- Common LspAttach behavior: keymaps + inlay hints + terraform workspace freeze +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('ColdbootLspAttach', { clear = true }), + callback = function(event) + local bufnr = event.buf + local client = vim.lsp.get_client_by_id(event.data.client_id) + if not client then + return + end + + -- Never keep terraform tooling attached in Diffview buffers. + if util.is_diffview_buffer(bufnr) and (client.name == 'terraformls' or client.name == 'tflint') then + pcall(vim.lsp.buf_detach_client, bufnr, client.id) + return + end + + if settings.lsp.inlay_hints and settings.lsp.inlay_hints.enable then + if client.server_capabilities and client.server_capabilities.inlayHintProvider then + pcall(vim.lsp.inlay_hint.enable, true, { bufnr = bufnr }) + vim.schedule(function() + vim.cmd 'redraw' + end) + end + + local toggle_key = settings.lsp.inlay_hints.toggle_key + if toggle_key and vim.fn.maparg(toggle_key, 'n') == '' then + vim.keymap.set('n', toggle_key, function() + local enabled = vim.lsp.inlay_hint.is_enabled { bufnr = bufnr } + vim.lsp.inlay_hint.enable(not enabled, { bufnr = bufnr }) + vim.schedule(function() + vim.cmd 'redraw' + end) + end, { buffer = bufnr, desc = 'Toggle inlay hints' }) + end + end + + if settings.terraform.freeze_workspace_folders and (client.name == 'terraformls' or client.name == 'tflint') then + client.server_capabilities.workspace = client.server_capabilities.workspace or {} + client.server_capabilities.workspace.workspaceFolders = false + client.server_capabilities.workspace.workspaceFoldersChangeNotifications = false + end + + local map = function(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, desc = desc }) + end + + map('n', 'K', vim.lsp.buf.hover, 'Hover') + map('n', '', vim.lsp.buf.signature_help, 'Signature help') + map('n', 'rn', vim.lsp.buf.rename, 'Rename') + map({ 'n', 'x' }, 'ca', vim.lsp.buf.code_action, 'Code action') + + local fzf_ok, fzf = pcall(require, 'fzf-lua') + if fzf_ok then + map('n', 'gd', fzf.lsp_definitions, 'Goto definition') + map('n', 'gD', fzf.lsp_declarations, 'Goto declaration') + map('n', 'gI', fzf.lsp_implementations, 'Goto implementation') + map('n', 'gr', fzf.lsp_references, 'Goto references') + map('n', 'D', fzf.lsp_typedefs, 'Type definition') + map('n', 'ds', fzf.lsp_document_symbols, 'Document symbols') + map('n', 'ws', fzf.lsp_workspace_symbols, 'Workspace symbols') + else + map('n', 'gd', vim.lsp.buf.definition, 'Goto definition') + map('n', 'gD', vim.lsp.buf.declaration, 'Goto declaration') + map('n', 'gI', vim.lsp.buf.implementation, 'Goto implementation') + map('n', 'gr', vim.lsp.buf.references, 'Goto references') + map('n', 'D', vim.lsp.buf.type_definition, 'Type definition') + map('n', 'ds', vim.lsp.buf.document_symbol, 'Document symbols') + map('n', 'ws', vim.lsp.buf.workspace_symbol, 'Workspace symbols') + end + end, +}) + +vim.api.nvim_create_autocmd('FileType', { + group = vim.api.nvim_create_augroup('ColdbootLspFileType', { clear = true }), + callback = function(event) + local ft = vim.bo[event.buf].filetype + + if ft == 'terraform' or ft == 'terraform-vars' then + if util.is_diffview_buffer(event.buf) then + return + end + + local clients = vim.lsp.get_clients { bufnr = event.buf, name = 'terraformls' } + if #clients == 0 then + pcall(vim.lsp.start, vim.lsp.config.terraformls, { bufnr = event.buf }) + end + + return + end + end, +}) + +vim.lsp.enable(settings.lsp.servers) diff --git a/lua/coldboot/config/mason.lua b/lua/coldboot/config/mason.lua new file mode 100644 index 0000000..ab23d40 --- /dev/null +++ b/lua/coldboot/config/mason.lua @@ -0,0 +1,29 @@ +local settings = require 'coldboot.settings' + +if vim.g.vscode then + return +end + +local ok, mason = pcall(require, 'mason') +if not ok then + return +end + +mason.setup { + ui = { border = 'rounded' }, +} + +-- Auto-install tools/servers listed in settings via mason-tool-installer. +-- This avoids custom registry plumbing and keeps the list user-configurable. +local ok_installer, installer = pcall(require, 'mason-tool-installer') +if ok_installer then + installer.setup { + ensure_installed = settings.mason.ensure_installed, + auto_update = false, + run_on_start = true, + start_delay = 0, + debounce_hours = 24, + } +else + -- Fallback: no auto-installer available, but mason UI still works. +end diff --git a/lua/coldboot/config/ui.lua b/lua/coldboot/config/ui.lua new file mode 100644 index 0000000..fb10425 --- /dev/null +++ b/lua/coldboot/config/ui.lua @@ -0,0 +1,93 @@ +if vim.g.vscode then + return +end + +vim.o.laststatus = 2 +vim.o.showmode = false + +local M = {} + +-- Mode names and highlight groups +local modes = { + ['n'] = { name = 'NORMAL', hl = 'StatusLineMode' }, + ['i'] = { name = 'INSERT', hl = 'StatusLineModeInsert' }, + ['v'] = { name = 'VISUAL', hl = 'StatusLineModeVisual' }, + ['V'] = { name = 'V-LINE', hl = 'StatusLineModeVisual' }, + [''] = { name = 'V-BLOCK', hl = 'StatusLineModeVisual' }, + ['c'] = { name = 'COMMAND', hl = 'StatusLineModeCommand' }, + ['R'] = { name = 'REPLACE', hl = 'StatusLineModeReplace' }, + ['t'] = { name = 'TERMINAL', hl = 'StatusLineModeTerminal' }, +} + +function M.mode() + local mode = vim.fn.mode() + local m = modes[mode] or { name = mode, hl = 'StatusLine' } + return '%#' .. m.hl .. '# ' .. m.name .. ' %#StatusLine#' +end + +function M.git() + local branch = vim.b.gitsigns_head + if not branch or branch == '' then + return '' + end + return ' ' .. branch .. ' ' +end + +function M.diagnostics() + local counts = vim.diagnostic.count(0) + if not counts or vim.tbl_isempty(counts) then + return '' + end + + local parts = {} + local severity = vim.diagnostic.severity + if (counts[severity.ERROR] or 0) > 0 then + table.insert(parts, 'E' .. counts[severity.ERROR]) + end + if (counts[severity.WARN] or 0) > 0 then + table.insert(parts, 'W' .. counts[severity.WARN]) + end + return #parts > 0 and ' ' .. table.concat(parts, ' ') .. ' ' or '' +end + +function M.lsp() + local clients = vim.lsp.get_clients { bufnr = 0 } + if #clients == 0 then + return '' + end + return ' LSP ' +end + +function M.statusline() + return table.concat { + M.mode(), + M.git(), + M.diagnostics(), + M.lsp(), + '%<', -- truncate point + ' %f%m%r', -- filename, modified, readonly + '%=', -- right align + '%{&filetype} ', -- filetype + '%l:%c ', -- line:col + '%p%% ', -- percentage + } +end + +-- Set up highlight groups +local function setup_highlights() + vim.api.nvim_set_hl(0, 'StatusLineMode', { link = 'Cursor' }) + vim.api.nvim_set_hl(0, 'StatusLineModeInsert', { link = 'DiffChange' }) + vim.api.nvim_set_hl(0, 'StatusLineModeVisual', { link = 'DiffAdd' }) + vim.api.nvim_set_hl(0, 'StatusLineModeReplace', { link = 'DiffDelete' }) + vim.api.nvim_set_hl(0, 'StatusLineModeCommand', { link = 'DiffText' }) + vim.api.nvim_set_hl(0, 'StatusLineModeTerminal', { link = 'DiffText' }) +end + +setup_highlights() +vim.api.nvim_create_autocmd('ColorScheme', { + callback = setup_highlights, +}) + +vim.o.statusline = "%{%v:lua.require('coldboot.config.ui').statusline()%}" + +return M diff --git a/lua/coldboot/config/util.lua b/lua/coldboot/config/util.lua new file mode 100644 index 0000000..7f0ae12 --- /dev/null +++ b/lua/coldboot/config/util.lua @@ -0,0 +1,45 @@ +local M = {} + +function M.is_virtual_uri(uri) + return type(uri) == 'string' and uri:match '^%w[%w+.-]*://' ~= nil +end + +function M.is_diffview_buffer(bufnr) + if type(bufnr) ~= 'number' or not vim.api.nvim_buf_is_valid(bufnr) then + return false + end + + local ft = vim.bo[bufnr].filetype + if type(ft) == 'string' and ft:match '^Diffview' then + return true + end + + local name = vim.api.nvim_buf_get_name(bufnr) + return type(name) == 'string' and name:match '^diffview://' ~= nil +end + +function M.root_dir(fname, opts) + if type(fname) ~= 'string' or fname == '' then + return nil + end + + opts = opts or {} + + if opts.prefer_git_root then + local git_root = vim.fs.root(fname, { '.git' }) + if git_root then + return git_root + end + end + + if opts.fallback_markers and #opts.fallback_markers > 0 then + local marker_root = vim.fs.root(fname, opts.fallback_markers) + if marker_root then + return marker_root + end + end + + return vim.fs.dirname(fname) +end + +return M diff --git a/lua/coldboot/plugins.lua b/lua/coldboot/plugins.lua new file mode 100644 index 0000000..f56fe15 --- /dev/null +++ b/lua/coldboot/plugins.lua @@ -0,0 +1,5 @@ +-- Single entrypoint for all non-vscode plugins. +-- Keep plugin definitions here; keep behavior in `lua/coldboot/config/*`. +return { + { import = 'coldboot.plugins' }, +} diff --git a/lua/coldboot/plugins/coc_ale.lua b/lua/coldboot/plugins/coc_ale.lua deleted file mode 100644 index 8b05e29..0000000 --- a/lua/coldboot/plugins/coc_ale.lua +++ /dev/null @@ -1,172 +0,0 @@ -return { - { - 'neoclide/coc.nvim', - branch = 'release', - init = function() - vim.g.coc_global_extensions = { - 'coc-tsserver', - 'coc-eslint', - 'coc-prettier', - 'coc-json', - 'coc-pyright', - 'coc-go', - 'coc-rust-analyzer', - 'coc-docker', - 'coc-terraform', - } - - local map = function(mode, lhs, rhs, desc, opts) - opts = opts or {} - opts.silent = opts.silent ~= false - opts.remap = opts.remap ~= false - opts.desc = desc - vim.keymap.set(mode, lhs, rhs, opts) - end - - local term = function(keys) - return vim.api.nvim_replace_termcodes(keys, true, false, true) - end - - local delete_keyword_suffix = function() - local line = vim.api.nvim_get_current_line() - local col = vim.fn.col '.' - local suffix_len = 0 - - local i = col - while i <= #line do - local ch = line:sub(i, i) - if ch:match '[%w_]' then - suffix_len = suffix_len + 1 - i = i + 1 - else - break - end - end - - if suffix_len == 0 then - return '' - end - - return string.rep(term '', suffix_len) - end - - map('n', 'gd', '(coc-definition)', 'Goto definition') - map('n', 'gD', '(coc-declaration)', 'Goto declaration') - map('n', 'gI', '(coc-implementation)', 'Goto implementation') - map('n', 'gr', '(coc-references)', 'Goto references') - map('n', 'rn', '(coc-rename)', 'Rename') - map('n', 'ca', '(coc-codeaction)', 'Code action') - map('x', 'ca', '(coc-codeaction-selected)', 'Code action (selection)') - map('n', 'D', '(coc-type-definition)', 'Type definition') - map('n', 'ds', 'CocList outline', 'Document symbols', { remap = false }) - map('n', 'ws', 'CocList -I symbols', 'Workspace symbols', { remap = false }) - - map('n', 'K', function() - if vim.fn.exists '*CocActionAsync' == 1 then - vim.fn.CocActionAsync 'doHover' - else - vim.cmd 'normal! K' - end - end, 'Hover') - - map('n', '', '(coc-signature-help)', 'Signature help') - - -- Completion: IntelliJ-like acceptance - -- - Enter: accept with "insert" behavior (doesn't overwrite suffix) - -- - Tab: accept with "replace" behavior (delete suffix, then confirm) - vim.keymap.set('i', '', [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], { - silent = true, - expr = true, - }) - - vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then - return delete_keyword_suffix() .. vim.fn['coc#pum#confirm']() - end - return term '' - end, { silent = true, expr = true }) - - vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then - return vim.fn['coc#pum#prev'](1) - end - return term '' - end, { silent = true, expr = true }) - - vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then - return vim.fn['coc#pum#next'](1) - end - vim.fn['coc#refresh']() - return '' - end, { silent = true, expr = true }) - - vim.keymap.set('i', '', function() - if vim.fn['coc#pum#visible']() == 1 then - return vim.fn['coc#pum#prev'](1) - end - vim.fn['coc#refresh']() - return '' - end, { silent = true, expr = true }) - - map('n', 'f', function() - if vim.fn.exists '*CocActionAsync' == 1 then - vim.fn.CocActionAsync 'format' - return - end - if vim.fn.exists ':ALEFix' == 2 then - vim.cmd 'ALEFix' - end - end, 'Format buffer', { remap = false }) - - vim.api.nvim_create_user_command('Format', function() - if vim.fn.exists '*CocActionAsync' == 1 then - vim.fn.CocActionAsync 'format' - return - end - if vim.fn.exists ':ALEFix' == 2 then - vim.cmd 'ALEFix' - end - end, { desc = 'Format current buffer (Coc/ALE)' }) - end, - }, - { - 'dense-analysis/ale', - init = function() - vim.g.ale_disable_lsp = 1 - vim.g.ale_use_neovim_diagnostics_api = 1 - vim.g.ale_completion_enabled = 0 - - vim.g.ale_fix_on_save = 1 - vim.g.ale_fixers = { - go = { 'gofmt', 'goimports' }, - javascript = { 'eslint', 'prettier' }, - typescript = { 'eslint', 'prettier' }, - javascriptreact = { 'eslint', 'prettier' }, - typescriptreact = { 'eslint', 'prettier' }, - rust = { 'rustfmt' }, - python = { 'isort', 'black' }, - terraform = { 'terraform' }, - } - - vim.g.ale_linters = { - go = { 'golangci-lint' }, - javascript = { 'eslint' }, - typescript = { 'eslint' }, - javascriptreact = { 'eslint' }, - typescriptreact = { 'eslint' }, - rust = { 'clippy' }, - python = { 'ruff' }, - dockerfile = { 'hadolint' }, - terraform = { 'tflint' }, - } - - local format_is_enabled = vim.g.ale_fix_on_save == 1 - vim.api.nvim_create_user_command('ColdbootFormatToggle', function() - format_is_enabled = not format_is_enabled - vim.g.ale_fix_on_save = format_is_enabled and 1 or 0 - print('Setting autoformatting to: ' .. tostring(format_is_enabled)) - end, {}) - end, - }, -} diff --git a/lua/coldboot/plugins/copilot.lua b/lua/coldboot/plugins/copilot.lua deleted file mode 100644 index 1e80ebb..0000000 --- a/lua/coldboot/plugins/copilot.lua +++ /dev/null @@ -1,56 +0,0 @@ --- Copilot.lua setup - a more customizable alternative to the official GitHub Copilot plugin -return { - -- Main Copilot plugin - { - 'zbirenbaum/copilot.lua', - enabled = false, -- Disable Copilot - cmd = 'Copilot', - event = 'InsertEnter', - opts = { - panel = { - enabled = true, - auto_refresh = true, - keymap = { - jump_prev = '[[', - jump_next = ']]', - accept = '', - refresh = 'gr', - open = '', - }, - layout = { - position = 'bottom', -- | top | left | right - ratio = 0.4, - }, - }, - suggestion = { - enabled = true, - auto_trigger = true, - debounce = 75, - keymap = { - accept = '', - accept_word = false, - accept_line = false, - next = '', - prev = '', - dismiss = '', - }, - }, - filetypes = { - ['*'] = true, - ['.'] = false, - }, - copilot_node_command = 'node', -- Node.js version must be > 16.x - server_opts_overrides = {}, - }, - }, - -- Configuration for copilot-cmp - { - 'zbirenbaum/copilot-cmp', - enabled = false, -- Disable Copilot completion - dependencies = { 'zbirenbaum/copilot.lua' }, - config = function() - -- Load copilot_cmp after copilot is loaded - require('copilot_cmp').setup() - end, - }, -} diff --git a/lua/coldboot/plugins/debug.lua b/lua/coldboot/plugins/debug.lua deleted file mode 100644 index e0309e3..0000000 --- a/lua/coldboot/plugins/debug.lua +++ /dev/null @@ -1,43 +0,0 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- coldboot.nvim and not kitchen-sink.nvim ;) -return { - { - 'mfussenegger/nvim-dap', - dependencies = { - 'leoluz/nvim-dap-go', - }, - }, - { - 'rcarriga/nvim-dap-ui', - -- virtual text for the debugger - { - 'theHamsta/nvim-dap-virtual-text', - }, - }, - { - 'jay-babu/mason-nvim-dap.nvim', - dependencies = { - 'williamboman/mason.nvim', - }, - opts = { - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_installation = true, - - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - }, - }, - }, -} diff --git a/lua/coldboot/plugins/init.lua b/lua/coldboot/plugins/init.lua index 40d6033..ee31cf2 100644 --- a/lua/coldboot/plugins/init.lua +++ b/lua/coldboot/plugins/init.lua @@ -1,6 +1,5 @@ --- NOTE : this is where the neovim plugins are defined --- if you are looking for vscode specific plugins look for the coldboot/vscode --- directory +-- Single plugin-spec entrypoint. +-- Keep plugin specs here; keep behavior in `lua/coldboot/config/*`. return { -- Git related plugins { 'NeogitOrg/neogit', @@ -69,9 +68,266 @@ return { -- Git related plugins } end, }, - 'tpope/vim-sleuth', -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - -- LSP Configuration is now in lua/coldboot/plugins/lsp.lua + { + 'nvim-lua/plenary.nvim', + lazy = true, + }, + { + 'neovim/nvim-lspconfig', + }, + { + 'williamboman/mason.nvim', + cmd = { 'Mason', 'MasonLog' }, + opts = { + ui = { + border = 'rounded', + }, + }, + }, + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + dependencies = { 'williamboman/mason.nvim' }, + }, + { + 'mfussenegger/nvim-lint', + event = { 'BufReadPost', 'BufNewFile' }, + }, + { + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + }, + { + 'ibhagwan/fzf-lua', + cmd = 'FzfLua', + keys = { + { + '?', + function() + require('fzf-lua').oldfiles() + end, + desc = '[?] Find recently opened files', + }, + { + '', + function() + require('fzf-lua').buffers() + end, + desc = '[ ] Find existing buffers', + }, + { + '/', + function() + require('fzf-lua').blines() + end, + desc = '[/] Fuzzily search in current buffer', + }, + { + 'gf', + function() + require('fzf-lua').git_files() + end, + desc = 'Search [G]it [F]iles', + }, + { + 'sf', + function() + require('fzf-lua').files() + end, + desc = '[S]earch [F]iles', + }, + { + 'sh', + function() + require('fzf-lua').help_tags() + end, + desc = '[S]earch [H]elp', + }, + { + 'sw', + function() + require('fzf-lua').grep_cword() + end, + desc = '[S]earch current [W]ord', + }, + { + 'sg', + function() + require('fzf-lua').live_grep() + end, + desc = '[S]earch by [G]rep', + }, + { + 'sd', + function() + require('fzf-lua').diagnostics_workspace() + end, + desc = '[S]earch [D]iagnostics', + }, + { + 'sr', + function() + require('fzf-lua').resume() + end, + desc = '[S]earch [R]esume', + }, + }, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local fzf = require 'fzf-lua' + + fzf.setup { + files = { + fd_opts = [[--color=never --type f --hidden --follow --exclude .git]], + }, + grep = { + rg_opts = [[--column --line-number --no-heading --color=never --smart-case --hidden --glob !.git/]], + }, + } + end, + }, + { + 'stevearc/oil.nvim', + opts = { + default_file_explorer = true, + delete_to_trash = true, + view_options = { + show_hidden = true, + is_hidden_file = function(name, bufnr) + return vim.startswith(name, '.') + end, + is_always_hidden = function(name, bufnr) + return false + end, + natural_order = true, + sort = { + { 'type', 'asc' }, + { 'name', 'asc' }, + }, + }, + }, + dependencies = { 'nvim-tree/nvim-web-devicons' }, + }, + { + 'akinsho/toggleterm.nvim', + version = '*', + keys = { + { 'tf', 'ToggleTerm direction=float', desc = 'Toggle floating terminal' }, + { 'th', 'ToggleTerm size=10 direction=horizontal', desc = 'Toggle horizontal terminal' }, + { 'tv', 'ToggleTerm size=80 direction=vertical', desc = 'Toggle vertical terminal' }, + }, + opts = { + open_mapping = [[]], + shading_factor = 2, + direction = 'float', + float_opts = { + border = 'curved', + highlights = { + border = 'Normal', + background = 'Normal', + }, + }, + }, + }, + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + enabled = true, + opts = { + panel = { + enabled = true, + auto_refresh = true, + keymap = { + jump_prev = '[[', + jump_next = ']]', + accept = '', + refresh = 'gr', + open = '', + }, + layout = { + position = 'bottom', + ratio = 0.4, + }, + }, + suggestion = { + enabled = true, + auto_trigger = true, + debounce = 75, + keymap = { + accept = '', + accept_word = false, + accept_line = false, + next = '', + prev = false, + dismiss = '', + }, + }, + filetypes = { + ['*'] = true, + ['.'] = false, + }, + copilot_node_command = 'node', + server_opts_overrides = {}, + }, + }, + { + 'mfussenegger/nvim-dap', + dependencies = { + 'leoluz/nvim-dap-go', + 'rcarriga/nvim-dap-ui', + 'theHamsta/nvim-dap-virtual-text', + 'nvim-neotest/nvim-nio', + }, + config = function() + require 'coldboot.config.dap' + end, + }, + { + 'jay-babu/mason-nvim-dap.nvim', + dependencies = { + 'williamboman/mason.nvim', + 'mfussenegger/nvim-dap', + }, + opts = { + automatic_installation = false, + handlers = {}, + ensure_installed = { + 'delve', + 'python', + 'js-debug-adapter', + }, + }, + }, + { + 'nvim-tree/nvim-web-devicons', + lazy = true, + }, + { + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ':TSUpdate', + }, + 'tpope/vim-sleuth', + { + 'pmizio/typescript-tools.nvim', + dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' }, + ft = { 'typescript', 'typescriptreact', 'javascript', 'javascriptreact' }, + opts = function() + local settings = require 'coldboot.settings' + return { + settings = { + tsserver_file_preferences = settings.ts.tsserver_file_preferences, + }, + handlers = { + ['textDocument/inlayHint'] = vim.lsp.handlers['textDocument/inlayHint'], + }, + } + end, + }, -- Useful plugin to show you pending keybinds. { 'folke/which-key.nvim', @@ -146,19 +402,6 @@ return { -- Git related plugins vim.cmd.colorscheme 'gruvbox-material' end, }, - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = true, - theme = 'gruvbox', - component_separators = '|', - section_separators = '', - }, - }, - }, { -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim', @@ -176,5 +419,89 @@ return { -- Git related plugins 'nvim-treesitter/nvim-treesitter', dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' }, build = ':TSUpdate', + event = { 'BufReadPost', 'BufNewFile' }, + cmd = { 'TSUpdateSync', 'TSUpdate', 'TSInstall' }, + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { + 'c', + 'cpp', + 'go', + 'lua', + 'python', + 'rust', + 'html', + 'tsx', + 'javascript', + 'json', + 'yaml', + 'typescript', + 'vimdoc', + 'vim', + 'hcl', + 'terraform', + 'markdown_inline', + 'toml', + }, + sync_install = false, + auto_install = true, + ignore_install = {}, + modules = {}, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + } + end, }, } diff --git a/lua/coldboot/plugins/mason.lua b/lua/coldboot/plugins/mason.lua deleted file mode 100644 index 9374134..0000000 --- a/lua/coldboot/plugins/mason.lua +++ /dev/null @@ -1,66 +0,0 @@ -return { - { - 'williamboman/mason.nvim', - cmd = { 'Mason', 'MasonLog' }, - opts = { - ui = { - border = 'rounded', - }, - }, - config = function(_, opts) - local ok, mason = pcall(require, 'mason') - if not ok then - return - end - - mason.setup(opts) - - local registry_ok, registry = pcall(require, 'mason-registry') - if not registry_ok then - return - end - - -- Keep this list small: just the server binaries Coc commonly uses. - local ensure_installed = { - -- LSP Servers - 'gopls', - 'rust-analyzer', - 'pyright', - 'typescript-language-server', - 'eslint-lsp', - 'dockerfile-language-server', - 'terraform-ls', - - -- Linters & Formatters - 'black', - 'isort', - 'ruff', - 'goimports', - 'golangci-lint', - 'prettier', - 'hadolint', - 'tflint', - } - - local function install(pkg_name) - local pkg = registry.get_package(pkg_name) - if pkg:is_installed() then - return - end - pkg:install() - end - - if registry.refresh then - registry.refresh(function() - for _, pkg_name in ipairs(ensure_installed) do - pcall(install, pkg_name) - end - end) - else - for _, pkg_name in ipairs(ensure_installed) do - pcall(install, pkg_name) - end - end - end, - }, -} diff --git a/lua/coldboot/plugins/oil.lua b/lua/coldboot/plugins/oil.lua deleted file mode 100644 index 20e35e3..0000000 --- a/lua/coldboot/plugins/oil.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - -- This plugin is a file explorer that is a drop-in replacement for netrw. - -- It is written in Lua and is much faster than netrw. - -- It also has a more intuitive interface and is more customizable. - { - 'stevearc/oil.nvim', - opts = { - -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) - -- Set to false if you still want to use netrw. - default_file_explorer = true, - -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) - delete_to_trash = true, - view_options = { - -- Show files and directories that start with "." - show_hidden = true, - -- This function defines what is considered a "hidden" file - is_hidden_file = function(name, bufnr) - return vim.startswith(name, '.') - end, - -- This function defines what will never be shown, even when `show_hidden` is set - is_always_hidden = function(name, bufnr) - return false - end, - -- Sort file names in a more intuitive order for humans. Is less performant, - -- so you may want to set to false if you work with large directories. - natural_order = true, - sort = { - -- sort order can be "asc" or "desc" - -- see :help oil-columns to see which columns are sortable - { 'type', 'asc' }, - { 'name', 'asc' }, - }, - }, - }, - -- Optional dependencies - dependencies = { 'nvim-tree/nvim-web-devicons' }, - }, -} diff --git a/lua/coldboot/plugins/telescope.lua b/lua/coldboot/plugins/telescope.lua deleted file mode 100644 index f2b1adc..0000000 --- a/lua/coldboot/plugins/telescope.lua +++ /dev/null @@ -1,93 +0,0 @@ -return { - { - 'ibhagwan/fzf-lua', - cmd = 'FzfLua', - keys = { - { - '?', - function() - require('fzf-lua').oldfiles() - end, - desc = '[?] Find recently opened files', - }, - { - '', - function() - require('fzf-lua').buffers() - end, - desc = '[ ] Find existing buffers', - }, - { - '/', - function() - require('fzf-lua').blines() - end, - desc = '[/] Fuzzily search in current buffer', - }, - { - 'gf', - function() - require('fzf-lua').git_files() - end, - desc = 'Search [G]it [F]iles', - }, - { - 'sf', - function() - require('fzf-lua').files() - end, - desc = '[S]earch [F]iles', - }, - { - 'sh', - function() - require('fzf-lua').help_tags() - end, - desc = '[S]earch [H]elp', - }, - { - 'sw', - function() - require('fzf-lua').grep_cword() - end, - desc = '[S]earch current [W]ord', - }, - { - 'sg', - function() - require('fzf-lua').live_grep() - end, - desc = '[S]earch by [G]rep', - }, - { - 'sd', - function() - require('fzf-lua').diagnostics_workspace() - end, - desc = '[S]earch [D]iagnostics', - }, - { - 'sr', - function() - require('fzf-lua').resume() - end, - desc = '[S]earch [R]esume', - }, - }, - dependencies = { - 'nvim-tree/nvim-web-devicons', - }, - config = function() - local fzf = require 'fzf-lua' - - fzf.setup { - files = { - fd_opts = [[--color=never --type f --hidden --follow --exclude .git]], - }, - grep = { - rg_opts = [[--column --line-number --no-heading --color=never --smart-case --hidden --glob !.git/]], - }, - } - end, - }, -} diff --git a/lua/coldboot/plugins/toggleterm.lua b/lua/coldboot/plugins/toggleterm.lua deleted file mode 100644 index af5a369..0000000 --- a/lua/coldboot/plugins/toggleterm.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { - 'akinsho/toggleterm.nvim', - version = '*', - keys = { - { 'tf', 'ToggleTerm direction=float', desc = 'Toggle floating terminal' }, - { 'th', 'ToggleTerm size=10 direction=horizontal', desc = 'Toggle horizontal terminal' }, - { 'tv', 'ToggleTerm size=80 direction=vertical', desc = 'Toggle vertical terminal' }, - }, - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section in the documentation - open_mapping = [[]], -- Lazy load on leader key press - shading_factor = 2, - direction = 'float', - float_opts = { - border = 'curved', - highlights = { - border = 'Normal', - background = 'Normal', - }, - }, - }, - }, -} diff --git a/lua/coldboot/plugins/treesitter.lua b/lua/coldboot/plugins/treesitter.lua deleted file mode 100644 index efa2ea7..0000000 --- a/lua/coldboot/plugins/treesitter.lua +++ /dev/null @@ -1,103 +0,0 @@ -return { - { - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - build = ':TSUpdate', - event = { 'BufReadPost', 'BufNewFile' }, - cmd = { 'TSUpdateSync', 'TSUpdate', 'TSInstall' }, - config = function() - require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { - 'c', - 'cpp', - 'go', - 'lua', - 'python', - 'rust', - 'html', - 'tsx', - 'javascript', - 'json', - 'yaml', - 'typescript', - 'vimdoc', - 'vim', - 'hcl', - 'terraform', - 'markdown_inline', - 'toml', - }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = true, - - -- List of parsers to ignore installing (or "all") - ignore_install = {}, - - modules = {}, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, - } - end, - }, -} diff --git a/lua/coldboot/plugins_compat.lua b/lua/coldboot/plugins_compat.lua new file mode 100644 index 0000000..2a94620 --- /dev/null +++ b/lua/coldboot/plugins_compat.lua @@ -0,0 +1,5 @@ +-- Compatibility shim so init.lua can keep using Lazy imports. +-- New layout encourages a single plugins entrypoint (`coldboot/plugins.lua`). +return { + { import = 'coldboot.plugins' }, +} diff --git a/lua/coldboot/settings.lua b/lua/coldboot/settings.lua new file mode 100644 index 0000000..cd03b31 --- /dev/null +++ b/lua/coldboot/settings.lua @@ -0,0 +1,113 @@ +local M = {} + +M.lsp = { + inlay_hints = { + enable = true, + toggle_key = 'ih', + }, + + -- Servers managed by native `vim.lsp.enable()`. + -- TS/JS is handled by typescript-tools.nvim, so ts_ls is intentionally not here. + servers = { + 'gopls', + 'pyright', + 'rust_analyzer', + 'dockerls', + 'terraformls', + 'tflint', + 'yamlls', + 'jsonls', + 'bashls', + }, + + disable = { + ts_ls = true, + }, +} + +M.terraform = { + prefer_git_root = true, + fallback_markers = { + '.terraform', + '.tflint.hcl', + '.terraform.lock.hcl', + 'terraform.tfstate', + 'terraform.tfstate.d', + }, + skip_filetypes = { + 'DiffviewFiles', + 'DiffviewFileHistory', + 'DiffviewFilePanel', + }, + freeze_workspace_folders = true, +} + +M.ts = { + tsserver_file_preferences = { + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + }, +} + +M.lint = { + -- BufWritePost only (user confirmed) + events = { 'BufWritePost' }, + linters_by_ft = { + go = { 'golangcilint' }, + javascript = { 'eslint' }, + typescript = { 'eslint' }, + javascriptreact = { 'eslint' }, + typescriptreact = { 'eslint' }, + python = { 'ruff' }, + dockerfile = { 'hadolint' }, + terraform = { 'tflint' }, + }, +} + +M.format = { + format_on_save = { + timeout_ms = 2000, + lsp_format = 'fallback', + }, + formatters_by_ft = { + go = { 'goimports', 'gofmt' }, + javascript = { 'prettier' }, + typescript = { 'prettier' }, + javascriptreact = { 'prettier' }, + typescriptreact = { 'prettier' }, + python = { 'isort', 'black' }, + rust = { 'rustfmt' }, + terraform = { 'terraform_fmt' }, + }, +} + +M.mason = { + -- Install these via Mason (auto-on-start). + ensure_installed = { + -- LSP servers + 'gopls', + 'rust-analyzer', + 'pyright', + 'dockerfile-language-server', + 'terraform-ls', + 'tflint', + 'yaml-language-server', + 'json-lsp', + 'bash-language-server', + + -- Linters/formatters + 'golangci-lint', + 'ruff', + 'hadolint', + 'prettier', + 'black', + 'isort', + 'goimports', + }, +} + +return M