Compare commits

...

20 Commits

Author SHA1 Message Date
ba5fd1c33b Update fillchars option to use Lua table syntax 2026-02-02 20:54:29 +00:00
ff14f16bbd Replace deprecated vim.loop API with vim.uv 2026-02-02 20:54:28 +00:00
00b5d44396 Enable experimental Lua loader to improve startup time 2026-02-02 20:54:27 +00:00
9a6765df45 Use Lua API to delete Y keymap 2026-02-02 20:35:44 +00:00
280c00b272 Add keymap to format whole file with gw
Introduces `<leader>gw` to format the entire buffer using the internal
formatting operator gw. It preserves the current window view (cursor
position and scroll) during the operation.
2026-02-02 20:30:45 +00:00
31a03cac7b Add treesitter keymap to reset foldmethod
Seems like treesitter folds get into a confused situation, potentially a
race condition, which is fixed by setting `foldmethod=expr`. This
mapping makes that faster.
2026-01-15 16:40:06 +00:00
f59a288d59 Also don't highlight todo in mojo files 2026-01-05 11:51:13 +00:00
5def28d407 Reformat utilities.lua 2025-12-18 22:54:27 +00:00
2dec8af915 Disable signcolumn in dap-view-term filetype 2025-12-17 21:43:23 +00:00
27c50224f7 Enable dap-view auto toggle 2025-12-17 21:37:25 +00:00
39967dc120 Remove crashy console section from dap-view 2025-12-17 21:37:21 +00:00
bea244a4aa Add nvim-dap-disasm to view disassembly during debug 2025-12-17 21:18:29 +00:00
f08562558b Add DapViewToggle mapping 2025-12-17 21:17:19 +00:00
bc5ddb6dc7 Add restart & run_to_cursor dap mappings 2025-12-17 20:55:54 +00:00
f213c20d23 Update switchbuf for better nvim-dap usage 2025-12-16 19:31:43 +00:00
481c127583 Add console to nvim-dap-view's buffer 2025-12-16 19:19:55 +00:00
e0286197f8 Cleanup debugger plugin config 2025-12-16 19:19:08 +00:00
6fefe27f0e nvim-treesitter has breaking changes use master branch 2025-12-16 19:17:56 +00:00
82143dea23 Update switchbuf to include newtab 2025-12-16 19:14:30 +00:00
144d2b11cf Add nvim-dap & nvim-dap-view
Also don't enter insert mode when launching a debug session.
2025-12-16 18:24:50 +00:00
10 changed files with 110 additions and 12 deletions

View File

@@ -0,0 +1 @@
vim.o.signcolumn = 'no'

View File

@@ -1,3 +1,5 @@
vim.loader.enable()
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
@@ -11,7 +13,7 @@ end
pcall(function() require('local') end) pcall(function() require('local') end)
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then if not vim.uv.fs_stat(lazypath) then
vim.fn.system({ 'git', 'clone', '--filter=blob:none', vim.fn.system({ 'git', 'clone', '--filter=blob:none',
'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath }) 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath })
end end

View File

@@ -36,6 +36,7 @@ local kanagawa = {
-- Don't lighlight TODO specially in comments -- Don't lighlight TODO specially in comments
for _, todo_group in pairs({ for _, todo_group in pairs({
'confTodo', 'confTodo',
'mojoTodo',
'ps1CommentTodo', 'ps1CommentTodo',
'pythonTodo', 'pythonTodo',
'zshTodo', 'zshTodo',

64
lua/plugins/debugger.lua Normal file
View File

@@ -0,0 +1,64 @@
return {
'mfussenegger/nvim-dap',
dependencies = {
'igorlfs/nvim-dap-view',
'kbenzie/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
'theHamsta/nvim-dap-virtual-text',
'Jorenar/nvim-dap-disasm',
},
config = function()
local dap = require('dap')
-- Installation
local debug_adapters = {
'codelldb', -- C/C++/Rust/Zig
}
if vim.fn.executable('pip') == 1 then
table.insert(debug_adapters, 'python') -- Python
end
if vim.fn.executable('go') == 1 then
table.insert(debug_adapters, 'delve') -- Go
end
require("mason-nvim-dap").setup({
ensure_installed = debug_adapters,
handlers = {},
})
-- UI plugins
require('dap-view').setup({
auto_toggle = true,
})
require('nvim-dap-virtual-text').setup({})
require('dap-disasm').setup({
dapview_register = true,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
'dap-float',
},
callback = function(args)
vim.keymap.set("n", "q", "<C-w>q", { buffer = args.buf })
end,
})
local widgets = require('dap.ui.widgets')
-- Mappings
vim.keymap.set('n', '<leader>D', vim.cmd.DapViewToggle)
vim.keymap.set('n', '<F5>', dap.continue)
vim.keymap.set('n', '<F17>', dap.terminate) -- Shift-F5
vim.keymap.set('n', '<F9>', dap.toggle_breakpoint)
vim.keymap.set('n', '<F21>', vim.cmd.DapViewWatch) -- Shift-F9
vim.keymap.set('n', '<F41>', dap.restart) -- Ctrl-Shift-F5
vim.keymap.set('n', '<F34>', dap.run_to_cursor) -- Ctrl-F10
vim.keymap.set('n', '<F11>', dap.step_into)
vim.keymap.set('n', '<F23>', dap.step_out) -- Shift-F11
vim.keymap.set('n', '<F10>', dap.step_over)
vim.keymap.set('n', '<leader>K', widgets.hover)
end,
}

View File

@@ -1,5 +1,6 @@
return { return {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
branch = 'master',
dependencies = { dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
{ 'nvim-treesitter/nvim-treesitter-context', opts = {} }, { 'nvim-treesitter/nvim-treesitter-context', opts = {} },
@@ -97,5 +98,10 @@ return {
}, },
}, },
}) })
-- Keymaps
vim.keymap.set('n', '<leader>fm', function()
vim.o.foldmethod = 'expr'
end, {})
end end
} }

View File

@@ -33,8 +33,18 @@ local noice = {
return { return {
-- noice, -- noice,
{ 'echasnovski/mini.comment', opts = { options = { ignore_blank_line = true } } }, {
{ 'tpope/vim-unimpaired', lazy = false }, 'echasnovski/mini.comment',
opts = {
options = {
ignore_blank_line = true,
}
},
},
{
'tpope/vim-unimpaired',
lazy = false,
},
{ 'stevearc/dressing.nvim' }, { 'stevearc/dressing.nvim' },
{ 'kevinhwang91/nvim-bqf' }, { 'kevinhwang91/nvim-bqf' },
} }

View File

@@ -25,10 +25,17 @@ vim.api.nvim_create_autocmd('BufRead', {
-- Start terminals in insert mode -- Start terminals in insert mode
vim.api.nvim_create_autocmd('TermOpen', { vim.api.nvim_create_autocmd('TermOpen', {
group = group, pattern = 'term://*', group = group,
callback = function() pattern = 'term://*',
callback = function(args)
-- nvim-dap/nvim-dap-view uses terminal buffers in the background which are
-- not visible, don't start insert mode if the dap-type variable exists.
local success, dap_type = pcall(vim.api.nvim_buf_get_var, args.buf, 'dap-type')
if success and dap_type then
return
end
vim.cmd.startinsert() vim.cmd.startinsert()
end end,
}) })
-- Automatically press enter when the terminal process exit successfully -- Automatically press enter when the terminal process exit successfully

View File

@@ -52,7 +52,7 @@ vim.api.nvim_create_user_command('Remove', function(opts)
end end
end end
-- Actually remove the file using the selected callback. -- Actually remove the file using the selected callback.
vim.loop.fs_unlink(path, callback) vim.uv.fs_unlink(path, callback)
end, { bang = true }) end, { bang = true })
-- :Move the file associated with the current buffer -- :Move the file associated with the current buffer
@@ -62,7 +62,7 @@ vim.api.nvim_create_user_command('Move', function(opts)
if vim.fn.isdirectory(dest) ~= 0 then if vim.fn.isdirectory(dest) ~= 0 then
dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t')) dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t'))
end end
vim.loop.fs_rename(source, dest, function(err, success) vim.uv.fs_rename(source, dest, function(err, success)
if success then if success then
vim.schedule(function() vim.schedule(function()
vim.cmd.edit(dest) vim.cmd.edit(dest)
@@ -87,7 +87,7 @@ vim.api.nvim_create_user_command('Rename', function(opts)
dest = vim.fn.resolve(dir .. '/' .. opts.args) dest = vim.fn.resolve(dir .. '/' .. opts.args)
end end
local buffer = vim.api.nvim_get_current_buf() local buffer = vim.api.nvim_get_current_buf()
vim.loop.fs_rename(source, dest, function(err, success) vim.uv.fs_rename(source, dest, function(err, success)
if not success then if not success then
error(err) error(err)
else else

View File

@@ -29,7 +29,7 @@ vim.keymap.set('', '<leader>p', '"+p', opts)
vim.keymap.set('', '<leader>P', '"+P', opts) vim.keymap.set('', '<leader>P', '"+P', opts)
-- Undo neovim's default mapping of Y to y$ -- Undo neovim's default mapping of Y to y$
vim.cmd.unmap('Y') vim.keymap.del('n', 'Y')
-- Make nvim :terminal more like vim :terminal -- Make nvim :terminal more like vim :terminal
vim.keymap.set('t', '<C-w>N', '<C-\\><C-n>', opts) vim.keymap.set('t', '<C-w>N', '<C-\\><C-n>', opts)
@@ -50,3 +50,10 @@ vim.keymap.set('v', '<leader>rg', ":'<,'>Rg<CR>", opts)
-- Mapping to toggle checkboxes -- Mapping to toggle checkboxes
vim.keymap.set('n', '<leader><CR>', ':CheckboxToggle<CR>', opts) vim.keymap.set('n', '<leader><CR>', ':CheckboxToggle<CR>', opts)
-- Format whole file using internal algorithm
vim.keymap.set('n', '<leader>gw', function()
local view = vim.fn.winsaveview()
vim.cmd('normal! gggwG')
vim.fn.winrestview(view)
end, { desc = 'Format whole file with gw' })

View File

@@ -78,7 +78,7 @@ vim.opt.splitbelow = true
vim.opt.splitright = true vim.opt.splitright = true
-- Use existing windows and tabs when jumping to errors -- Use existing windows and tabs when jumping to errors
vim.opt.switchbuf = 'usetab' vim.opt.switchbuf = 'usetab,uselast'
-- Automatically write changes to files -- Automatically write changes to files
vim.opt.autowrite = true vim.opt.autowrite = true
@@ -91,7 +91,7 @@ vim.opt.foldlevel = 20
vim.opt.foldmethod = 'expr' vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
vim.opt.foldtext = '' vim.opt.foldtext = ''
vim.opt.fillchars = 'fold: ' vim.opt.fillchars = { fold = ' ' }
-- Enable all mouse features -- Enable all mouse features
vim.opt.mouse = 'a' vim.opt.mouse = 'a'