<leader>dw document wrap

This commit is contained in:
Imbus 2024-11-12 16:31:04 +01:00
parent c048e460d4
commit e145f9f06d
2 changed files with 31 additions and 0 deletions

View file

@ -81,4 +81,32 @@ vim.keymap.set('n', '<leader><tab>d', '<cmd>tabclose<cr>', { desc = 'Close Tab'
vim.keymap.set('n', '<leader><tab>]', '<cmd>tabnext<cr>', { desc = 'Next Tab' }) vim.keymap.set('n', '<leader><tab>]', '<cmd>tabnext<cr>', { desc = 'Next Tab' })
vim.keymap.set('n', '<leader><tab>[', '<cmd>tabprevious<cr>', { desc = 'Previous Tab' }) vim.keymap.set('n', '<leader><tab>[', '<cmd>tabprevious<cr>', { desc = 'Previous Tab' })
-- Toggle LLM Suggestions
vim.keymap.set('n', '<leader>tt', function()
local cp = require 'copilot.suggestion'
cp.toggle_auto_trigger()
if vim.b.copilot_suggestion_auto_trigger then
vim.notify 'Suggestions Enabled'
else
vim.notify 'Suggestions Disabled'
end
end, { desc = '[T]oggle LLM Suggestion Auto-[T]rigger' })
-- Define a function to wrap lines to 80 columns
vim.keymap.set('n', '<leader>dw', function()
-- Save the current 'textwidth' setting
local current_tw = vim.o.textwidth
-- Set 'textwidth' to 80 temporarily
vim.o.textwidth = 80
-- Reformat all lines in the buffer
vim.api.nvim_command 'normal! ggVGgq'
-- Restore the original 'textwidth'
vim.o.textwidth = current_tw
end, { desc = '[D]ocument [W]rap to 80 column width' })
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View file

@ -16,6 +16,9 @@ require('lazy').setup({
-- Remember position -- Remember position
{ 'vladdoster/remember.nvim', opts = {} }, { 'vladdoster/remember.nvim', opts = {} },
-- Terminal
{'akinsho/toggleterm.nvim', version = "*", config = true},
-- NOTE: Plugins can also be added by using a table, -- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following -- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc. -- keys can be used to configure plugin behavior/loading/etc.