Revert "just formatting"

This reverts commit 18e5475a9edec2d4c4f3ce994cac4bfd04df0172.
This commit is contained in:
dlond 2025-05-21 01:07:37 +12:00
parent c0474f5c11
commit 3d1eeaa62c
4 changed files with 153 additions and 179 deletions

View File

@ -301,7 +301,7 @@ require('lazy').setup({
-- Then, because we use the `opts` key (recommended), the configuration runs
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
{ -- Useful plugin to show you pending keybinds.
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = {
@ -382,7 +382,7 @@ require('lazy').setup({
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that

View File

@ -1,40 +1,40 @@
-- Formatter configuration
return {
-- ========================================
-- Formatter Configuration (conform.nvim)
-- ========================================
{
'stevearc/conform.nvim',
event = 'BufWritePre', -- Format on save
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
-- keys = { ... } -- Optional: Define keys if needed
opts = {
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
-- Use ruff for Python formatting (includes isort and is faster than black
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
python = { 'ruff_format', 'ruff_fix' },
-- python = { 'isort', 'black' },
nix = { 'alejandra' }, -- Add nix formatter
-- Add other filetypes and formatters, e.g.:
-- javascript = { "prettier" },
-- typescript = { "prettier" },
-- css = { "prettier" },
-- html = { "prettier" },
-- json = { "prettier" },
-- yaml = { "prettier" },
-- markdown = { "prettier" },
-- bash = { "shfmt" },
},
-- Configure format_on_save behavior
format_on_save = {
-- I recommend these options, but adjust to your liking
timeout_ms = 500, -- Stop formatting if it takes too long
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
},
-- ========================================
-- Formatter Configuration (conform.nvim)
-- ========================================
{
'stevearc/conform.nvim',
event = 'BufWritePre', -- Format on save
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
-- keys = { ... } -- Optional: Define keys if needed
opts = {
formatters_by_ft = {
lua = { 'stylua' },
c = { 'clang_format' },
cpp = { 'clang_format' },
-- Use ruff for Python formatting (includes isort and is faster than black
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
python = { 'ruff_format', 'ruff_fix' },
-- python = { 'isort', 'black' },
nix = { 'alejandra' }, -- Add nix formatter
-- Add other filetypes and formatters, e.g.:
-- javascript = { "prettier" },
-- typescript = { "prettier" },
-- css = { "prettier" },
-- html = { "prettier" },
-- json = { "prettier" },
-- yaml = { "prettier" },
-- markdown = { "prettier" },
-- bash = { "shfmt" },
},
-- Configure format_on_save behavior
format_on_save = {
-- I recommend these options, but adjust to your liking
timeout_ms = 500, -- Stop formatting if it takes too long
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
},
},
},
},
}

View File

@ -17,11 +17,6 @@ return {
config = function(_, opts)
-- This config function runs AFTER the plugin and its dependencies are loaded.
-- It sets up the LSP servers.
local nix_paths_status, nix_paths = pcall(require, 'custom.nix_paths')
if not nix_paths_status then
print('Error loading custom.nix_paths: ' .. (nix_paths or 'Unknown error'))
nix_paths = {} -- Provide an empty table to avoid further errors
end
-- Get LSP capabilities, augmented by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
@ -41,34 +36,13 @@ return {
-- Iterate through the defined servers list and set them up with lspconfig
for _, server_name in ipairs(servers_to_setup) do
local server_opts = {
capabilities = capabilities,
}
if server_name == 'clangd' then
if nix_paths.clangd_query_driver and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then
server_opts.cmd = {
'clangd',
'--query-driver=' .. nix_paths.clangd_query_driver,
-- '-isysroot',
-- nix_paths.macos_sdk_path,
-- '-isystem',
-- nix_paths.libcxx_include_path,
}
else
print 'Warning: Nix paths for clangd not fully defined in custom.nix_paths.lua. Clangd might not work correctly.'
-- Fallback or default cmd if paths are missing
server_opts.cmd = { 'clangd' }
end
end
require('lspconfig')[server_name].setup(server_opts)
-- print('Attempting to set up LSP server: ' .. server_name) -- Debug print
-- require('lspconfig')[server_name].setup {
-- capabilities = capabilities, -- Pass augmented capabilities
-- -- Add any server-specific overrides here if needed, e.g.:
-- -- For lua_ls:
-- -- settings = { Lua = { diagnostics = { globals = {'vim'} } } },
-- }
require('lspconfig')[server_name].setup {
capabilities = capabilities, -- Pass augmented capabilities
-- Add any server-specific overrides here if needed, e.g.:
-- For lua_ls:
-- settings = { Lua = { diagnostics = { globals = {'vim'} } } },
}
end
-- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section

View File

@ -7,121 +7,121 @@
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
},
}
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
}