fix cmp & invert ff/fb & conform

This commit is contained in:
hyper 2024-10-06 16:05:50 +08:00
parent f822d78283
commit 98c76f67f2
2 changed files with 31 additions and 3 deletions

View File

@ -69,8 +69,8 @@ return {
vim.keymap.set('n', '<leader>cr', builtin.lsp_references, { desc = 'Telescope lsp references' })
vim.keymap.set('n', '<leader>cs', builtin.treesitter, { desc = 'Telescope treesitter' })
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fb', function()
vim.keymap.set('n', '<leader>fp', builtin.find_files, { desc = 'Telescope find in project' })
vim.keymap.set('n', '<leader>ff', function()
builtin.find_files({ cwd = utils.buffer_dir() })
end, { desc = 'Telescope find in buffer dir' })

View File

@ -15,7 +15,8 @@ return {
"hrsh7th/cmp-path",
},
config = function()
require('cmp').setup({
local cmp = require('cmp')
cmp.setup({
completion = {
keyword_length = 1,
max_item_count = 6
@ -24,6 +25,11 @@ return {
{ name = "nvim_lsp", keyword_length = 1, max_item_count = 6 },
{ name = "buffer", keyword_length = 1, max_item_count = 6 },
{ name = "path", keyword_length = 1, max_item_count = 6 },
},
mapping = {
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item(), {'i', 'c'}),
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item(), {'i', 'c'}),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- accept currently selected item
}
})
end
@ -40,6 +46,28 @@ return {
indent = { enable = true },
})
end
},
{
'stevearc/conform.nvim',
opts = {},
config = function()
require("conform").setup({
formatters_by_ft = {
-- lua = { "stylua" },
-- Conform will run multiple formatters sequentially
-- python = { "isort", "black" },
-- You can customize some of the format options for the filetype (:help conform.format)
-- rust = { "rustfmt", lsp_format = "fallback" },
-- Conform will run the first available formatter
javascript = { "prettierd" },
typescript = { "prettierd" },
css = { "prettierd" },
less = { "prettierd" },
html = { "prettierd" },
},
})
end
}
}