Revert "just formatting"
This reverts commit 18e5475a9edec2d4c4f3ce994cac4bfd04df0172.
This commit is contained in:
parent
c0474f5c11
commit
3d1eeaa62c
4
init.lua
4
init.lua
|
@ -301,7 +301,7 @@ require('lazy').setup({
|
||||||
-- Then, because we use the `opts` key (recommended), the configuration runs
|
-- Then, because we use the `opts` key (recommended), the configuration runs
|
||||||
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
-- 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',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -382,7 +382,7 @@ require('lazy').setup({
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
-- 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()
|
config = function()
|
||||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
-- Formatter configuration
|
-- Formatter configuration
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- ========================================
|
-- ========================================
|
||||||
-- Formatter Configuration (conform.nvim)
|
-- Formatter Configuration (conform.nvim)
|
||||||
-- ========================================
|
-- ========================================
|
||||||
{
|
{
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = 'BufWritePre', -- Format on save
|
event = 'BufWritePre', -- Format on save
|
||||||
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
|
-- cmd = { 'ConformInfo' }, -- Optional: If you want the command available
|
||||||
-- keys = { ... } -- Optional: Define keys if needed
|
-- keys = { ... } -- Optional: Define keys if needed
|
||||||
opts = {
|
opts = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
c = { 'clang_format' },
|
c = { 'clang_format' },
|
||||||
cpp = { 'clang_format' },
|
cpp = { 'clang_format' },
|
||||||
-- Use ruff for Python formatting (includes isort and is faster than black
|
-- Use ruff for Python formatting (includes isort and is faster than black
|
||||||
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
|
-- Ensure 'ruff' is installed via Home Manager (pkgs.ruff)
|
||||||
python = { 'ruff_format', 'ruff_fix' },
|
python = { 'ruff_format', 'ruff_fix' },
|
||||||
-- python = { 'isort', 'black' },
|
-- python = { 'isort', 'black' },
|
||||||
nix = { 'alejandra' }, -- Add nix formatter
|
nix = { 'alejandra' }, -- Add nix formatter
|
||||||
-- Add other filetypes and formatters, e.g.:
|
-- Add other filetypes and formatters, e.g.:
|
||||||
-- javascript = { "prettier" },
|
-- javascript = { "prettier" },
|
||||||
-- typescript = { "prettier" },
|
-- typescript = { "prettier" },
|
||||||
-- css = { "prettier" },
|
-- css = { "prettier" },
|
||||||
-- html = { "prettier" },
|
-- html = { "prettier" },
|
||||||
-- json = { "prettier" },
|
-- json = { "prettier" },
|
||||||
-- yaml = { "prettier" },
|
-- yaml = { "prettier" },
|
||||||
-- markdown = { "prettier" },
|
-- markdown = { "prettier" },
|
||||||
-- bash = { "shfmt" },
|
-- bash = { "shfmt" },
|
||||||
},
|
},
|
||||||
-- Configure format_on_save behavior
|
-- Configure format_on_save behavior
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
-- I recommend these options, but adjust to your liking
|
-- I recommend these options, but adjust to your liking
|
||||||
timeout_ms = 500, -- Stop formatting if it takes too long
|
timeout_ms = 500, -- Stop formatting if it takes too long
|
||||||
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
|
lsp_fallback = true, -- Fallback to LSP formatting if conform fails
|
||||||
},
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,6 @@ return {
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- This config function runs AFTER the plugin and its dependencies are loaded.
|
-- This config function runs AFTER the plugin and its dependencies are loaded.
|
||||||
-- It sets up the LSP servers.
|
-- 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
|
-- Get LSP capabilities, augmented by nvim-cmp
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
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
|
-- Iterate through the defined servers list and set them up with lspconfig
|
||||||
for _, server_name in ipairs(servers_to_setup) do
|
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
|
-- print('Attempting to set up LSP server: ' .. server_name) -- Debug print
|
||||||
-- require('lspconfig')[server_name].setup {
|
require('lspconfig')[server_name].setup {
|
||||||
-- capabilities = capabilities, -- Pass augmented capabilities
|
capabilities = capabilities, -- Pass augmented capabilities
|
||||||
-- -- Add any server-specific overrides here if needed, e.g.:
|
-- Add any server-specific overrides here if needed, e.g.:
|
||||||
-- -- For lua_ls:
|
-- For lua_ls:
|
||||||
-- -- settings = { Lua = { diagnostics = { globals = {'vim'} } } },
|
-- settings = { Lua = { diagnostics = { globals = {'vim'} } } },
|
||||||
-- }
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section
|
-- Setup keymaps and diagnostics based on kickstart's original init.lua LSP section
|
||||||
|
|
|
@ -7,121 +7,121 @@
|
||||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- NOTE: Yes, you can install new plugins here!
|
-- NOTE: Yes, you can install new plugins here!
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
-- NOTE: And you can specify dependencies as well
|
-- NOTE: And you can specify dependencies as well
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Creates a beautiful debugger UI
|
-- Creates a beautiful debugger UI
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
|
||||||
-- Required dependency for nvim-dap-ui
|
-- Required dependency for nvim-dap-ui
|
||||||
'nvim-neotest/nvim-nio',
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
'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',
|
|
||||||
},
|
},
|
||||||
{
|
keys = {
|
||||||
'<F1>',
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
function()
|
{
|
||||||
require('dap').step_into()
|
'<F5>',
|
||||||
end,
|
function()
|
||||||
desc = 'Debug: Step Into',
|
require('dap').continue()
|
||||||
},
|
end,
|
||||||
{
|
desc = 'Debug: Start/Continue',
|
||||||
'<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 = '⏏',
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
}
|
'<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
|
-- Dap UI setup
|
||||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
dapui.setup {
|
||||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
-- Set icons to characters that are more likely to work in every terminal.
|
||||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
-- Feel free to remove or use ones that you like more! :)
|
||||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
-- Don't feel like these are good choices.
|
||||||
-- for type, icon in pairs(breakpoint_icons) do
|
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
-- local tp = 'Dap' .. type
|
controls = {
|
||||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
icons = {
|
||||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
pause = '⏸',
|
||||||
-- end
|
play = '▶',
|
||||||
|
step_into = '⏎',
|
||||||
|
step_over = '⏭',
|
||||||
|
step_out = '⏮',
|
||||||
|
step_back = 'b',
|
||||||
|
run_last = '▶▶',
|
||||||
|
terminate = '⏹',
|
||||||
|
disconnect = '⏏',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
-- Change breakpoint icons
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
-- 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
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
require('dap-go').setup {
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
delve = {
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
-- On Windows delve must be run attached or it crashes.
|
|
||||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
-- Install golang specific config
|
||||||
detached = vim.fn.has 'win32' == 0,
|
require('dap-go').setup {
|
||||||
},
|
delve = {
|
||||||
}
|
-- On Windows delve must be run attached or it crashes.
|
||||||
end,
|
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||||
|
detached = vim.fn.has 'win32' == 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue