neovim-confs/lua/custom/plugins/editing.lua

86 lines
2.6 KiB
Lua

return {
{
'numToStr/Comment.nvim',
keys = {
{ 'gcc', mode = 'n', desc = 'Comment toggle current line' },
{ 'gc', mode = { 'n', 'o' }, desc = 'Comment toggle linewise' },
{ 'gc', mode = 'x', desc = 'Comment toggle linewise (visual)' },
{ 'gbc', mode = 'n', desc = 'Comment toggle current block' },
{ 'gb', mode = { 'n', 'o' }, desc = 'Comment toggle blockwise' },
{ 'gb', mode = 'x', desc = 'Comment toggle blockwise (visual)' },
{
'<leader>v',
function()
require('Comment.api').toggle.linewise.current()
end,
mode = { 'n' },
desc = 'Comment toggle current line',
},
{
'<leader>v',
function()
local esc = vim.api.nvim_replace_termcodes('<ESC>', true, false, true)
vim.api.nvim_feedkeys(esc, 'nx', false)
require('Comment.api').toggle.linewise(vim.fn.visualmode())
end,
mode = { 'x' },
desc = 'Comment toggle selected lines',
},
},
config = function(_, opts)
vim.keymap.set('n', '<leader>c', function()
require('Comment.api').toggle.linewise.current()
end, { desc = '[T]oggle [C]omment' })
vim.keymap.set('v', '<leader>c', function()
require('Comment.api').toggle.linewise.current()
end, { desc = '[T]oggle [C]omment' })
require('Comment').setup(opts)
end,
},
{
'uga-rosa/ccc.nvim',
lazy = false,
event = 'FileType',
keys = {
{ '<Leader>cp', '<cmd>CccPick<CR>', desc = 'Color-picker' },
},
opts = {
highlighter = {
auto_enable = true,
lsp = true,
excludes = { 'lazy', 'mason', 'help', 'neo-tree' },
},
},
},
{
'dhruvasagar/vim-table-mode',
lazy = false,
-- <Leader>tm is automatically set for toggle
-- see <Leader>t menu
},
{
'ziontee113/icon-picker.nvim',
keys = {
{ '<localleader>fi', '<cmd>IconPickerNormal<CR>', desc = 'pick icon' },
},
cmd = { 'IconPickerInsert', 'IconPickerYank', 'IconPickerNormal' },
config = function()
require('icon-picker').setup { disable_legacy_commands = true }
end,
},
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
},
}