1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
jdhao
a3c8b3d5b5 Update configuration for nvim-cmp
1. restrict max width of the completion menu. Here I am using
   lspkind.nvim to achieve this. There are other native ways to do this,
   see also https://github.com/hrsh7th/nvim-cmp/discussions/609 and
   https://github.com/hrsh7th/nvim-cmp/issues/980
2. remove cmp-emoji as it is rarely used and interfere when I write
   Python
3. lower the transparency for popup menu
2024-08-20 01:04:02 +02:00
jdhao
d150f39afc Add new plugins 2024-08-19 23:37:57 +02:00
jdhao
3904cd4ccf Update config for handling large files 2024-08-19 23:34:21 +02:00
4 changed files with 38 additions and 11 deletions

View File

@ -35,7 +35,6 @@ cmp.setup {
{ name = "ultisnips" }, -- For ultisnips user. { name = "ultisnips" }, -- For ultisnips user.
{ name = "path" }, -- for path completion { name = "path" }, -- for path completion
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion { name = "buffer", keyword_length = 2 }, -- for buffer word completion
{ name = "emoji", insert = true }, -- emoji completion
}, },
completion = { completion = {
keyword_length = 1, keyword_length = 1,
@ -50,12 +49,14 @@ cmp.setup {
menu = { menu = {
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
ultisnips = "[US]", ultisnips = "[US]",
nvim_lua = "[Lua]",
path = "[Path]", path = "[Path]",
buffer = "[Buffer]", buffer = "[Buffer]",
emoji = "[Emoji]", emoji = "[Emoji]",
omni = "[Omni]", omni = "[Omni]",
}, },
show_labelDetails = true,
maxwidth = 40,
ellipsis_char = "...",
}, },
}, },
} }

View File

@ -32,7 +32,6 @@ local plugin_specs = {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-omni", "hrsh7th/cmp-omni",
"hrsh7th/cmp-emoji",
"quangnguyen30192/cmp-nvim-ultisnips", "quangnguyen30192/cmp-nvim-ultisnips",
}, },
config = function() config = function()
@ -126,6 +125,15 @@ local plugin_specs = {
"nvim-telescope/telescope-symbols.nvim", "nvim-telescope/telescope-symbols.nvim",
}, },
}, },
{
"ibhagwan/fzf-lua",
-- optional for icon support
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
-- calling `setup` is optional for customization
require("fzf-lua").setup {}
end,
},
{ {
"MeanderingProgrammer/markdown.nvim", "MeanderingProgrammer/markdown.nvim",
main = "render-markdown", main = "render-markdown",
@ -546,6 +554,26 @@ local plugin_specs = {
ft = "lua", -- only load on lua files ft = "lua", -- only load on lua files
opts = {}, opts = {},
}, },
{
"CopilotC-Nvim/CopilotChat.nvim",
branch = "canary",
dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
},
opts = {
debug = true, -- Enable debugging
-- See Configuration section for rest
},
-- See Commands section for default commands if you want to lazy load on them
},
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
config = function()
require("copilot").setup {}
end,
},
} }
require("lazy").setup { require("lazy").setup {

View File

@ -101,16 +101,14 @@ augroup END
" ref: https://vi.stackexchange.com/a/169/15292 " ref: https://vi.stackexchange.com/a/169/15292
function! s:handle_large_file() abort function! s:handle_large_file() abort
let g:large_file = 10485760 " 10MB let g:file_size_limit = 524288 " 0.5MB
let f = expand("<afile>") let f = expand("<afile>")
if getfsize(f) > g:large_file || getfsize(f) == -2 if getfsize(f) > g:file_size_limit || getfsize(f) == -2
set eventignore+=all setlocal eventignore=all
" turning off relative number helps a lot " turning off relative number helps a lot
set norelativenumber setlocal norelativenumber
setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1 setlocal noswapfile bufhidden=unload undolevels=-1
else
set eventignore-=all relativenumber
endif endif
endfunction endfunction

View File

@ -121,7 +121,7 @@ set completeopt+=menuone " Show menu even if there is only one item
set completeopt-=preview " Disable the preview window set completeopt-=preview " Disable the preview window
set pumheight=10 " Maximum number of items to show in popup menu set pumheight=10 " Maximum number of items to show in popup menu
set pumblend=10 " pseudo transparency for completion menu set pumblend=5 " pseudo transparency for completion menu
set winblend=0 " pseudo transparency for floating window set winblend=0 " pseudo transparency for floating window