Changed some nvim stuff, giving a try to terminals again, added keybinds

to easily open/close the terminal and also Ctrl+HJKL to navigate
This commit is contained in:
2025-05-03 16:07:54 +03:00
parent f3a4f45bc8
commit f13a62d3fd
3 changed files with 55 additions and 34 deletions

View File

@@ -5,20 +5,18 @@ return {
notify = { enabled = false },
lsp = {
progress = { enabled = false },
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
-- override the default lsp markdown formatter with Noice
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
-- ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
-- override the lsp markdown formatter with Noice
['vim.lsp.util.stylize_markdown'] = true,
-- override cmp documentation with Noice (needs the other options to work)
-- ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
-- ['vim.lsp.util.stylize_markdown'] = true,
},
hover = {
---@type NoiceViewOptions
enabled = true,
silent = false, -- set to true to not show a message if hover is not available
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
signature = {

View File

@@ -1,6 +1,7 @@
return {
'pwntester/octo.nvim',
cmd = 'Octo',
event = { { event = 'BufReadCmd', pattern = 'octo://*' } },
dependencies = {
'nvim-lua/plenary.nvim',
'folke/snacks.nvim',
@@ -11,21 +12,24 @@ return {
{ '<leader>pr', '<cmd>Octo pr search<cr>', desc = 'Github [PR]s (local)' },
{ '<leader>gI', '<cmd>Octo search is:issue is:open author:@me<cr>', desc = '[G]ithub [I]ssues (global)' },
{ '<leader>pR', '<cmd>Octo search is:pr author:@me<cr>', desc = 'Github [PR]s (global)' },
},
config = function()
require('octo').setup({
suppress_missing_scope = { projects_v2 = true },
picker = 'snacks',
})
vim.treesitter.language.register('markdown', 'octo')
vim.api.nvim_create_autocmd('FileType', {
pattern = 'octo',
callback = function()
-- Autocomplete for @ (user mention) and # (issue)
vim.keymap.set('i', '@', '@<C-x><C-o>', { silent = true, buffer = true })
vim.keymap.set('i', '#', '#<C-x><C-o>', { silent = true, buffer = true })
end,
})
end,
{ '<localleader>a', '', desc = '+assignee (Octo)', ft = 'octo' },
{ '<localleader>c', '', desc = '+comment/code (Octo)', ft = 'octo' },
{ '<localleader>l', '', desc = '+label (Octo)', ft = 'octo' },
{ '<localleader>i', '', desc = '+issue (Octo)', ft = 'octo' },
{ '<localleader>r', '', desc = '+react (Octo)', ft = 'octo' },
{ '<localleader>p', '', desc = '+pr (Octo)', ft = 'octo' },
{ '<localleader>pr', '', desc = '+rebase (Octo)', ft = 'octo' },
{ '<localleader>ps', '', desc = '+squash (Octo)', ft = 'octo' },
{ '<localleader>v', '', desc = '+review (Octo)', ft = 'octo' },
{ '<localleader>g', '', desc = '+goto_issue (Octo)', ft = 'octo' },
{ '@', '', mode = 'i', ft = 'octo', silent = true },
{ '#', '', mode = 'i', ft = 'octo', silent = true },
},
opts = {
enable_builtin = true,
-- default_to_projects_v2 = true,
default_merge_method = 'squash',
picker = 'snacks',
},
}

View File

@@ -1,3 +1,13 @@
local function term_nav(dir)
---@param self snacks.terminal
return function(self)
return self:is_floating() and '<c-' .. dir .. '>'
or vim.schedule(function()
vim.cmd.wincmd(dir)
end)
end
end
return {
'folke/snacks.nvim',
priority = 1000,
@@ -21,7 +31,14 @@ return {
style = 'compact',
filter = function(notif)
local exact_filter = { 'No information available', 'No code actions available' }
local contains_filter = { 'fewer lines', 'lines indented', 'lines yanked', 'more lines', 'E486:' }
local contains_filter = {
'fewer lines',
'lines indented',
'lines yanked',
'more lines',
'lines moved',
'E486:',
}
for _, msg in ipairs(exact_filter) do
if notif.msg == msg then
return false
@@ -67,7 +84,16 @@ return {
-- easing = 'linear',
-- },
-- },
terminal = {},
terminal = {
win = {
keys = {
nav_h = { '<C-h>', term_nav('h'), desc = 'Go to Left Window', expr = true, mode = 't' },
nav_j = { '<C-j>', term_nav('j'), desc = 'Go to Lower Window', expr = true, mode = 't' },
nav_k = { '<C-k>', term_nav('k'), desc = 'Go to Upper Window', expr = true, mode = 't' },
nav_l = { '<C-l>', term_nav('l'), desc = 'Go to Right Window', expr = true, mode = 't' },
},
},
},
},
keys = {
{
@@ -107,7 +133,7 @@ return {
{
'<leader>nh',
function()
Snacks.notifier.show_history()
Snacks.picker.notifications({ layout = 'telescope' })
end,
desc = '[N]otification [H]istory',
},
@@ -247,18 +273,11 @@ return {
},
{
'<leader>nt',
'<C-t>',
function()
Snacks.terminal.open()
Snacks.terminal()
end,
desc = '[N]ew [T]erminal',
},
{
'<leader>T',
function()
Snacks.terminal.toggle()
end,
desc = 'Toggle [T]erminal',
},
},
}